@zip.js/zip.js 2.5.26 → 2.6.2

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.
package/dist/zip-full.js CHANGED
@@ -6095,7 +6095,6 @@
6095
6095
  const MESSAGE_PULL = "pull";
6096
6096
  const MESSAGE_DATA = "data";
6097
6097
  const MESSAGE_CLOSE = "close";
6098
- const ERR_ABORT = "AbortError";
6099
6098
 
6100
6099
  class Codec {
6101
6100
 
@@ -6363,7 +6362,7 @@
6363
6362
  let indexWorker = 0;
6364
6363
 
6365
6364
  async function runWorker(stream, workerOptions) {
6366
- const { options, config, streamOptions } = workerOptions;
6365
+ const { options, config } = workerOptions;
6367
6366
  const streamCopy = !options.compressed && !options.signed && !options.encrypted;
6368
6367
  const { useWebWorkers, useCompressionStream, codecType } = options;
6369
6368
  const { workerScripts } = config;
@@ -6385,16 +6384,7 @@
6385
6384
  worker = await new Promise(resolve => pendingRequests.push({ resolve, stream, workerOptions }));
6386
6385
  }
6387
6386
  }
6388
- try {
6389
- return await worker.run();
6390
- } catch (error) {
6391
- const { signal } = streamOptions;
6392
- if (signal && signal.aborted && (signal.reason == error || error.name == ERR_ABORT)) {
6393
- throw new Error(ERR_ABORT);
6394
- } else {
6395
- throw error;
6396
- }
6397
- }
6387
+ return worker.run();
6398
6388
 
6399
6389
  function onTaskFinished(workerData) {
6400
6390
  if (pendingRequests.length) {
@@ -6462,7 +6452,6 @@
6462
6452
 
6463
6453
  const ERR_HTTP_STATUS = "HTTP error ";
6464
6454
  const ERR_HTTP_RANGE = "HTTP Range not supported";
6465
- const ERR_NOT_SEEKABLE_READER = "Reader is not seekable";
6466
6455
 
6467
6456
  const CONTENT_TYPE_TEXT_PLAIN = "text/plain";
6468
6457
  const HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
@@ -6697,32 +6686,6 @@
6697
6686
  blobWriter.arrayBuffers = [];
6698
6687
  }
6699
6688
 
6700
- class ReadableStreamReader extends Stream {
6701
-
6702
- constructor(readable) {
6703
- super();
6704
- if (!readable) {
6705
- this.readable = new ReadableStream({});
6706
- }
6707
- }
6708
- }
6709
-
6710
- class WritableStreamWriter extends Writer {
6711
-
6712
- constructor(writable, { preventClose } = {}) {
6713
- super();
6714
- this.preventClose = preventClose;
6715
- if (!writable) {
6716
- writable = new WritableStream({});
6717
- }
6718
- Object.defineProperty(this, "writable", {
6719
- get() {
6720
- return writable;
6721
- }
6722
- });
6723
- }
6724
- }
6725
-
6726
6689
  class FetchReader extends Reader {
6727
6690
 
6728
6691
  constructor(url, options) {
@@ -7218,14 +7181,19 @@
7218
7181
 
7219
7182
  async* getEntriesGenerator(options = {}) {
7220
7183
  const zipReader = this;
7221
- const { reader, config } = zipReader;
7222
- if (!reader.initialized) {
7184
+ let { reader } = zipReader;
7185
+ const { config } = zipReader;
7186
+ if (!reader.initialized && reader.init) {
7223
7187
  await reader.init();
7224
7188
  }
7225
- reader.chunkSize = getChunkSize(config);
7189
+ if (reader.size === undefined || !reader.readUint8Array) {
7190
+ const blob = await new Response(reader.readable).blob();
7191
+ reader = new BlobReader(blob);
7192
+ }
7226
7193
  if (reader.size < END_OF_CENTRAL_DIR_LENGTH) {
7227
7194
  throw new Error(ERR_BAD_FORMAT);
7228
7195
  }
7196
+ reader.chunkSize = getChunkSize(config);
7229
7197
  const endOfDirectoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, reader.size, END_OF_CENTRAL_DIR_LENGTH, MAX_16_BITS * 16);
7230
7198
  if (!endOfDirectoryInfo) {
7231
7199
  throw new Error(ERR_EOCDR_NOT_FOUND);
@@ -8509,7 +8477,6 @@
8509
8477
  exports.BlobWriter = BlobWriter;
8510
8478
  exports.Data64URIReader = Data64URIReader;
8511
8479
  exports.Data64URIWriter = Data64URIWriter;
8512
- exports.ERR_ABORT = ERR_ABORT;
8513
8480
  exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
8514
8481
  exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
8515
8482
  exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
@@ -8529,19 +8496,16 @@
8529
8496
  exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
8530
8497
  exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
8531
8498
  exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
8532
- exports.ERR_NOT_SEEKABLE_READER = ERR_NOT_SEEKABLE_READER;
8533
8499
  exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
8534
8500
  exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
8535
8501
  exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
8536
8502
  exports.HttpRangeReader = HttpRangeReader;
8537
8503
  exports.HttpReader = HttpReader;
8538
- exports.ReadableStreamReader = ReadableStreamReader;
8539
8504
  exports.Reader = Reader;
8540
8505
  exports.TextReader = TextReader;
8541
8506
  exports.TextWriter = TextWriter;
8542
8507
  exports.Uint8ArrayReader = Uint8ArrayReader;
8543
8508
  exports.Uint8ArrayWriter = Uint8ArrayWriter;
8544
- exports.WritableStreamWriter = WritableStreamWriter;
8545
8509
  exports.Writer = Writer;
8546
8510
  exports.ZipReader = ZipReader;
8547
8511
  exports.ZipWriter = ZipWriter;