()
| 90 | } |
| 91 | |
| 92 | export 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 | |
| 111 | export async function unpack(file: File) { |
| 112 | const zip = new JSZip() |
nothing calls this directly
no test coverage detected