1var imageBuffer = request.file.buffer;
2var imageName = 'public/images/map.png';
3
4fs.createWriteStream(imageName).write(imageBuffer);
5
1var base64Data = req.body.image.replace(/^data:image\/png;base64,/, "");
2
3require("fs").writeFile("out.png", base64Data, 'base64', function(err) {
4 console.log(err);
5});
6