@zip.js/zip.js 2.6.68 → 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/index.d.ts CHANGED
@@ -1185,6 +1185,10 @@ declare class ZipEntry {
1185
1185
  * The children of the entry.
1186
1186
  */
1187
1187
  children: ZipEntry[]
1188
+ /**
1189
+ * Clones the entry
1190
+ */
1191
+ clone(): ZipEntry
1188
1192
  /**
1189
1193
  * Returns the full filename of the entry
1190
1194
  */
@@ -125,6 +125,10 @@ class ZipFileEntry extends ZipEntry {
125
125
  }
126
126
  }
127
127
 
128
+ clone() {
129
+ return new ZipFileEntry(this.fs, this.name, this);
130
+ }
131
+
128
132
  async getData(writer, options = {}) {
129
133
  const zipEntry = this;
130
134
  if (!writer || (writer.constructor == zipEntry.Writer && zipEntry.data)) {
@@ -212,6 +216,10 @@ class ZipDirectoryEntry extends ZipEntry {
212
216
  this.directory = true;
213
217
  }
214
218
 
219
+ clone() {
220
+ return new ZipDirectoryEntry(this.fs, this.name);
221
+ }
222
+
215
223
  addDirectory(name) {
216
224
  return addChild(this, name, null, true);
217
225
  }
@@ -533,12 +541,14 @@ async function initReaders(entry) {
533
541
  }
534
542
 
535
543
  function detach(entry) {
536
- const children = entry.parent.children;
537
- children.forEach((child, index) => {
538
- if (child.id == entry.id) {
539
- children.splice(index, 1);
540
- }
541
- });
544
+ if (entry.parent) {
545
+ const children = entry.parent.children;
546
+ children.forEach((child, index) => {
547
+ if (child.id == entry.id) {
548
+ children.splice(index, 1);
549
+ }
550
+ });
551
+ }
542
552
  }
543
553
 
544
554
  async function exportZip(zipWriter, entry, totalSize, options) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.6.68",
6
+ "version": "2.6.69",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",