MCPcopy Create free account
hub / github.com/pacexy/flow / addFile

Function addFile

apps/reader/src/file.ts:61–71  ·  view source on GitHub ↗
(id: string, file: File, epub?: Book)

Source from the content-addressed store, hash-verified

59}
60
61export async function addFile(id: string, file: File, epub?: Book) {
62 db?.files.add({ id, file })
63
64 if (!epub) {
65 epub = await fileToEpub(file)
66 }
67
68 const url = await epub.coverUrl()
69 const cover = url && (await toDataUrl(url))
70 db?.covers.add({ id, cover })
71}
72
73export function readBlob(fn: (reader: FileReader) => void) {
74 return new Promise<string>((resolve) => {

Callers 2

LibraryFunction · 0.90
addBookFunction · 0.85

Calls 4

fileToEpubFunction · 0.85
toDataUrlFunction · 0.85
coverUrlMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected