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 simple transform stream for export progress
Abdullah Atta2bb3652be2f8
diff --git a/apps/web/src/common/export.ts b/apps/web/src/common/export.tsindex 79a7a1b11..ee04433c1 100644--- a/apps/web/src/common/export.ts+++ b/apps/web/src/common/export.ts@@ -86,13 +86,24 @@ export async function exportNotes(title: "Exporting notes",subtitle: "Please wait while your notes are exported.",action: async (report) => {+ const total = await notes.count();+ let progress = 0;+const noteStream = fromAsyncIterator(notes[Symbol.asyncIterator]());await noteStream.pipeThrough(- new ExportStream(format, undefined, (c, text) =>- report({ current: c, text })- )+ new TransformStream<Note, Note>({+ transform(note, controller) {+ controller.enqueue(note);+ report({+ total,+ current: progress++,+ text: `Exporting "${note?.title}"`+ });+ }+ }))+ .pipeThrough(new ExportStream(format, undefined)).pipeThrough(createZipStream()).pipeTo(await createWriteStream("notes.zip"));return true;diff --git a/apps/web/src/utils/streams/export-stream.ts b/apps/web/src/utils/streams/export-stream.tsindex 642c7f673..9e4b02d48 100644--- a/apps/web/src/utils/streams/export-stream.ts+++ b/apps/web/src/utils/streams/export-stream.ts@@ -37,9 +37,9 @@ export class ExportStream extends TransformStream<Note, ZipFile> {return;}- if (!note || format === "pdf") return;+ if (format === "pdf") return;- const result = await exportNote(note, format);+ const result = await exportNote(note, { format });if (!result) return;const { filename, content } = result;