@zip.js/zip.js 2.5.25 → 2.6.1

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) {
@@ -6458,11 +6448,10 @@
6458
6448
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6459
6449
  */
6460
6450
 
6461
- /* global Blob, atob, btoa, XMLHttpRequest, URL, fetch, ReadableStream, WritableStream */
6451
+ /* global Blob, atob, btoa, XMLHttpRequest, URL, fetch, ReadableStream, WritableStream, FileReader */
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";
@@ -6568,7 +6557,16 @@
6568
6557
 
6569
6558
  getData() {
6570
6559
  const writer = this;
6571
- return writer.blob.text();
6560
+ if (writer.blob.text && (writer.encoding === undefined || (writer.encoding && writer.encoding.toLowerCase() == "utf-8"))) {
6561
+ return writer.blob.text();
6562
+ } else {
6563
+ const reader = new FileReader();
6564
+ return new Promise((resolve, reject) => {
6565
+ reader.onload = event => resolve(event.target.result);
6566
+ reader.onerror = () => reject(reader.error);
6567
+ reader.readAsText(writer.blob, writer.encoding);
6568
+ });
6569
+ }
6572
6570
  }
6573
6571
  }
6574
6572
 
@@ -6688,32 +6686,6 @@
6688
6686
  blobWriter.arrayBuffers = [];
6689
6687
  }
6690
6688
 
6691
- class ReadableStreamReader extends Stream {
6692
-
6693
- constructor(readable) {
6694
- super();
6695
- if (!readable) {
6696
- this.readable = new ReadableStream({});
6697
- }
6698
- }
6699
- }
6700
-
6701
- class WritableStreamWriter extends Writer {
6702
-
6703
- constructor(writable, { preventClose } = {}) {
6704
- super();
6705
- this.preventClose = preventClose;
6706
- if (!writable) {
6707
- writable = new WritableStream({});
6708
- }
6709
- Object.defineProperty(this, "writable", {
6710
- get() {
6711
- return writable;
6712
- }
6713
- });
6714
- }
6715
- }
6716
-
6717
6689
  class FetchReader extends Reader {
6718
6690
 
6719
6691
  constructor(url, options) {
@@ -8500,7 +8472,6 @@
8500
8472
  exports.BlobWriter = BlobWriter;
8501
8473
  exports.Data64URIReader = Data64URIReader;
8502
8474
  exports.Data64URIWriter = Data64URIWriter;
8503
- exports.ERR_ABORT = ERR_ABORT;
8504
8475
  exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
8505
8476
  exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
8506
8477
  exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
@@ -8520,19 +8491,16 @@
8520
8491
  exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
8521
8492
  exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
8522
8493
  exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
8523
- exports.ERR_NOT_SEEKABLE_READER = ERR_NOT_SEEKABLE_READER;
8524
8494
  exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
8525
8495
  exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
8526
8496
  exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
8527
8497
  exports.HttpRangeReader = HttpRangeReader;
8528
8498
  exports.HttpReader = HttpReader;
8529
- exports.ReadableStreamReader = ReadableStreamReader;
8530
8499
  exports.Reader = Reader;
8531
8500
  exports.TextReader = TextReader;
8532
8501
  exports.TextWriter = TextWriter;
8533
8502
  exports.Uint8ArrayReader = Uint8ArrayReader;
8534
8503
  exports.Uint8ArrayWriter = Uint8ArrayWriter;
8535
- exports.WritableStreamWriter = WritableStreamWriter;
8536
8504
  exports.Writer = Writer;
8537
8505
  exports.ZipReader = ZipReader;
8538
8506
  exports.ZipWriter = ZipWriter;