fix: bound ZIP directory memory for slow downloads

This commit is contained in:
Codex committed 2026-11-09 08:54:26 +00:00
1 parent 4263a87399
commit ac28c64c6c
8 files changed
+263 -7

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
import { boundedZip } from "../bounded-zip";
import { appendArchiveEntry, zipEntryOptions } from "../archive-entry";
import config from "../../config";
import * as fs from "fs";
@@ -261,7 +262,7 @@ export default class FileSystem extends StorageBase {
}
) {
this.assertSafePath(dir);
const archive = archiver(opt?.format || "zip", {});
const archive = opt?.format === "tar" ? archiver("tar", {}) : boundedZip();
let active: Readable | undefined;
let stopped = false;
archive.once("close", () => { stopped = true; active?.destroy(); });