@zip.js/zip.js 2.6.67 → 2.6.69

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.
@@ -7849,8 +7849,8 @@
7849
7849
  }
7850
7850
 
7851
7851
  async init() {
7852
- super.init();
7853
7852
  await initHttpReader(this, sendFetchRequest, getFetchRequestData);
7853
+ super.init();
7854
7854
  }
7855
7855
 
7856
7856
  readUint8Array(index, length) {
@@ -7866,8 +7866,8 @@
7866
7866
  }
7867
7867
 
7868
7868
  async init() {
7869
- super.init();
7870
7869
  await initHttpReader(this, sendXMLHttpRequest, getXMLHttpRequestData);
7870
+ super.init();
7871
7871
  }
7872
7872
 
7873
7873
  readUint8Array(index, length) {
@@ -8054,8 +8054,8 @@
8054
8054
  }
8055
8055
 
8056
8056
  async init() {
8057
- super.init();
8058
8057
  await this.reader.init();
8058
+ super.init();
8059
8059
  }
8060
8060
 
8061
8061
  readUint8Array(index, length) {
@@ -8090,11 +8090,11 @@
8090
8090
  class Uint8ArrayWriter extends Writer {
8091
8091
 
8092
8092
  init(initSize = 0) {
8093
- super.init();
8094
8093
  Object.assign(this, {
8095
8094
  offset: 0,
8096
8095
  array: new Uint8Array(initSize)
8097
8096
  });
8097
+ super.init();
8098
8098
  }
8099
8099
 
8100
8100
  writeUint8Array(array) {
@@ -8121,7 +8121,6 @@
8121
8121
  }
8122
8122
 
8123
8123
  async init() {
8124
- super.init();
8125
8124
  const reader = this;
8126
8125
  const { readers } = reader;
8127
8126
  reader.lastDiskNumber = 0;
@@ -8129,6 +8128,7 @@
8129
8128
  await diskReader.init();
8130
8129
  reader.size += diskReader.size;
8131
8130
  }));
8131
+ super.init();
8132
8132
  }
8133
8133
 
8134
8134
  async readUint8Array(offset, length, diskNumber = 0) {
@@ -10162,6 +10162,10 @@
10162
10162
  }
10163
10163
  }
10164
10164
 
10165
+ clone() {
10166
+ return new ZipFileEntry(this.fs, this.name, this);
10167
+ }
10168
+
10165
10169
  async getData(writer, options = {}) {
10166
10170
  const zipEntry = this;
10167
10171
  if (!writer || (writer.constructor == zipEntry.Writer && zipEntry.data)) {
@@ -10249,6 +10253,10 @@
10249
10253
  this.directory = true;
10250
10254
  }
10251
10255
 
10256
+ clone() {
10257
+ return new ZipDirectoryEntry(this.fs, this.name);
10258
+ }
10259
+
10252
10260
  addDirectory(name) {
10253
10261
  return addChild(this, name, null, true);
10254
10262
  }
@@ -10540,12 +10548,12 @@
10540
10548
  }
10541
10549
 
10542
10550
  async init() {
10543
- super.init();
10544
10551
  const zipBlobReader = this;
10545
10552
  zipBlobReader.size = zipBlobReader.entry.uncompressedSize;
10546
10553
  const data = await zipBlobReader.entry.getData(new BlobWriter(), Object.assign({}, zipBlobReader.options, options));
10547
10554
  zipBlobReader.data = data;
10548
10555
  zipBlobReader.blobReader = new BlobReader(data);
10556
+ super.init();
10549
10557
  }
10550
10558
 
10551
10559
  readUint8Array(index, length) {
@@ -10556,7 +10564,7 @@
10556
10564
 
10557
10565
  async function initReaders(entry) {
10558
10566
  if (entry.children.length) {
10559
- for (const child of entry.children) {
10567
+ await Promise.all(entry.children.map(async child => {
10560
10568
  if (child.directory) {
10561
10569
  await initReaders(child);
10562
10570
  } else {
@@ -10564,17 +10572,19 @@
10564
10572
  await initStream(reader);
10565
10573
  child.uncompressedSize = reader.size;
10566
10574
  }
10567
- }
10575
+ }));
10568
10576
  }
10569
10577
  }
10570
10578
 
10571
10579
  function detach(entry) {
10572
- const children = entry.parent.children;
10573
- children.forEach((child, index) => {
10574
- if (child.id == entry.id) {
10575
- children.splice(index, 1);
10576
- }
10577
- });
10580
+ if (entry.parent) {
10581
+ const children = entry.parent.children;
10582
+ children.forEach((child, index) => {
10583
+ if (child.id == entry.id) {
10584
+ children.splice(index, 1);
10585
+ }
10586
+ });
10587
+ }
10578
10588
  }
10579
10589
 
10580
10590
  async function exportZip(zipWriter, entry, totalSize, options) {