@zip.js/zip.js 2.8.2 → 2.8.4

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.
Files changed (62) hide show
  1. package/README.md +2 -2
  2. package/deno.json +1 -1
  3. package/dist/README.md +5 -1
  4. package/dist/zip-core.js +2322 -2604
  5. package/dist/zip-core.min.js +1 -1
  6. package/dist/zip-fs-core.js +29 -535
  7. package/dist/zip-fs-core.min.js +1 -1
  8. package/dist/zip-fs-native.js +8251 -0
  9. package/dist/zip-fs-native.min.js +1 -0
  10. package/dist/zip-fs.js +2822 -2788
  11. package/dist/zip-fs.min.js +1 -1
  12. package/dist/zip-legacy.js +5712 -0
  13. package/dist/zip-legacy.min.js +1 -0
  14. package/dist/zip-native.js +5750 -0
  15. package/dist/zip-native.min.js +1 -0
  16. package/dist/zip-web-worker-native.js +1 -0
  17. package/dist/zip-web-worker.js +1 -1
  18. package/dist/zip.js +2819 -2782
  19. package/dist/zip.min.js +1 -1
  20. package/index-native.cjs +8243 -0
  21. package/index-native.js +31 -0
  22. package/index-native.min.js +1 -0
  23. package/index.cjs +2822 -2788
  24. package/index.d.ts +2 -2
  25. package/index.js +1 -1
  26. package/index.min.js +1 -1
  27. package/lib/core/codec-pool.js +1 -4
  28. package/lib/core/codec-worker.js +17 -21
  29. package/lib/core/configuration.js +2 -3
  30. package/lib/core/io.js +2 -1
  31. package/lib/core/streams/aes-crypto-stream.js +2 -4
  32. package/lib/core/streams/zlib-js/README.md +1 -0
  33. package/lib/core/streams/zlib-js/zlib-streams.min.js +1 -0
  34. package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams-loader.js +1 -2
  35. package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams.js +4 -0
  36. package/lib/core/{web-worker.js → web-worker-base.js} +7 -12
  37. package/lib/core/web-worker-inline-native.js +1 -0
  38. package/lib/core/web-worker-inline-wasm.js +1 -0
  39. package/lib/core/web-worker-native.js +40 -0
  40. package/lib/core/web-worker-wasm.js +47 -0
  41. package/lib/core/zip-fs.js +3 -6
  42. package/lib/core/zip-reader.js +5 -10
  43. package/lib/core/zip-writer.js +3 -6
  44. package/lib/zip-core-base.js +61 -0
  45. package/lib/zip-core-native.js +30 -0
  46. package/lib/zip-core-reader.js +46 -0
  47. package/lib/zip-core-wasm.js +30 -0
  48. package/lib/zip-core-writer.js +43 -0
  49. package/lib/zip-core.js +2 -79
  50. package/lib/zip-fs-core-native.js +30 -0
  51. package/lib/{zip-fs-core.js → zip-fs-core-wasm.js} +1 -1
  52. package/lib/{zip-fs.js → zip-fs-native.js} +2 -4
  53. package/lib/zip-fs-wasm.js +35 -0
  54. package/lib/{zip.js → zip-legacy.js} +3 -4
  55. package/lib/zip-module-native.js +39 -0
  56. package/lib/zip-module-wasm.js +64 -0
  57. package/lib/zip-native.js +35 -0
  58. package/lib/zip-wasm.js +35 -0
  59. package/package.json +67 -11
  60. package/lib/core/web-worker-inline.js +0 -1
  61. /package/lib/core/streams/{zlib → zlib-wasm}/README.md +0 -0
  62. /package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams.wasm +0 -0
@@ -6,7 +6,6 @@
6
6
 
7
7
  const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker } = typeof globalThis !== 'undefined' ? globalThis : this || self;
8
8
 
9
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
9
  /*
11
10
  Copyright (c) 2022 Gildas Lormeau. All rights reserved.
12
11
 
@@ -133,12 +132,11 @@
133
132
  if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
134
133
  maxWorkers = navigator.hardwareConcurrency;
135
134
  }
136
- // eslint-disable-next-line no-unused-vars
137
- } catch (_) {
135
+ } catch {
138
136
  // ignored
139
137
  }
140
138
  const DEFAULT_CONFIGURATION = {
141
- workerURI: "./core/web-worker.js",
139
+ workerURI: "./core/web-worker-wasm.js",
142
140
  wasmURI: "./core/streams/zlib/zlib-streams.wasm",
143
141
  chunkSize: 64 * 1024,
144
142
  maxWorkers,
@@ -159,297 +157,6 @@
159
157
  return Math.max(config.chunkSize, MINIMUM_CHUNK_SIZE);
160
158
  }
161
159
 
162
- function configure(configuration) {
163
- const {
164
- baseURI,
165
- chunkSize,
166
- maxWorkers,
167
- terminateWorkerTimeout,
168
- useCompressionStream,
169
- useWebWorkers,
170
- CompressionStream,
171
- DecompressionStream,
172
- CompressionStreamZlib,
173
- DecompressionStreamZlib,
174
- workerURI,
175
- wasmURI
176
- } = configuration;
177
- setIfDefined("baseURI", baseURI);
178
- setIfDefined("wasmURI", wasmURI);
179
- setIfDefined("workerURI", workerURI);
180
- setIfDefined("chunkSize", chunkSize);
181
- setIfDefined("maxWorkers", maxWorkers);
182
- setIfDefined("terminateWorkerTimeout", terminateWorkerTimeout);
183
- setIfDefined("useCompressionStream", useCompressionStream);
184
- setIfDefined("useWebWorkers", useWebWorkers);
185
- setIfDefined("CompressionStream", CompressionStream);
186
- setIfDefined("DecompressionStream", DecompressionStream);
187
- setIfDefined("CompressionStreamZlib", CompressionStreamZlib);
188
- setIfDefined("DecompressionStreamZlib", DecompressionStreamZlib);
189
- }
190
-
191
- function setIfDefined(propertyName, propertyValue) {
192
- if (propertyValue !== UNDEFINED_VALUE) {
193
- config[propertyName] = propertyValue;
194
- }
195
- }
196
-
197
- /*
198
- Copyright (c) 2025 Gildas Lormeau. All rights reserved.
199
-
200
- Redistribution and use in source and binary forms, with or without
201
- modification, are permitted provided that the following conditions are met:
202
-
203
- 1. Redistributions of source code must retain the above copyright notice,
204
- this list of conditions and the following disclaimer.
205
-
206
- 2. Redistributions in binary form must reproduce the above copyright
207
- notice, this list of conditions and the following disclaimer in
208
- the documentation and/or other materials provided with the distribution.
209
-
210
- 3. The names of the authors may not be used to endorse or promote products
211
- derived from this software without specific prior written permission.
212
-
213
- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
214
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
215
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
216
- INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
217
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
218
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
219
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
220
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
221
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
222
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223
- */
224
-
225
- /* global TransformStream */
226
-
227
- let wasm, malloc, free, memory;
228
-
229
- function setWasmExports(wasmAPI) {
230
- wasm = wasmAPI;
231
- ({ malloc, free, memory } = wasm);
232
- }
233
-
234
- function _make(isCompress, type, options = {}) {
235
- const level = (typeof options.level === "number") ? options.level : -1;
236
- const outBufferSize = (typeof options.outBuffer === "number") ? options.outBuffer : 64 * 1024;
237
- const inBufferSize = (typeof options.inBufferSize === "number") ? options.inBufferSize : 64 * 1024;
238
-
239
- return new TransformStream({
240
- start() {
241
- let result;
242
- this.out = malloc(outBufferSize);
243
- this.in = malloc(inBufferSize);
244
- this.inBufferSize = inBufferSize;
245
- this._scratch = new Uint8Array(outBufferSize);
246
- if (isCompress) {
247
- this._process = wasm.deflate_process;
248
- this._last_consumed = wasm.deflate_last_consumed;
249
- this._end = wasm.deflate_end;
250
- this.streamHandle = wasm.deflate_new();
251
- if (type === "gzip") {
252
- result = wasm.deflate_init_gzip(this.streamHandle, level);
253
- } else if (type === "deflate-raw") {
254
- result = wasm.deflate_init_raw(this.streamHandle, level);
255
- } else {
256
- result = wasm.deflate_init(this.streamHandle, level);
257
- }
258
- } else {
259
- if (type === "deflate64-raw") {
260
- this._process = wasm.inflate9_process;
261
- this._last_consumed = wasm.inflate9_last_consumed;
262
- this._end = wasm.inflate9_end;
263
- this.streamHandle = wasm.inflate9_new();
264
- result = wasm.inflate9_init_raw(this.streamHandle);
265
- } else {
266
- this._process = wasm.inflate_process;
267
- this._last_consumed = wasm.inflate_last_consumed;
268
- this._end = wasm.inflate_end;
269
- this.streamHandle = wasm.inflate_new();
270
- if (type === "deflate-raw") {
271
- result = wasm.inflate_init_raw(this.streamHandle);
272
- } else if (type === "gzip") {
273
- result = wasm.inflate_init_gzip(this.streamHandle);
274
- } else {
275
- result = wasm.inflate_init(this.streamHandle);
276
- }
277
- }
278
- }
279
- if (result !== 0) {
280
- throw new Error("init failed:" + result);
281
- }
282
- },
283
- transform(chunk, controller) {
284
- try {
285
- const buffer = chunk;
286
- const heap = new Uint8Array(memory.buffer);
287
- const process = this._process;
288
- const last_consumed = this._last_consumed;
289
- const out = this.out;
290
- const scratch = this._scratch;
291
- let offset = 0;
292
- while (offset < buffer.length) {
293
- const toRead = Math.min(buffer.length - offset, 32 * 1024);
294
- if (!this.in || this.inBufferSize < toRead) {
295
- if (this.in && free) {
296
- free(this.in);
297
- }
298
- this.in = malloc(toRead);
299
- this.inBufferSize = toRead;
300
- }
301
- heap.set(buffer.subarray(offset, offset + toRead), this.in);
302
- const result = process(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
303
- if (!isCompress && result < 0) {
304
- throw new Error("process error:" + result);
305
- }
306
- const prod = result & 0x00ffffff;
307
- if (prod) {
308
- scratch.set(heap.subarray(out, out + prod), 0);
309
- controller.enqueue(scratch.slice(0, prod));
310
- }
311
- const consumed = last_consumed(this.streamHandle);
312
- if (consumed === 0) {
313
- break;
314
- }
315
- offset += consumed;
316
- }
317
- } catch (error) {
318
- if (this._end && this.streamHandle) {
319
- this._end(this.streamHandle);
320
- }
321
- if (this.in && free) {
322
- free(this.in);
323
- }
324
- if (this.out && free) {
325
- free(this.out);
326
- }
327
- controller.error(error);
328
- }
329
- },
330
- flush(controller) {
331
- try {
332
- const heap = new Uint8Array(memory.buffer);
333
- const process = this._process;
334
- const out = this.out;
335
- const scratch = this._scratch;
336
- while (true) {
337
- const result = process(this.streamHandle, 0, 0, out, outBufferSize, 4);
338
- if (!isCompress && result < 0) {
339
- throw new Error("process error:" + result);
340
- }
341
- const produced = result & 0x00ffffff;
342
- const code = (result >> 24) & 0xff;
343
- if (produced) {
344
- scratch.set(heap.subarray(out, out + produced), 0);
345
- controller.enqueue(scratch.slice(0, produced));
346
- }
347
- if (code === 1 || produced === 0) {
348
- break;
349
- }
350
- }
351
- } catch (error) {
352
- controller.error(error);
353
- } finally {
354
- if (this._end && this.streamHandle) {
355
- const result = this._end(this.streamHandle);
356
- if (result !== 0) {
357
- controller.error(new Error("end error:" + result));
358
- }
359
- }
360
- if (this.in && free) {
361
- free(this.in);
362
- }
363
- if (this.out && free) {
364
- free(this.out);
365
- }
366
- }
367
- }
368
- });
369
- }
370
-
371
- class CompressionStreamZlib {
372
- constructor(type = "deflate", options) {
373
- return _make(true, type, options);
374
- }
375
- }
376
- class DecompressionStreamZlib {
377
- constructor(type = "deflate", options) {
378
- return _make(false, type, options);
379
- }
380
- }
381
-
382
- /*
383
- Copyright (c) 2025 Gildas Lormeau. All rights reserved.
384
-
385
- Redistribution and use in source and binary forms, with or without
386
- modification, are permitted provided that the following conditions are met:
387
-
388
- 1. Redistributions of source code must retain the above copyright notice,
389
- this list of conditions and the following disclaimer.
390
-
391
- 2. Redistributions in binary form must reproduce the above copyright
392
- notice, this list of conditions and the following disclaimer in
393
- the documentation and/or other materials provided with the distribution.
394
-
395
- 3. The names of the authors may not be used to endorse or promote products
396
- derived from this software without specific prior written permission.
397
-
398
- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
399
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
400
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
401
- INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
402
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
403
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
404
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
405
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
406
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
407
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
408
- */
409
-
410
-
411
- let initializedModule = false;
412
-
413
- async function initModule(wasmURI, { baseURI }) {
414
- if (!initializedModule) {
415
- let arrayBuffer, uri;
416
- try {
417
- try {
418
- uri = new URL(wasmURI, baseURI);
419
- // eslint-disable-next-line no-unused-vars
420
- } catch (_) {
421
- // ignored
422
- }
423
- const response = await fetch(uri);
424
- arrayBuffer = await response.arrayBuffer();
425
- } catch (error) {
426
- if (wasmURI.startsWith("data:application/wasm;base64,")) {
427
- arrayBuffer = arrayBufferFromDataURI(wasmURI);
428
- } else {
429
- throw error;
430
- }
431
- }
432
- const wasmInstance = await WebAssembly.instantiate(arrayBuffer);
433
- setWasmExports(wasmInstance.instance.exports);
434
- initializedModule = true;
435
- }
436
- }
437
-
438
- function resetWasmModule() {
439
- initializedModule = false;
440
- }
441
-
442
- function arrayBufferFromDataURI(dataURI) {
443
- const base64 = dataURI.split(",")[1];
444
- const binary = atob(base64);
445
- const len = binary.length;
446
- const bytes = new Uint8Array(len);
447
- for (let i = 0; i < len; ++i) {
448
- bytes[i] = binary.charCodeAt(i);
449
- }
450
- return bytes.buffer;
451
- }
452
-
453
160
  /*
454
161
  Copyright (c) 2025 Gildas Lormeau. All rights reserved.
455
162
 
@@ -783,7 +490,8 @@
783
490
  } = httpReader;
784
491
  if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRequest)) {
785
492
  const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -END_OF_CENTRAL_DIR_LENGTH : undefined));
786
- if (!forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {
493
+ const acceptRanges = response.headers.get(HTTP_HEADER_ACCEPT_RANGES);
494
+ if (!forceRangeRequests && (!acceptRanges || acceptRanges.toLowerCase() != HTTP_RANGE_UNIT)) {
787
495
  throw new Error(ERR_HTTP_RANGE);
788
496
  } else {
789
497
  if (combineSizeEocd) {
@@ -958,14 +666,6 @@
958
666
  }
959
667
  }
960
668
 
961
- class HttpRangeReader extends HttpReader {
962
-
963
- constructor(url, options = {}) {
964
- options.useRangeHeader = true;
965
- super(url, options);
966
- }
967
- }
968
-
969
669
 
970
670
  class Uint8ArrayReader extends Reader {
971
671
 
@@ -2459,8 +2159,7 @@
2459
2159
  if (IMPORT_KEY_SUPPORTED) {
2460
2160
  try {
2461
2161
  return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
2462
- // eslint-disable-next-line no-unused-vars
2463
- } catch (_) {
2162
+ } catch {
2464
2163
  IMPORT_KEY_SUPPORTED = false;
2465
2164
  return misc.importKey(password);
2466
2165
  }
@@ -2473,8 +2172,7 @@
2473
2172
  if (DERIVE_BITS_SUPPORTED) {
2474
2173
  try {
2475
2174
  return await subtle.deriveBits(algorithm, baseKey, length);
2476
- // eslint-disable-next-line no-unused-vars
2477
- } catch (_) {
2175
+ } catch {
2478
2176
  DERIVE_BITS_SUPPORTED = false;
2479
2177
  return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
2480
2178
  }
@@ -2960,6 +2658,7 @@
2960
2658
 
2961
2659
  // deno-lint-ignore valid-typeof
2962
2660
  let WEB_WORKERS_SUPPORTED = typeof Worker != UNDEFINED_TYPE;
2661
+ let initModule = () => { };
2963
2662
 
2964
2663
  class CodecWorker {
2965
2664
 
@@ -3035,8 +2734,7 @@
3035
2734
  async function callHandler(handler, ...parameters) {
3036
2735
  try {
3037
2736
  await handler(...parameters);
3038
- // eslint-disable-next-line no-unused-vars
3039
- } catch (_) {
2737
+ } catch {
3040
2738
  // ignored
3041
2739
  }
3042
2740
  }
@@ -3059,8 +2757,7 @@
3059
2757
  let worker;
3060
2758
  try {
3061
2759
  worker = getWebWorker(workerData.workerURI, baseURI, workerData);
3062
- // eslint-disable-next-line no-unused-vars
3063
- } catch (_) {
2760
+ } catch {
3064
2761
  WEB_WORKERS_SUPPORTED = false;
3065
2762
  return createWorkerInterface(workerData, config);
3066
2763
  }
@@ -3077,13 +2774,12 @@
3077
2774
  async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
3078
2775
  let codecStream;
3079
2776
  try {
3080
- if (!options.useCompressionStream && !initializedModule) {
3081
- let { wasmURI } = config;
3082
- // deno-lint-ignore valid-typeof
3083
- if (typeof wasmURI == FUNCTION_TYPE) {
3084
- wasmURI = wasmURI();
2777
+ if (!options.useCompressionStream) {
2778
+ try {
2779
+ await initModule(config);
2780
+ } catch {
2781
+ options.useCompressionStream = true;
3085
2782
  }
3086
- await initModule(wasmURI, config);
3087
2783
  }
3088
2784
  codecStream = new CodecStream(options, config);
3089
2785
  await readable.pipeThrough(codecStream).pipeTo(writable, { preventClose: true, preventAbort: true });
@@ -3176,15 +2872,13 @@
3176
2872
  if (url.startsWith("data:") || url.startsWith("blob:")) {
3177
2873
  try {
3178
2874
  worker = new Worker(url);
3179
- // eslint-disable-next-line no-unused-vars
3180
- } catch (_) {
2875
+ } catch {
3181
2876
  worker = new Worker(url, workerOptions);
3182
2877
  }
3183
2878
  } else {
3184
2879
  try {
3185
2880
  scriptUrl = new URL(url, baseURI);
3186
- // eslint-disable-next-line no-unused-vars
3187
- } catch (_) {
2881
+ } catch {
3188
2882
  scriptUrl = url;
3189
2883
  }
3190
2884
  worker = new Worker(scriptUrl, workerOptions);
@@ -3220,8 +2914,7 @@
3220
2914
  try {
3221
2915
  worker.postMessage(message, transferables);
3222
2916
  return true;
3223
- // eslint-disable-next-line no-unused-vars
3224
- } catch (_) {
2917
+ } catch {
3225
2918
  transferStreamsSupported = false;
3226
2919
  message.readable = message.writable = null;
3227
2920
  worker.postMessage(message);
@@ -3364,8 +3057,7 @@
3364
3057
  pool = pool.filter(data => data != workerData);
3365
3058
  try {
3366
3059
  await workerData.terminate();
3367
- // eslint-disable-next-line no-unused-vars
3368
- } catch (_) {
3060
+ } catch {
3369
3061
  // ignored
3370
3062
  }
3371
3063
  }, terminateWorkerTimeout);
@@ -3381,14 +3073,6 @@
3381
3073
  }
3382
3074
  }
3383
3075
 
3384
- async function terminateWorkers() {
3385
- await Promise.allSettled(pool.map(workerData => {
3386
- clearTerminateTimeout(workerData);
3387
- return workerData.terminate();
3388
- }));
3389
- resetWasmModule();
3390
- }
3391
-
3392
3076
  /*
3393
3077
  Copyright (c) 2022 Gildas Lormeau. All rights reserved.
3394
3078
 
@@ -3859,8 +3543,7 @@
3859
3543
  if (onprogress) {
3860
3544
  try {
3861
3545
  await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
3862
- // eslint-disable-next-line no-unused-vars
3863
- } catch (_) {
3546
+ } catch {
3864
3547
  // ignored
3865
3548
  }
3866
3549
  }
@@ -3890,34 +3573,6 @@
3890
3573
  }
3891
3574
  }
3892
3575
 
3893
- class ZipReaderStream {
3894
-
3895
- constructor(options = {}) {
3896
- const { readable, writable } = new TransformStream();
3897
- const gen = new ZipReader(readable, options).getEntriesGenerator();
3898
- this.readable = new ReadableStream({
3899
- async pull(controller) {
3900
- const { done, value } = await gen.next();
3901
- if (done)
3902
- return controller.close();
3903
- const chunk = {
3904
- ...value,
3905
- readable: (function () {
3906
- const { readable, writable } = new TransformStream();
3907
- if (value.getData) {
3908
- value.getData(writable);
3909
- return readable;
3910
- }
3911
- })()
3912
- };
3913
- delete chunk.getData;
3914
- controller.enqueue(chunk);
3915
- }
3916
- });
3917
- this.writable = writable;
3918
- }
3919
- }
3920
-
3921
3576
  let ZipEntry$1 = class ZipEntry {
3922
3577
 
3923
3578
  constructor(reader, config, options) {
@@ -4114,8 +3769,7 @@
4114
3769
  });
4115
3770
  offsetExtraField += 4 + size;
4116
3771
  }
4117
- // eslint-disable-next-line no-unused-vars
4118
- } catch (_) {
3772
+ } catch {
4119
3773
  // ignored
4120
3774
  }
4121
3775
  const compressionMethod = getUint16(dataView, offset + 4);
@@ -4222,8 +3876,7 @@
4222
3876
  }
4223
3877
  offsetExtraField += 4 + attributeSize;
4224
3878
  }
4225
- // eslint-disable-next-line no-unused-vars
4226
- } catch (_) {
3879
+ } catch {
4227
3880
  // ignored
4228
3881
  }
4229
3882
  try {
@@ -4244,8 +3897,7 @@
4244
3897
  Object.assign(extraFieldNTFS, extraFieldData);
4245
3898
  Object.assign(directory, extraFieldData);
4246
3899
  }
4247
- // eslint-disable-next-line no-unused-vars
4248
- } catch (_) {
3900
+ } catch {
4249
3901
  // ignored
4250
3902
  }
4251
3903
  }
@@ -4379,8 +4031,7 @@
4379
4031
  const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
4380
4032
  try {
4381
4033
  return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
4382
- // eslint-disable-next-line no-unused-vars
4383
- } catch (_) {
4034
+ } catch {
4384
4035
  // ignored
4385
4036
  }
4386
4037
  }
@@ -4624,33 +4275,6 @@
4624
4275
  }
4625
4276
  }
4626
4277
 
4627
- class ZipWriterStream {
4628
-
4629
- constructor(options = {}) {
4630
- const { readable, writable } = new TransformStream();
4631
- this.readable = readable;
4632
- this.zipWriter = new ZipWriter(writable, options);
4633
- }
4634
-
4635
- transform(path) {
4636
- const { readable, writable } = new TransformStream({
4637
- flush: () => { this.zipWriter.close(); }
4638
- });
4639
- this.zipWriter.add(path, readable);
4640
- return { readable: this.readable, writable };
4641
- }
4642
-
4643
- writable(path) {
4644
- const { readable, writable } = new TransformStream();
4645
- this.zipWriter.add(path, readable);
4646
- return writable;
4647
- }
4648
-
4649
- close(comment = undefined, options = {}) {
4650
- return this.zipWriter.close(comment, options);
4651
- }
4652
- }
4653
-
4654
4278
  async function addFile(zipWriter, name, reader, options) {
4655
4279
  name = name.trim();
4656
4280
  const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
@@ -4969,8 +4593,7 @@
4969
4593
  if (error) {
4970
4594
  try {
4971
4595
  error.corruptedEntry = true;
4972
- // eslint-disable-next-line no-unused-vars
4973
- } catch (_) {
4596
+ } catch {
4974
4597
  // ignored
4975
4598
  }
4976
4599
  }
@@ -5287,8 +4910,7 @@
5287
4910
  setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
5288
4911
  setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
5289
4912
  setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
5290
- // eslint-disable-next-line no-unused-vars
5291
- } catch (_) {
4913
+ } catch {
5292
4914
  rawExtraFieldNTFS = new Uint8Array();
5293
4915
  }
5294
4916
  } else {
@@ -5645,8 +5267,7 @@
5645
5267
  if (options.onprogress) {
5646
5268
  try {
5647
5269
  await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
5648
- // eslint-disable-next-line no-unused-vars
5649
- } catch (_) {
5270
+ } catch {
5650
5271
  // ignored
5651
5272
  }
5652
5273
  }
@@ -5862,82 +5483,6 @@
5862
5483
  */
5863
5484
 
5864
5485
 
5865
- function getMimeType() {
5866
- return "application/octet-stream";
5867
- }
5868
-
5869
- /*
5870
- Copyright (c) 2025 Gildas Lormeau. All rights reserved.
5871
-
5872
- Redistribution and use in source and binary forms, with or without
5873
- modification, are permitted provided that the following conditions are met:
5874
-
5875
- 1. Redistributions of source code must retain the above copyright notice,
5876
- this list of conditions and the following disclaimer.
5877
-
5878
- 2. Redistributions in binary form must reproduce the above copyright
5879
- notice, this list of conditions and the following disclaimer in
5880
- the documentation and/or other materials provided with the distribution.
5881
-
5882
- 3. The names of the authors may not be used to endorse or promote products
5883
- derived from this software without specific prior written permission.
5884
-
5885
- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
5886
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5887
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
5888
- INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
5889
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5890
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
5891
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
5892
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5893
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
5894
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5895
- */
5896
-
5897
-
5898
- let baseURI;
5899
- try {
5900
- baseURI = (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('zip-fs-core.js', document.baseURI).href));
5901
- // eslint-disable-next-line no-unused-vars
5902
- } catch (_) {
5903
- // ignored
5904
- }
5905
-
5906
- configure({
5907
- baseURI,
5908
- CompressionStreamZlib,
5909
- DecompressionStreamZlib
5910
- });
5911
-
5912
- /*
5913
- Copyright (c) 2022 Gildas Lormeau. All rights reserved.
5914
-
5915
- Redistribution and use in source and binary forms, with or without
5916
- modification, are permitted provided that the following conditions are met:
5917
-
5918
- 1. Redistributions of source code must retain the above copyright notice,
5919
- this list of conditions and the following disclaimer.
5920
-
5921
- 2. Redistributions in binary form must reproduce the above copyright
5922
- notice, this list of conditions and the following disclaimer in
5923
- the documentation and/or other materials provided with the distribution.
5924
-
5925
- 3. The names of the authors may not be used to endorse or promote products
5926
- derived from this software without specific prior written permission.
5927
-
5928
- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
5929
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5930
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
5931
- INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
5932
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5933
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
5934
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
5935
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5936
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
5937
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5938
- */
5939
-
5940
-
5941
5486
  class ZipEntry {
5942
5487
 
5943
5488
  constructor(fs, name, params, parent) {
@@ -6313,8 +5858,7 @@
6313
5858
  error.cause = {
6314
5859
  entry
6315
5860
  };
6316
- // eslint-disable-next-line no-unused-vars
6317
- } catch (_) {
5861
+ } catch {
6318
5862
  // ignored
6319
5863
  }
6320
5864
  throw error;
@@ -6571,8 +6115,7 @@
6571
6115
  error.cause = {
6572
6116
  entry: child
6573
6117
  };
6574
- // eslint-disable-next-line no-unused-vars
6575
- } catch (_) {
6118
+ } catch {
6576
6119
  // ignored
6577
6120
  }
6578
6121
  throw error;
@@ -6666,8 +6209,7 @@
6666
6209
  entryOffsets.set(name, indexProgress);
6667
6210
  try {
6668
6211
  await options.onprogress(Array.from(entryOffsets.values()).reduce((previousValue, currentValue) => previousValue + currentValue), totalSize);
6669
- // eslint-disable-next-line no-unused-vars
6670
- } catch (_) {
6212
+ } catch {
6671
6213
  // ignored
6672
6214
  }
6673
6215
  }
@@ -6780,54 +6322,6 @@
6780
6322
  }
6781
6323
  }
6782
6324
 
6783
- exports.BlobReader = BlobReader;
6784
- exports.BlobWriter = BlobWriter;
6785
- exports.Data64URIReader = Data64URIReader;
6786
- exports.Data64URIWriter = Data64URIWriter;
6787
- exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
6788
- exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
6789
- exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
6790
- exports.ERR_ENCRYPTED = ERR_ENCRYPTED;
6791
- exports.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND;
6792
- exports.ERR_EOCDR_NOT_FOUND = ERR_EOCDR_NOT_FOUND;
6793
- exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
6794
- exports.ERR_HTTP_RANGE = ERR_HTTP_RANGE;
6795
- exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
6796
- exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
6797
- exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
6798
- exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
6799
- exports.ERR_INVALID_EXTRAFIELD_DATA = ERR_INVALID_EXTRAFIELD_DATA;
6800
- exports.ERR_INVALID_EXTRAFIELD_TYPE = ERR_INVALID_EXTRAFIELD_TYPE;
6801
- exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
6802
- exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
6803
- exports.ERR_INVALID_UNCOMPRESSED_SIZE = ERR_INVALID_UNCOMPRESSED_SIZE;
6804
- exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
6805
- exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
6806
- exports.ERR_OVERLAPPING_ENTRY = ERR_OVERLAPPING_ENTRY;
6807
- exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
6808
- exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
6809
- exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
6810
- exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
6811
- exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
6812
- exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
6813
- exports.HttpRangeReader = HttpRangeReader;
6814
- exports.HttpReader = HttpReader;
6815
- exports.Reader = Reader;
6816
- exports.SplitDataReader = SplitDataReader;
6817
- exports.SplitDataWriter = SplitDataWriter;
6818
- exports.TextReader = TextReader;
6819
- exports.TextWriter = TextWriter;
6820
- exports.Uint8ArrayReader = Uint8ArrayReader;
6821
- exports.Uint8ArrayWriter = Uint8ArrayWriter;
6822
- exports.Writer = Writer;
6823
- exports.ZipReader = ZipReader;
6824
- exports.ZipReaderStream = ZipReaderStream;
6825
- exports.ZipWriter = ZipWriter;
6826
- exports.ZipWriterStream = ZipWriterStream;
6827
- exports.configure = configure;
6828
6325
  exports.fs = fs;
6829
- exports.getMimeType = getMimeType;
6830
- exports.resetWasmModule = resetWasmModule;
6831
- exports.terminateWorkers = terminateWorkers;
6832
6326
 
6833
6327
  }));