const fs = require('fs') // base64 data to buffer var buffer = Buffer.from('your-base64-data','base64') // buffer to image fs.writeFileSync('file-name.jpg',buffer)