requirements: interface base64 images on node, and then upload base64 to other servers. Upload base64 in the form of stream using request module, and convert the module using streamifier to stream submission but return
"Processing of multipart/form-data request failed. Stream ended unexpectedly"
the code is as follows:
var file = "base64"
var imgData = file.replace(/^data:image\/\w+;base64,/, "");
var dataBuffer = new Buffer(imgData, "base64");
var imgBuffer = streamifier.createReadStream(dataBuffer)
request.post({ url:httpurl, formData:{"file":imgBuffer ,impl,type,dataType}}, function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) //
"Processing of multipart/form-data request failed. Stream ended unexpectedly"
res.json({status:response.statusCode})
}
})