Search
 
SCRIPT & CODE EXAMPLE
 

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')}`
Comment

nodejs read image as base64

const fs = require('fs');
const contents = fs.readFileSync('/path/to/file.jpg', {encoding: 'base64'});
Comment

nodejs read image as base64

const fs = require('fs').promises;
const contents = await fs.readFile('/path/to/file.jpg', {encoding: 'base64'});
Comment

PREVIOUS NEXT
Code Example
Typescript :: lua operators 
Typescript :: pandas value_counts sort descending 
Typescript :: Scriptsactivate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at 
Typescript :: Keras cheatsheets pdfs 
Typescript :: tepescript loop object 
Typescript :: class-validator validate nested object 
Typescript :: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories. 
Typescript :: linq check if exists in list 
Typescript :: how to separate elements in list python 
Typescript :: dictionary comprehension using while copying elements from another dictionary in python 
Typescript :: angular show another component 
Typescript :: what is typescript 
Typescript :: how to fix error 429 too many requests laravel 
Typescript :: java write arraylist of objects to file 
Typescript :: typescript for loop key value pai 
Typescript :: find all running ports node 
Typescript :: flutter google fonts 
Typescript :: multer s3 
Typescript :: retrieve data from firebase flutter 
Typescript :: pandas value_counts multiple columns 
Typescript :: ANGULAR: create component in module 
Typescript :: get n random elements from list java 
Typescript :: pywavelets tutorial 
Typescript :: nest js parseint pipe 
Typescript :: typescript check type 
Typescript :: typescript get object property by name 
Typescript :: django model get all documents with a given foreign key 
Typescript :: how to find specific elements from a list in java 
Typescript :: class validator array of enum 
Typescript :: alphabets range using re 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =