Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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')}`
 
PREVIOUS NEXT
Tagged: #node #fetch #image
ADD COMMENT
Topic
Name
4+8 =