I searched and tried all solutions in stackoverflow, but none of them work in my instance. Basically I have an image edited by html5 canvas, downloading from the client, and I need to save it to disk, but, unfortunately, I can not open the file that I just saved. (I am using Windows 7)
My code is:
var base64Data = req.body.image.replace(/^data:image\/(png|gif|jpeg);base64,/,'');
require('fs').writeFile('public/aboutToGiveUp.png', new Buffer(base64Data, 'base64'));
source
share