From 4aa2cb16a0b1d69a90079d6157bc94e37217bd55 Mon Sep 17 00:00:00 2001 From: Ziggy Jonsson Date: Tue, 3 Sep 2019 15:01:42 -0400 Subject: [PATCH 1/2] Fix: cases where file size is known (i.e. compressedSize > 0) but the fileSizeKnown flag is false --- lib/Open/unzip.js | 2 +- lib/parse.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Open/unzip.js b/lib/Open/unzip.js index 0136fb1..8739205 100644 --- a/lib/Open/unzip.js +++ b/lib/Open/unzip.js @@ -83,7 +83,7 @@ module.exports = function unzip(source,offset,_password, directoryVars) { }); entry.vars.then(function(vars) { - var fileSizeKnown = !(vars.flags & 0x08), + var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0, eof; var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough(); diff --git a/lib/parse.js b/lib/parse.js index e2d675b..f050822 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -164,7 +164,7 @@ Parse.prototype._readFile = function () { extra: extra }); - var fileSizeKnown = !(vars.flags & 0x08), + var fileSizeKnown = !(vars.flags & 0x08) || vars.compressedSize > 0, eof; entry.__autodraining = __autodraining; // expose __autodraining for test purposes From b6ebcd72e9b32fe9963a8dabae6010b315b67db8 Mon Sep 17 00:00:00 2001 From: Ziggy Jonsson Date: Tue, 3 Sep 2019 14:51:20 -0400 Subject: [PATCH 2/2] Only set the concurrency config if opts.concurrency is more than 1 --- lib/Open/directory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Open/directory.js b/lib/Open/directory.js index ddbe097..afb26fa 100644 --- a/lib/Open/directory.js +++ b/lib/Open/directory.js @@ -162,7 +162,7 @@ module.exports = function centralDirectory(source, options) { .on('close',resolve) .on('error',reject); }); - },{concurrency: opts.concurrency || 1}); + }, opts.concurrency > 1 ? {concurrency: opts.concurrency || undefined} : undefined); }); };