zip streaming

This commit is contained in:
2026-05-12 19:12:40 +02:00
parent 824170eaea
commit 95a7f6d7a7

View File

@@ -1490,7 +1490,20 @@
} }
exportStatusText.textContent = 'Generating ZIP file...'; exportStatusText.textContent = 'Generating ZIP file...';
const content = await zip.generateAsync({ type: 'blob', streamFiles: true }); const content = await new Promise((resolve, reject) => {
const chunks = [];
zip.generateInternalStream({ type: 'uint8array', streamFiles: true })
.on('data', (chunk) => chunks.push(chunk))
.on('error', reject)
.on('end', () => {
try {
resolve(new Blob(chunks, { type: 'application/zip' }));
} catch (e) {
reject(e);
}
})
.resume();
});
const link = document.createElement('a'); const link = document.createElement('a');
link.href = URL.createObjectURL(content); link.href = URL.createObjectURL(content);