Reputation: 6962
I need to use javascript to create an image file on my local computer a .png or .jpg etc file, I have the base 64 of the image, can this be done?
Upvotes: 1
Views: 377
Reputation: 3
In Nodejs, create a buffer with base64 encoding and write the buffer to the file
refer - https://stackoverflow.com/a/6933413/4325568
Upvotes: 0
Reputation: 803
Yes you can do it. All you need is:
var img = new Image();
img.src = 'data:image/gif;base64,...';
document.body.appendChild(img);
Upvotes: 3