0👍
✅
One approach would be to send the image data as a base64 endcoded string using btoa, the set the image’s src
attribute using the encoded string from the response:
<img src=`data:image/png;base64,${data}`/>
Otherwise, you can also return the response image from Express like:
let image = new Buffer(imageData, 'base64');
res.writeHead(200, {
'Content-Type': 'image/png',
'Content-Length': image.length
});
res.end(image);
Source:stackexchange.com