1var base64Data = req.rawBody.replace(/^data:image\/png;base64,/, "");
2
3require("fs").writeFile("out.png", base64Data, 'base64', function(err) {
4 console.log(err);
5});
1const fs = require('fs');
2const contents = fs.readFileSync('/path/to/file.jpg', {encoding: 'base64'});
3