@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.
package/dist/zip-fs.js CHANGED
@@ -2625,8 +2625,8 @@
2625
2625
  }
2626
2626
 
2627
2627
  async init() {
2628
- super.init();
2629
2628
  await initHttpReader(this, sendFetchRequest, getFetchRequestData);
2629
+ super.init();
2630
2630
  }
2631
2631
 
2632
2632
  readUint8Array(index, length) {
@@ -2642,8 +2642,8 @@
2642
2642
  }
2643
2643
 
2644
2644
  async init() {
2645
- super.init();
2646
2645
  await initHttpReader(this, sendXMLHttpRequest, getXMLHttpRequestData);
2646
+ super.init();
2647
2647
  }
2648
2648
 
2649
2649
  readUint8Array(index, length) {
@@ -2830,8 +2830,8 @@
2830
2830
  }
2831
2831
 
2832
2832
  async init() {
2833
- super.init();
2834
2833
  await this.reader.init();
2834
+ super.init();
2835
2835
  }
2836
2836
 
2837
2837
  readUint8Array(index, length) {
@@ -2866,11 +2866,11 @@
2866
2866
  class Uint8ArrayWriter extends Writer {
2867
2867
 
2868
2868
  init(initSize = 0) {
2869
- super.init();
2870
2869
  Object.assign(this, {
2871
2870
  offset: 0,
2872
2871
  array: new Uint8Array(initSize)
2873
2872
  });
2873
+ super.init();
2874
2874
  }
2875
2875
 
2876
2876
  writeUint8Array(array) {
@@ -2897,7 +2897,6 @@
2897
2897
  }
2898
2898
 
2899
2899
  async init() {
2900
- super.init();
2901
2900
  const reader = this;
2902
2901
  const { readers } = reader;
2903
2902
  reader.lastDiskNumber = 0;
@@ -2905,6 +2904,7 @@
2905
2904
  await diskReader.init();
2906
2905
  reader.size += diskReader.size;
2907
2906
  }));
2907
+ super.init();
2908
2908
  }
2909
2909
 
2910
2910
  async readUint8Array(offset, length, diskNumber = 0) {
@@ -4938,6 +4938,10 @@
4938
4938
  }
4939
4939
  }
4940
4940
 
4941
+ clone() {
4942
+ return new ZipFileEntry(this.fs, this.name, this);
4943
+ }
4944
+
4941
4945
  async getData(writer, options = {}) {
4942
4946
  const zipEntry = this;
4943
4947
  if (!writer || (writer.constructor == zipEntry.Writer && zipEntry.data)) {
@@ -5025,6 +5029,10 @@
5025
5029
  this.directory = true;
5026
5030
  }
5027
5031
 
5032
+ clone() {
5033
+ return new ZipDirectoryEntry(this.fs, this.name);
5034
+ }
5035
+
5028
5036
  addDirectory(name) {
5029
5037
  return addChild(this, name, null, true);
5030
5038
  }
@@ -5316,12 +5324,12 @@
5316
5324
  }
5317
5325
 
5318
5326
  async init() {
5319
- super.init();
5320
5327
  const zipBlobReader = this;
5321
5328
  zipBlobReader.size = zipBlobReader.entry.uncompressedSize;
5322
5329
  const data = await zipBlobReader.entry.getData(new BlobWriter(), Object.assign({}, zipBlobReader.options, options));
5323
5330
  zipBlobReader.data = data;
5324
5331
  zipBlobReader.blobReader = new BlobReader(data);
5332
+ super.init();
5325
5333
  }
5326
5334
 
5327
5335
  readUint8Array(index, length) {
@@ -5332,7 +5340,7 @@
5332
5340
 
5333
5341
  async function initReaders(entry) {
5334
5342
  if (entry.children.length) {
5335
- for (const child of entry.children) {
5343
+ await Promise.all(entry.children.map(async child => {
5336
5344
  if (child.directory) {
5337
5345
  await initReaders(child);
5338
5346
  } else {
@@ -5340,17 +5348,19 @@
5340
5348
  await initStream(reader);
5341
5349
  child.uncompressedSize = reader.size;
5342
5350
  }
5343
- }
5351
+ }));
5344
5352
  }
5345
5353
  }
5346
5354
 
5347
5355
  function detach(entry) {
5348
- const children = entry.parent.children;
5349
- children.forEach((child, index) => {
5350
- if (child.id == entry.id) {
5351
- children.splice(index, 1);
5352
- }
5353
- });
5356
+ if (entry.parent) {
5357
+ const children = entry.parent.children;
5358
+ children.forEach((child, index) => {
5359
+ if (child.id == entry.id) {
5360
+ children.splice(index, 1);
5361
+ }
5362
+ });
5363
+ }
5354
5364
  }
5355
5365
 
5356
5366
  async function exportZip(zipWriter, entry, totalSize, options) {