@zip.js/zip.js 2.11.0 → 2.11.2
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/BENCHMARKS.md +127 -60
- package/deno.json +1 -1
- package/dist/zip-core-external.js +22 -19
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +12 -6
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +22 -19
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +12 -6
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +22 -19
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +12 -6
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +25 -22
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +12 -6
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-module.wasm +0 -0
- package/dist/zip-native.js +12 -6
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +25 -22
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +1 -1
- package/index-native.cjs +12 -6
- package/index-native.min.js +1 -1
- package/index.cjs +25 -22
- package/index.d.cts +3 -4
- package/index.d.ts +3 -4
- package/index.min.js +1 -1
- package/lib/core/io.js +2 -3
- package/lib/core/streams/zlib-wasm/zlib-streams.js +10 -13
- package/lib/core/streams/zlib-wasm/zlib-streams.wasm +0 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-writer.js +13 -2
- package/lib/core/zlib-streams-inline.js +1 -1
- package/package.json +4 -2
package/eslint.config.mjs
CHANGED
|
@@ -53,7 +53,7 @@ export default [
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
files: ["benchmarks/**/*.js", "benchmarks/**/*.mjs", "tests/browser-runner.js", "tests/fidelity/**/*.js", "tests/api-symmetry/**/*.js"],
|
|
56
|
+
files: ["benchmarks/**/*.js", "benchmarks/**/*.mjs", "tests/browser-runner.js", "tests/registration.js", "tests/fidelity/**/*.js", "tests/api-symmetry/**/*.js"],
|
|
57
57
|
languageOptions: {
|
|
58
58
|
ecmaVersion: "latest",
|
|
59
59
|
globals: {
|
package/index-native.cjs
CHANGED
|
@@ -3604,11 +3604,10 @@ class Reader extends Stream {
|
|
|
3604
3604
|
const data = await readUint8Array(reader, offset + chunkOffset, dataSize);
|
|
3605
3605
|
if (data.length) {
|
|
3606
3606
|
controller.enqueue(data);
|
|
3607
|
+
chunkOffset += data.length;
|
|
3607
3608
|
}
|
|
3608
|
-
if ((
|
|
3609
|
+
if ((size !== UNDEFINED_VALUE && chunkOffset >= size) || (!data.length && dataSize)) {
|
|
3609
3610
|
controller.close();
|
|
3610
|
-
} else {
|
|
3611
|
-
chunkOffset += chunkSize;
|
|
3612
3611
|
}
|
|
3613
3612
|
}
|
|
3614
3613
|
});
|
|
@@ -6319,6 +6318,7 @@ class ZipWriter {
|
|
|
6319
6318
|
pendingAddFileCalls: new Set(),
|
|
6320
6319
|
pendingErrors: [],
|
|
6321
6320
|
bufferedWrites: 0,
|
|
6321
|
+
directWrites: 0,
|
|
6322
6322
|
lastFileEntry: UNDEFINED_VALUE
|
|
6323
6323
|
});
|
|
6324
6324
|
}
|
|
@@ -7169,6 +7169,7 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
7169
7169
|
const usdz = zipWriter.options[OPTION_USDZ];
|
|
7170
7170
|
let fileEntry = pendingFileEntry;
|
|
7171
7171
|
let bufferedWrite;
|
|
7172
|
+
let directWrite;
|
|
7172
7173
|
let releaseLockWriter;
|
|
7173
7174
|
let writingBufferedEntryData;
|
|
7174
7175
|
let writingEntryData;
|
|
@@ -7178,7 +7179,7 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
7178
7179
|
const lockPreviousFileEntry = keepOrder && previousFileEntry ? previousFileEntry.lockFileEntry : UNDEFINED_VALUE;
|
|
7179
7180
|
fileEntries.set(name, fileEntry);
|
|
7180
7181
|
try {
|
|
7181
|
-
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || (!dataDescriptor && !emptyEntry)) {
|
|
7182
|
+
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || zipWriter.directWrites || (!dataDescriptor && !emptyEntry)) {
|
|
7182
7183
|
bufferedWrite = true;
|
|
7183
7184
|
zipWriter.bufferedWrites++;
|
|
7184
7185
|
if (options.createTempStream) {
|
|
@@ -7189,6 +7190,8 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
7189
7190
|
fileWriter.size = 0;
|
|
7190
7191
|
await initStream(writer);
|
|
7191
7192
|
} else {
|
|
7193
|
+
directWrite = true;
|
|
7194
|
+
zipWriter.directWrites++;
|
|
7192
7195
|
fileWriter = writer;
|
|
7193
7196
|
await lockPreviousFileEntry;
|
|
7194
7197
|
await requestLockWriter();
|
|
@@ -7267,6 +7270,9 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
7267
7270
|
if (bufferedWrite) {
|
|
7268
7271
|
zipWriter.bufferedWrites--;
|
|
7269
7272
|
}
|
|
7273
|
+
if (directWrite) {
|
|
7274
|
+
zipWriter.directWrites--;
|
|
7275
|
+
}
|
|
7270
7276
|
if (releaseLockFileEntry) {
|
|
7271
7277
|
releaseLockFileEntry(lockPreviousFileEntry);
|
|
7272
7278
|
}
|
|
@@ -7411,8 +7417,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7411
7417
|
}
|
|
7412
7418
|
const { writable } = writer;
|
|
7413
7419
|
if (reader) {
|
|
7414
|
-
const readable = toCompatibleReadable(createReadable(reader));
|
|
7415
7420
|
const size = reader.size;
|
|
7421
|
+
const readable = toCompatibleReadable(createReadable(reader, { size }));
|
|
7416
7422
|
const workerOptions = {
|
|
7417
7423
|
options: {
|
|
7418
7424
|
codecType: CODEC_DEFLATE,
|
|
@@ -8591,7 +8597,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8591
8597
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8592
8598
|
*/
|
|
8593
8599
|
|
|
8594
|
-
const VERSION = "2.11.
|
|
8600
|
+
const VERSION = "2.11.2";
|
|
8595
8601
|
|
|
8596
8602
|
/*
|
|
8597
8603
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|