Skip to content

Commit

Permalink
Fix last file in streaming unzip never having final set
Browse files Browse the repository at this point in the history
  • Loading branch information
101arrowz committed Mar 1, 2021
1 parent 147d474 commit 774b668
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fflate",
"version": "0.6.6",
"version": "0.6.7",
"description": "High performance (de)compression in an 8kB package",
"main": "./lib/index.cjs",
"module": "./esm/browser.js",
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3039,6 +3039,7 @@ export class Unzip {
else if (dd) sc = -1;
i += es;
this.c = sc;
let d: UnzipDecoder;
const file = {
name: fn,
compression: cmp,
Expand All @@ -3048,15 +3049,15 @@ export class Unzip {
else {
const ctr = this.o[cmp];
if (!ctr) throw 'unknown compression type ' + cmp;
const d = sc < 0 ? new ctr(fn) : new ctr(fn, sc, su);
d = sc < 0 ? new ctr(fn) : new ctr(fn, sc, su);
d.ondata = (err, dat, final) => { file.ondata(err, dat, final); }
for (const dat of chks) d.push(dat, false);
if (this.k[0] == chks) this.d = d;
if (this.k[0] == chks && this.c) this.d = d;
else d.push(et, true);
}
},
terminate: () => {
if (this.k[0] == chks && this.d.terminate) this.d.terminate();
if (d && d.terminate) d.terminate();
}
} as UnzipFile;
if (sc >= 0) file.size = sc, file.originalSize = su;
Expand Down

0 comments on commit 774b668

Please sign in to comment.