@zip.js/zip.js 2.8.19 → 2.8.20
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 +14 -19
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +14 -19
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +14 -19
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +14 -19
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +14 -19
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +14 -19
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +14 -19
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +14 -19
- package/index-native.min.js +1 -1
- package/index.cjs +14 -19
- package/index.d.ts +6 -6
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +2 -17
- package/lib/core/zip-writer.js +13 -2
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2153,23 +2153,8 @@ async function runWebWorker(workerData, config) {
|
|
|
2153
2153
|
}
|
|
2154
2154
|
|
|
2155
2155
|
function watchClosedStream(writableSource) {
|
|
2156
|
-
|
|
2157
|
-
const closed =
|
|
2158
|
-
const writable = new WritableStream({
|
|
2159
|
-
async write(chunk) {
|
|
2160
|
-
const writer = writableSource.getWriter();
|
|
2161
|
-
await writer.ready;
|
|
2162
|
-
await writer.write(chunk);
|
|
2163
|
-
writer.releaseLock();
|
|
2164
|
-
},
|
|
2165
|
-
close() {
|
|
2166
|
-
resolveStreamClosed();
|
|
2167
|
-
},
|
|
2168
|
-
abort(reason) {
|
|
2169
|
-
const writer = writableSource.getWriter();
|
|
2170
|
-
return writer.abort(reason);
|
|
2171
|
-
}
|
|
2172
|
-
});
|
|
2156
|
+
const { writable, readable } = new TransformStream();
|
|
2157
|
+
const closed = readable.pipeTo(writableSource, { preventClose: true });
|
|
2173
2158
|
return { writable, closed };
|
|
2174
2159
|
}
|
|
2175
2160
|
|
|
@@ -3458,6 +3443,7 @@ const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
|
3458
3443
|
const OPTION_KEEP_ORDER = "keepOrder";
|
|
3459
3444
|
const OPTION_LEVEL = "level";
|
|
3460
3445
|
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
3446
|
+
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
3461
3447
|
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
3462
3448
|
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
3463
3449
|
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
@@ -4722,7 +4708,9 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
4722
4708
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
4723
4709
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
4724
4710
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
4711
|
+
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
|
|
4725
4712
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
4713
|
+
const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
4726
4714
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
|
|
4727
4715
|
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
4728
4716
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
@@ -4828,10 +4816,12 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
4828
4816
|
rawPassword,
|
|
4829
4817
|
level,
|
|
4830
4818
|
useWebWorkers,
|
|
4819
|
+
transferStreams,
|
|
4831
4820
|
encryptionStrength,
|
|
4832
4821
|
extendedTimestamp,
|
|
4833
4822
|
zipCrypto,
|
|
4834
4823
|
bufferedWrite,
|
|
4824
|
+
createTempStream,
|
|
4835
4825
|
keepOrder,
|
|
4836
4826
|
useUnicodeFileNames,
|
|
4837
4827
|
dataDescriptor,
|
|
@@ -4908,7 +4898,11 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
4908
4898
|
requestLockCurrentFileEntry();
|
|
4909
4899
|
}
|
|
4910
4900
|
if ((options.bufferedWrite || zipWriter.writerLocked || (zipWriter.bufferedWrites && keepOrder) || !dataDescriptor) && !usdz) {
|
|
4911
|
-
|
|
4901
|
+
if (options.createTempStream) {
|
|
4902
|
+
fileWriter = await options.createTempStream();
|
|
4903
|
+
} else {
|
|
4904
|
+
fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
|
|
4905
|
+
}
|
|
4912
4906
|
fileWriter.size = 0;
|
|
4913
4907
|
bufferedWrite = true;
|
|
4914
4908
|
zipWriter.bufferedWrites++;
|
|
@@ -5073,6 +5067,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
5073
5067
|
rawComment,
|
|
5074
5068
|
rawExtraField,
|
|
5075
5069
|
useWebWorkers,
|
|
5070
|
+
transferStreams,
|
|
5076
5071
|
onstart,
|
|
5077
5072
|
onprogress,
|
|
5078
5073
|
onend,
|
|
@@ -5153,7 +5148,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
5153
5148
|
encrypted: encrypted && !passThrough,
|
|
5154
5149
|
useWebWorkers,
|
|
5155
5150
|
useCompressionStream,
|
|
5156
|
-
transferStreams
|
|
5151
|
+
transferStreams
|
|
5157
5152
|
},
|
|
5158
5153
|
config,
|
|
5159
5154
|
streamOptions: { signal, size, onstart, onprogress, onend }
|
package/index.d.ts
CHANGED
|
@@ -293,6 +293,12 @@ export interface WorkerConfiguration {
|
|
|
293
293
|
* @defaultValue true
|
|
294
294
|
*/
|
|
295
295
|
useCompressionStream?: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* `true` to transfer stream ownership to web workers.
|
|
298
|
+
*
|
|
299
|
+
* @defaultValue true
|
|
300
|
+
*/
|
|
301
|
+
transferStreams?: boolean;
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
/**
|
|
@@ -885,12 +891,6 @@ export interface ZipReaderOptions {
|
|
|
885
891
|
* @defaultValue false
|
|
886
892
|
*/
|
|
887
893
|
preventClose?: boolean;
|
|
888
|
-
/**
|
|
889
|
-
* `true` to transfer streams to web workers when decompressing data.
|
|
890
|
-
*
|
|
891
|
-
* @defaultValue true
|
|
892
|
-
*/
|
|
893
|
-
transferStreams?: boolean;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
/**
|