@zip.js/zip.js 2.6.15 → 2.6.16
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/README.md +4 -4
- package/dist/README.md +6 -4
- package/dist/zip-fs-full.js +23 -25
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +23 -25
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +23 -25
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +23 -25
- package/dist/zip.min.js +1 -1
- package/lib/core/zip-writer.js +23 -25
- package/package.json +1 -1
package/dist/zip-full.js
CHANGED
|
@@ -7766,6 +7766,7 @@
|
|
|
7766
7766
|
const EXTRAFIELD_LENGTH_ZIP64 = 24;
|
|
7767
7767
|
|
|
7768
7768
|
let workers = 0;
|
|
7769
|
+
const pendingEntries = [];
|
|
7769
7770
|
|
|
7770
7771
|
class ZipWriter {
|
|
7771
7772
|
|
|
@@ -7778,7 +7779,6 @@
|
|
|
7778
7779
|
filenames: new Set(),
|
|
7779
7780
|
offset: writer.size || 0,
|
|
7780
7781
|
pendingCompressedSize: 0,
|
|
7781
|
-
pendingEntries: [],
|
|
7782
7782
|
pendingAddFileCalls: new Set()
|
|
7783
7783
|
});
|
|
7784
7784
|
}
|
|
@@ -7787,36 +7787,34 @@
|
|
|
7787
7787
|
const zipWriter = this;
|
|
7788
7788
|
const {
|
|
7789
7789
|
pendingAddFileCalls,
|
|
7790
|
-
pendingEntries,
|
|
7791
7790
|
config
|
|
7792
7791
|
} = zipWriter;
|
|
7793
7792
|
if (workers < config.maxWorkers) {
|
|
7794
7793
|
workers++;
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7794
|
+
} else {
|
|
7795
|
+
await new Promise(resolve => pendingEntries.push(resolve));
|
|
7796
|
+
}
|
|
7797
|
+
let promiseAddFile;
|
|
7798
|
+
try {
|
|
7799
|
+
name = name.trim();
|
|
7800
|
+
if (zipWriter.filenames.has(name)) {
|
|
7801
|
+
throw new Error(ERR_DUPLICATED_NAME);
|
|
7802
|
+
}
|
|
7803
|
+
zipWriter.filenames.add(name);
|
|
7804
|
+
promiseAddFile = addFile(zipWriter, name, reader, options);
|
|
7805
|
+
pendingAddFileCalls.add(promiseAddFile);
|
|
7806
|
+
return await promiseAddFile;
|
|
7807
|
+
} catch (error) {
|
|
7808
|
+
zipWriter.filenames.delete(name);
|
|
7809
|
+
throw error;
|
|
7810
|
+
} finally {
|
|
7811
|
+
pendingAddFileCalls.delete(promiseAddFile);
|
|
7812
|
+
const pendingEntry = pendingEntries.shift();
|
|
7813
|
+
if (pendingEntry) {
|
|
7814
|
+
pendingEntry();
|
|
7815
|
+
} else {
|
|
7810
7816
|
workers--;
|
|
7811
|
-
const pendingEntry = pendingEntries.shift();
|
|
7812
|
-
if (pendingEntry) {
|
|
7813
|
-
zipWriter.add(pendingEntry.name, pendingEntry.reader, pendingEntry.options)
|
|
7814
|
-
.then(pendingEntry.resolve)
|
|
7815
|
-
.catch(pendingEntry.reject);
|
|
7816
|
-
}
|
|
7817
7817
|
}
|
|
7818
|
-
} else {
|
|
7819
|
-
return new Promise((resolve, reject) => pendingEntries.push({ name, reader, options, resolve, reject }));
|
|
7820
7818
|
}
|
|
7821
7819
|
}
|
|
7822
7820
|
|