Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/pull/17647

Daniel7271c14513c0
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index dba595b734..8845e9d155 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -131,8 +131,19 @@ export const saveExportFile = async (uri: string) => {
`HTTP ${response.status} ${response.statusText}: ${response.url || resolved.href}`
);
}
- const arrayBuffer = await response.arrayBuffer();
- await fs.promises.writeFile(result.filePath, new Uint8Array(arrayBuffer));
+ const reader = response.body.getReader();
+ const fd = await fs.promises.open(result.filePath, "w");
+ try {
+ while (true) {
+ const {done, value} = await reader.read();
+ if (done) {
+ break;
+ }
+ await fd.write(value);
+ }
+ } finally {
+ await fd.close();
+ }
showMessage(window.siyuan.languages.exported);
return;
} catch (e) {