Closed zalnaRs closed 3 years ago
For anyone wondering,
const {data,format} = result.tags.picture;
var base64String = "";
for (var i = 0; i < data.length; i++) {
base64String += String.fromCharCode(data[i]);
}
var toReturn = "data:" + format + ";base64," + Buffer.from(base64String, 'binary').toString('base64');
return toReturn
This worked for me
Thank you! Good catch, I should have tested before accepting the pull request 😅
The base64 image example is incorrect because its didn't use
window.btoa(base64String)
so it will don't decode properly.