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

Function fetchBook

apps/reader/src/file.ts:89–100  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

87}
88
89export async function fetchBook(url: string) {
90 const filename = decodeURIComponent(/\/([^/]*\.epub)$/i.exec(url)?.[1] ?? '')
91 const books = await db?.books.toArray()
92 const book = books?.find((b) => b.name === filename)
93
94 return (
95 book ??
96 fetch(url)
97 .then((res) => res.blob())
98 .then((blob) => addBook(new File([blob], filename)))
99 )
100}

Callers 3

IndexFunction · 0.90
onClickFunction · 0.90
LibraryFunction · 0.90

Calls 2

addBookFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected