MCPcopy Create free account
hub / github.com/editablejs/editable / readBase64WithFileReader

Function readBase64WithFileReader

packages/plugins/image/src/utils.ts:6–17  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

4import { getOptions } from './options'
5
6const readBase64WithFileReader = (file: File) => {
7 return new Promise<string>((resolve, reject) => {
8 const reader = new FileReader()
9 reader.readAsDataURL(file)
10 reader.onload = () => {
11 resolve(reader.result as string)
12 }
13 reader.onerror = error => {
14 reject(error)
15 }
16 })
17}
18
19const readBase64WithFetch = (url: string) => {
20 return new Promise<string>((resolve, reject) => {

Callers 1

readBase64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…