@zip.js/zip.js 2.7.4 → 2.7.6
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-full.js +2 -2
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +2 -2
- package/dist/zip-fs.min.js +1 -1
- package/index.cjs +2 -2
- package/lib/core/zip-fs-core.js +31 -17
- package/package.json +1 -1
package/lib/core/zip-fs-core.js
CHANGED
|
@@ -367,25 +367,36 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
367
367
|
const zipReader = new ZipReader(reader, options);
|
|
368
368
|
const importedEntries = [];
|
|
369
369
|
const entries = await zipReader.getEntries();
|
|
370
|
-
|
|
370
|
+
for (const entry of entries) {
|
|
371
371
|
let parent = this;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
372
|
+
try {
|
|
373
|
+
const path = entry.filename.split("/");
|
|
374
|
+
const name = path.pop();
|
|
375
|
+
path.forEach((pathPart, pathIndex) => {
|
|
376
|
+
const previousParent = parent;
|
|
377
|
+
parent = parent.getChildByName(pathPart);
|
|
378
|
+
if (!parent) {
|
|
379
|
+
parent = new ZipDirectoryEntry(this.fs, pathPart, { data: pathIndex == path.length - 1 ? entry : null }, previousParent);
|
|
380
|
+
importedEntries.push(parent);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
if (!entry.directory) {
|
|
384
|
+
importedEntries.push(addChild(parent, name, {
|
|
385
|
+
data: entry,
|
|
386
|
+
Reader: getZipBlobReader(Object.assign({}, options))
|
|
387
|
+
}));
|
|
380
388
|
}
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
})
|
|
389
|
+
} catch (error) {
|
|
390
|
+
try {
|
|
391
|
+
error.cause = {
|
|
392
|
+
entry
|
|
393
|
+
};
|
|
394
|
+
} catch (_error) {
|
|
395
|
+
// ignored
|
|
396
|
+
}
|
|
397
|
+
throw error;
|
|
387
398
|
}
|
|
388
|
-
}
|
|
399
|
+
}
|
|
389
400
|
return importedEntries;
|
|
390
401
|
}
|
|
391
402
|
|
|
@@ -620,6 +631,9 @@ async function initReaders(entry, options) {
|
|
|
620
631
|
} catch (error) {
|
|
621
632
|
try {
|
|
622
633
|
error.entryId = child.id;
|
|
634
|
+
error.cause = {
|
|
635
|
+
entry: child
|
|
636
|
+
};
|
|
623
637
|
} catch (_error) {
|
|
624
638
|
// ignored
|
|
625
639
|
}
|
|
@@ -652,7 +666,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
652
666
|
|
|
653
667
|
async function exportChild() {
|
|
654
668
|
if (options.bufferedWrite) {
|
|
655
|
-
await Promise.
|
|
669
|
+
await Promise.allSettled(entry.children.map(processChild));
|
|
656
670
|
} else {
|
|
657
671
|
for (const child of entry.children) {
|
|
658
672
|
await processChild(child);
|
package/package.json
CHANGED