Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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')}`
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #node #fetch #image
ADD COMMENT
Topic
Name
3+2 =