mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-18 01:54:23 +01:00
fix: bound ZIP directory memory for slow downloads
This commit is contained in:
1 parent
4263a87399
commit
ac28c64c6c
8 files changed
+263
-7
No files matched your search
@@ -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(); });
|
||||
|
||||
Reference in new issue
Block a user