Hi there,
I'm trying to proxy a file upload through to a request.post() on another domain. I may be doing this wrong, but I think the issue is that the part doesn't have a pause() method.
var form = new formidable.IncomingForm();
form.parse(req);
form.onPart = function(part) {
var r = request({
method: 'POST',
url: someUrl,
headers: extractRequestHeaders(req)
});
r.form().append('file', part);
r.pipe(res);
}
According to request docs, r.form().append can take a read stream such as fs.createReadStream().
Here is the result of the upload:
TypeError: Object #<Stream> has no method 'pause'
at Function.DelayedStream.create (/Users/seanadkinson/code/hthu-assets/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js:35:12)
at FormData.CombinedStream.append (/Users/seanadkinson/code/hthu-assets/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js:45:30)
at FormData.append (/Users/seanadkinson/code/hthu-assets/node_modules/request/node_modules/form-data/lib/form_data.js:43:3)
at IncomingForm.form.onPart (/Users/seanadkinson/code/hthu-assets/routes/eligibilityProxy.js:54:18)
at MultipartParser.parser.onHeadersEnd (/Users/seanadkinson/code/hthu-assets/node_modules/formidable/lib/incoming_form.js:410:10)
at callback (/Users/seanadkinson/code/hthu-assets/node_modules/formidable/lib/multipart_parser.js:102:31)
at MultipartParser.write (/Users/seanadkinson/code/hthu-assets/node_modules/formidable/lib/multipart_parser.js:215:9)
at IncomingForm.write (/Users/seanadkinson/code/hthu-assets/node_modules/formidable/lib/incoming_form.js:156:34)
at IncomingMessage.<anonymous> (/Users/seanadkinson/code/hthu-assets/node_modules/formidable/lib/incoming_form.js:122:12)
at IncomingMessage.emit (events.js:95:17)
Am I reading the error correctly? Is there a different way I should do what i'm doing?
Thank you, Sean
Hi there,
I'm trying to proxy a file upload through to a
request.post()on another domain. I may be doing this wrong, but I think the issue is that thepartdoesn't have apause()method.According to request docs,
r.form().appendcan take a read stream such asfs.createReadStream().Here is the result of the upload:
Am I reading the error correctly? Is there a different way I should do what i'm doing?
Thank you, Sean