How can I save a base64-encoded image to disk?
I think you are converting the data a bit more than you need to. Once you create the buffer with the proper encoding, you just need to write the buffer to the file. var base64Data = req.rawBody.replace(/^data:image\/png;base64,/, “”); require(“fs”).writeFile(“out.png”, base64Data, ‘base64′, function(err) { console.log(err); }); new Buffer(…, ‘base64’) will convert the input string to a … Read more