Answers for "image base64 npm"

0

node fetch image to base64

import fetch from 'node-fetch'
const res = await fetch(image)

const imgBody = `data:${res.headers.get('content-type')};base64,${(await res.arrayBuffer()).toString('base64')}`
Posted by: Guest on July-16-2021
-2

nodejs read image as base64

const fs = require('fs');
const contents = fs.readFileSync('/path/to/file.jpg', {encoding: 'base64'});
Posted by: Guest on May-06-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language