1

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?

Adam Katz
  • 6,999
  • 11
  • 42
  • 74
  • please check this : https://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file – Sandeep Feb 16 '16 at 12:23

2 Answers2

3

Yes you can do it. All you need is:

var img = new Image();
img.src = 'data:image/gif;base64,...';
document.body.appendChild(img);
Przemek
  • 803
  • 4
  • 15
0

In Nodejs, create a buffer with base64 encoding and write the buffer to the file

refer - https://stackoverflow.com/a/6933413/4325568

Community
  • 1
  • 1