@zip.js/zip.js 2.8.8 → 2.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,14 +108,18 @@ function _make(isCompress, type, options = {}) {
108
108
  }
109
109
  heap.set(buffer.subarray(offset, offset + toRead), this.in);
110
110
  const result = process(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
111
- if (!isCompress && result < 0) {
112
- throw new Error("process error:" + result);
113
- }
114
111
  const prod = result & 0x00ffffff;
115
112
  if (prod) {
116
113
  scratch.set(heap.subarray(out, out + prod), 0);
117
114
  controller.enqueue(scratch.slice(0, prod));
118
115
  }
116
+ if (!isCompress) {
117
+ const code = (result >> 24) & 0xff;
118
+ const signedCode = (code & 0x80) ? code - 256 : code;
119
+ if (signedCode < 0) {
120
+ throw new Error("process error:" + signedCode);
121
+ }
122
+ }
119
123
  const consumed = last_consumed(this.streamHandle);
120
124
  if (consumed === 0) {
121
125
  break;
@@ -143,11 +147,14 @@ function _make(isCompress, type, options = {}) {
143
147
  const scratch = this._scratch;
144
148
  while (true) {
145
149
  const result = process(this.streamHandle, 0, 0, out, outBufferSize, 4);
146
- if (!isCompress && result < 0) {
147
- throw new Error("process error:" + result);
148
- }
149
150
  const produced = result & 0x00ffffff;
150
151
  const code = (result >> 24) & 0xff;
152
+ if (!isCompress) {
153
+ const signedCode = (code & 0x80) ? code - 256 : code;
154
+ if (signedCode < 0) {
155
+ throw new Error("process error:" + signedCode);
156
+ }
157
+ }
151
158
  if (produced) {
152
159
  scratch.set(heap.subarray(out, out + produced), 0);
153
160
  controller.enqueue(scratch.slice(0, produced));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.8.8",
6
+ "version": "2.8.9",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",