node.js - Convert file from base64 and send to some external service as binary file -
i send file node.js server base64 string, need send external service binary file. possible without saving file file system? i'm trying file on node.js side in way:
var filedata = req.body.value, filename = req.body.id, base64data = filedata.replace(/^data:image\/jpeg;base64,/,""); modules.fs.writefile( filename, base64data, 'base64', function(err) { if (err) { console.log(err); } else { //read file file system , send external service } });
write buffer:
var buffer = new buffer(base64data, 'base64');
an alternative https://github.com/cjblomqvist/base64stream
Comments
Post a Comment