nodejs parse iamge from abse64 code example
Example 1: nodejs fs writefile base64url
const fileContents = new Buffer(attachmentResponse.data.data, 'base64')
fs.writeFile(part.filename, fileContents, (err) => {
if (err) return console.error(err)
console.log('file saved to ', part.filename)
})
Example 2: buffer to image nodejs
function toBase64(arr) {
return btoa(
arr.reduce((data, byte) => data + String.fromCharCode(byte), '')
);
}
$('#two').prepend($('<img>',{id:'theImg2',src:`data:image/png;base64,${toBase64( selected[0].image2.data)}`}))