A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: use async zip for faster zipping
Abdullah Atta55f8a226c8b9
diff --git a/apps/web/src/utils/zip.ts b/apps/web/src/utils/zip.tsindex 10331e209..45de57c25 100644--- a/apps/web/src/utils/zip.ts+++ b/apps/web/src/utils/zip.ts@@ -25,14 +25,16 @@ type File = { filename: string; content: string };async function zip(files: File[], format: string): Promise<Uint8Array> {const obj: Unzipped = Object.create(null);files.forEach((file) => {- const name = sanitizeFilename(file.filename);+ const name = sanitizeFilename(file.filename, { replacement: "-" });let counter = 0;while (obj[makeFilename(name, format, counter)]) ++counter;obj[makeFilename(name, format, counter)] = textEncoder.encode(file.content);});- const { zipSync } = await import("fflate");- return zipSync(obj);+ const { zip } = await import("fflate");+ return new Promise((resolve, reject) =>+ zip(obj, (err, data) => (err ? reject(err) : resolve(data)))+ );}export { zip };