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

Function pack

apps/reader/src/sync.ts:92–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90}
91
92export async function pack() {
93 const books = await db?.books.toArray()
94 const covers = await db?.covers.toArray()
95 const files = await db?.files.toArray()
96
97 const zip = new JSZip()
98 zip.file(DATA_FILENAME, serializeData(books))
99 zip.file('covers.json', JSON.stringify(covers))
100
101 const folder = zip.folder('files')
102 files?.forEach((f) => folder?.file(f.file.name, f.file))
103
104 const date = new Intl.DateTimeFormat('fr-CA').format().replaceAll('-', '')
105
106 return zip.generateAsync({ type: 'blob' }).then((content) => {
107 saveAs(content, `flow_backup_${date}.zip`)
108 })
109}
110
111export async function unpack(file: File) {
112 const zip = new JSZip()

Callers

nothing calls this directly

Calls 3

serializeDataFunction · 0.85
formatMethod · 0.80
forEachMethod · 0.45

Tested by

no test coverage detected