Skip to content
Advertisement

Getting the image file from the server and converting it to base64 using nodejs express.js

How to create a function which gets the exact image file from the server and then converting it to base 64 and lastly storing it to a variable.

Note: Exact image file (no need to loop through the directory to list all files).

Advertisement

Answer

You can do that with the image-to-base64 library.

Installation

JavaScript

Usage

JavaScript

Displaying an image using base64

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement