@zip.js/zip.js 2.8.19 → 2.8.21
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/deno.json +1 -1
- package/dist/zip-core.js +19 -19
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +19 -19
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +19 -19
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +19 -19
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +19 -19
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +19 -19
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +19 -19
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +19 -19
- package/index-native.min.js +1 -1
- package/index.cjs +19 -19
- package/index.d.ts +6 -6
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +7 -17
- package/lib/core/zip-writer.js +13 -2
- package/package.json +2 -2
package/lib/core/codec-worker.js
CHANGED
|
@@ -48,6 +48,11 @@ const MODULE_WORKER_OPTIONS = { type: "module" };
|
|
|
48
48
|
|
|
49
49
|
let webWorkerSupported, webWorkerURI, webWorkerOptions;
|
|
50
50
|
let transferStreamsSupported = true;
|
|
51
|
+
try {
|
|
52
|
+
transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
|
|
53
|
+
} catch {
|
|
54
|
+
// ignored
|
|
55
|
+
}
|
|
51
56
|
let initModule = () => { };
|
|
52
57
|
|
|
53
58
|
export {
|
|
@@ -243,23 +248,8 @@ async function runWebWorker(workerData, config) {
|
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
function watchClosedStream(writableSource) {
|
|
246
|
-
|
|
247
|
-
const closed =
|
|
248
|
-
const writable = new WritableStream({
|
|
249
|
-
async write(chunk) {
|
|
250
|
-
const writer = writableSource.getWriter();
|
|
251
|
-
await writer.ready;
|
|
252
|
-
await writer.write(chunk);
|
|
253
|
-
writer.releaseLock();
|
|
254
|
-
},
|
|
255
|
-
close() {
|
|
256
|
-
resolveStreamClosed();
|
|
257
|
-
},
|
|
258
|
-
abort(reason) {
|
|
259
|
-
const writer = writableSource.getWriter();
|
|
260
|
-
return writer.abort(reason);
|
|
261
|
-
}
|
|
262
|
-
});
|
|
251
|
+
const { writable, readable } = new TransformStream();
|
|
252
|
+
const closed = readable.pipeTo(writableSource, { preventClose: true });
|
|
263
253
|
return { writable, closed };
|
|
264
254
|
}
|
|
265
255
|
|
package/lib/core/zip-writer.js
CHANGED
|
@@ -140,12 +140,14 @@ import {
|
|
|
140
140
|
OPTION_SIGNAL,
|
|
141
141
|
OPTION_USE_WEB_WORKERS,
|
|
142
142
|
OPTION_USE_COMPRESSION_STREAM,
|
|
143
|
+
OPTION_TRANSFER_STREAMS,
|
|
143
144
|
OPTION_PREVENT_CLOSE,
|
|
144
145
|
OPTION_ENCRYPTION_STRENGTH,
|
|
145
146
|
OPTION_EXTENDED_TIMESTAMP,
|
|
146
147
|
OPTION_KEEP_ORDER,
|
|
147
148
|
OPTION_LEVEL,
|
|
148
149
|
OPTION_BUFFERED_WRITE,
|
|
150
|
+
OPTION_CREATE_TEMP_STREAM,
|
|
149
151
|
OPTION_DATA_DESCRIPTOR_SIGNATURE,
|
|
150
152
|
OPTION_USE_UNICODE_FILE_NAMES,
|
|
151
153
|
OPTION_DATA_DESCRIPTOR,
|
|
@@ -524,7 +526,9 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
524
526
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
525
527
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
526
528
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
529
|
+
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
|
|
527
530
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
531
|
+
const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
528
532
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
|
|
529
533
|
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
530
534
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
@@ -630,10 +634,12 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
630
634
|
rawPassword,
|
|
631
635
|
level,
|
|
632
636
|
useWebWorkers,
|
|
637
|
+
transferStreams,
|
|
633
638
|
encryptionStrength,
|
|
634
639
|
extendedTimestamp,
|
|
635
640
|
zipCrypto,
|
|
636
641
|
bufferedWrite,
|
|
642
|
+
createTempStream,
|
|
637
643
|
keepOrder,
|
|
638
644
|
useUnicodeFileNames,
|
|
639
645
|
dataDescriptor,
|
|
@@ -710,7 +716,11 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
710
716
|
requestLockCurrentFileEntry();
|
|
711
717
|
}
|
|
712
718
|
if ((options.bufferedWrite || zipWriter.writerLocked || (zipWriter.bufferedWrites && keepOrder) || !dataDescriptor) && !usdz) {
|
|
713
|
-
|
|
719
|
+
if (options.createTempStream) {
|
|
720
|
+
fileWriter = await options.createTempStream();
|
|
721
|
+
} else {
|
|
722
|
+
fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
|
|
723
|
+
}
|
|
714
724
|
fileWriter.size = 0;
|
|
715
725
|
bufferedWrite = true;
|
|
716
726
|
zipWriter.bufferedWrites++;
|
|
@@ -875,6 +885,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
875
885
|
rawComment,
|
|
876
886
|
rawExtraField,
|
|
877
887
|
useWebWorkers,
|
|
888
|
+
transferStreams,
|
|
878
889
|
onstart,
|
|
879
890
|
onprogress,
|
|
880
891
|
onend,
|
|
@@ -955,7 +966,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
955
966
|
encrypted: encrypted && !passThrough,
|
|
956
967
|
useWebWorkers,
|
|
957
968
|
useCompressionStream,
|
|
958
|
-
transferStreams
|
|
969
|
+
transferStreams
|
|
959
970
|
},
|
|
960
971
|
config,
|
|
961
972
|
streamOptions: { signal, size, onstart, onprogress, onend }
|
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.8.
|
|
6
|
+
"version": "2.8.21",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"zip",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"eslint": "^10.0.0",
|
|
160
160
|
"http-server": "^14.1.1",
|
|
161
161
|
"rollup": "^4.57.1",
|
|
162
|
-
"typedoc": "^0.28.
|
|
162
|
+
"typedoc": "^0.28.17",
|
|
163
163
|
"typedoc-plugin-markdown": "^4.10.0"
|
|
164
164
|
}
|
|
165
165
|
}
|