@zip.js/zip.js 2.6.66 → 2.6.68

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) {
@@ -4915,6 +4915,15 @@
4915
4915
  }
4916
4916
  return Boolean(entry);
4917
4917
  }
4918
+
4919
+ rename(name) {
4920
+ const parent = this.parent;
4921
+ if (parent && parent.getChildByName(name)) {
4922
+ throw new Error("Entry filename already exists");
4923
+ } else {
4924
+ this.name = name;
4925
+ }
4926
+ }
4918
4927
  }
4919
4928
 
4920
4929
  class ZipFileEntry extends ZipEntry {
@@ -5307,12 +5316,12 @@
5307
5316
  }
5308
5317
 
5309
5318
  async init() {
5310
- super.init();
5311
5319
  const zipBlobReader = this;
5312
5320
  zipBlobReader.size = zipBlobReader.entry.uncompressedSize;
5313
5321
  const data = await zipBlobReader.entry.getData(new BlobWriter(), Object.assign({}, zipBlobReader.options, options));
5314
5322
  zipBlobReader.data = data;
5315
5323
  zipBlobReader.blobReader = new BlobReader(data);
5324
+ super.init();
5316
5325
  }
5317
5326
 
5318
5327
  readUint8Array(index, length) {
@@ -5323,7 +5332,7 @@
5323
5332
 
5324
5333
  async function initReaders(entry) {
5325
5334
  if (entry.children.length) {
5326
- for (const child of entry.children) {
5335
+ await Promise.all(entry.children.map(async child => {
5327
5336
  if (child.directory) {
5328
5337
  await initReaders(child);
5329
5338
  } else {
@@ -5331,7 +5340,7 @@
5331
5340
  await initStream(reader);
5332
5341
  child.uncompressedSize = reader.size;
5333
5342
  }
5334
- }
5343
+ }));
5335
5344
  }
5336
5345
  }
5337
5346