0

I am working on a web project using Node.js, HTML5, CSS5 and Jquery. I need to get an image from the server using a URL (eg. address.com/image.jpg) as Base64 image data for zipping using JSZip.

Can anyone tell me how to get the url image as base64 image data? Thanks in advance!

MrRhoads
  • 183
  • 1
  • 10

1 Answers1

0

You can convert all files regardless whether they are images or not.

1) read your file into a buffer.
2) call toString('base64') on that buffer.

You can use filters to do that for any image url, or you can have a separate endpoint to handle base64 conversions.

Vj-
  • 722
  • 6
  • 18