@zip.js/zip.js 2.6.68 → 2.6.70

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.
@@ -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,15 @@
10249
10253
  this.directory = true;
10250
10254
  }
10251
10255
 
10256
+ clone(deepClone) {
10257
+ const zipEntry = this;
10258
+ const clone = new ZipDirectoryEntry(zipEntry.fs, zipEntry.name);
10259
+ if (deepClone) {
10260
+ clone.children = zipEntry.children.map(child => child.clone(deepClone));
10261
+ }
10262
+ return clone;
10263
+ }
10264
+
10252
10265
  addDirectory(name) {
10253
10266
  return addChild(this, name, null, true);
10254
10267
  }
@@ -10569,12 +10582,14 @@
10569
10582
  }
10570
10583
 
10571
10584
  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
- });
10585
+ if (entry.parent) {
10586
+ const children = entry.parent.children;
10587
+ children.forEach((child, index) => {
10588
+ if (child.id == entry.id) {
10589
+ children.splice(index, 1);
10590
+ }
10591
+ });
10592
+ }
10578
10593
  }
10579
10594
 
10580
10595
  async function exportZip(zipWriter, entry, totalSize, options) {