@zip.js/zip.js 2.8.18 → 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 +19 -23
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +19 -23
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +19 -23
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +19 -23
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +19 -23
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +19 -23
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +19 -23
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +19 -23
- package/index-native.min.js +1 -1
- package/index.cjs +19 -23
- package/index.d.ts +6 -6
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +2 -17
- package/lib/core/constants.js +2 -0
- package/lib/core/io.js +3 -2
- package/lib/core/zip-writer.js +16 -4
- package/package.json +1 -4
package/dist/zip-native.js
CHANGED
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
const MIN_DATE = new Date(1980, 0, 1);
|
|
106
106
|
|
|
107
107
|
const UNDEFINED_VALUE = undefined;
|
|
108
|
+
const INFINITY_VALUE = Infinity;
|
|
108
109
|
const UNDEFINED_TYPE = "undefined";
|
|
109
110
|
const FUNCTION_TYPE = "function";
|
|
110
111
|
const OBJECT_TYPE = "object";
|
|
@@ -2154,23 +2155,8 @@
|
|
|
2154
2155
|
}
|
|
2155
2156
|
|
|
2156
2157
|
function watchClosedStream(writableSource) {
|
|
2157
|
-
|
|
2158
|
-
const closed =
|
|
2159
|
-
const writable = new WritableStream({
|
|
2160
|
-
async write(chunk) {
|
|
2161
|
-
const writer = writableSource.getWriter();
|
|
2162
|
-
await writer.ready;
|
|
2163
|
-
await writer.write(chunk);
|
|
2164
|
-
writer.releaseLock();
|
|
2165
|
-
},
|
|
2166
|
-
close() {
|
|
2167
|
-
resolveStreamClosed();
|
|
2168
|
-
},
|
|
2169
|
-
abort(reason) {
|
|
2170
|
-
const writer = writableSource.getWriter();
|
|
2171
|
-
return writer.abort(reason);
|
|
2172
|
-
}
|
|
2173
|
-
});
|
|
2158
|
+
const { writable, readable } = new TransformStream();
|
|
2159
|
+
const closed = readable.pipeTo(writableSource, { preventClose: true });
|
|
2174
2160
|
return { writable, closed };
|
|
2175
2161
|
}
|
|
2176
2162
|
|
|
@@ -3168,8 +3154,8 @@
|
|
|
3168
3154
|
Object.assign(writer, {
|
|
3169
3155
|
diskNumber: 0,
|
|
3170
3156
|
diskOffset: 0,
|
|
3171
|
-
availableSize:
|
|
3172
|
-
maxSize:
|
|
3157
|
+
availableSize: INFINITY_VALUE,
|
|
3158
|
+
maxSize: INFINITY_VALUE
|
|
3173
3159
|
});
|
|
3174
3160
|
}
|
|
3175
3161
|
return writer;
|
|
@@ -3459,6 +3445,7 @@
|
|
|
3459
3445
|
const OPTION_KEEP_ORDER = "keepOrder";
|
|
3460
3446
|
const OPTION_LEVEL = "level";
|
|
3461
3447
|
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
3448
|
+
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
3462
3449
|
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
3463
3450
|
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
3464
3451
|
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
@@ -4404,8 +4391,8 @@
|
|
|
4404
4391
|
constructor(writer, options = {}) {
|
|
4405
4392
|
writer = new GenericWriter(writer);
|
|
4406
4393
|
const addSplitZipSignature =
|
|
4407
|
-
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !==
|
|
4408
|
-
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !==
|
|
4394
|
+
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== INFINITY_VALUE &&
|
|
4395
|
+
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== INFINITY_VALUE;
|
|
4409
4396
|
Object.assign(this, {
|
|
4410
4397
|
writer,
|
|
4411
4398
|
addSplitZipSignature,
|
|
@@ -4723,7 +4710,9 @@
|
|
|
4723
4710
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
4724
4711
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
4725
4712
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
4713
|
+
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
|
|
4726
4714
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
4715
|
+
const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
4727
4716
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
|
|
4728
4717
|
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
4729
4718
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
@@ -4829,10 +4818,12 @@
|
|
|
4829
4818
|
rawPassword,
|
|
4830
4819
|
level,
|
|
4831
4820
|
useWebWorkers,
|
|
4821
|
+
transferStreams,
|
|
4832
4822
|
encryptionStrength,
|
|
4833
4823
|
extendedTimestamp,
|
|
4834
4824
|
zipCrypto,
|
|
4835
4825
|
bufferedWrite,
|
|
4826
|
+
createTempStream,
|
|
4836
4827
|
keepOrder,
|
|
4837
4828
|
useUnicodeFileNames,
|
|
4838
4829
|
dataDescriptor,
|
|
@@ -4909,7 +4900,11 @@
|
|
|
4909
4900
|
requestLockCurrentFileEntry();
|
|
4910
4901
|
}
|
|
4911
4902
|
if ((options.bufferedWrite || zipWriter.writerLocked || (zipWriter.bufferedWrites && keepOrder) || !dataDescriptor) && !usdz) {
|
|
4912
|
-
|
|
4903
|
+
if (options.createTempStream) {
|
|
4904
|
+
fileWriter = await options.createTempStream();
|
|
4905
|
+
} else {
|
|
4906
|
+
fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
|
|
4907
|
+
}
|
|
4913
4908
|
fileWriter.size = 0;
|
|
4914
4909
|
bufferedWrite = true;
|
|
4915
4910
|
zipWriter.bufferedWrites++;
|
|
@@ -5074,6 +5069,7 @@
|
|
|
5074
5069
|
rawComment,
|
|
5075
5070
|
rawExtraField,
|
|
5076
5071
|
useWebWorkers,
|
|
5072
|
+
transferStreams,
|
|
5077
5073
|
onstart,
|
|
5078
5074
|
onprogress,
|
|
5079
5075
|
onend,
|
|
@@ -5154,7 +5150,7 @@
|
|
|
5154
5150
|
encrypted: encrypted && !passThrough,
|
|
5155
5151
|
useWebWorkers,
|
|
5156
5152
|
useCompressionStream,
|
|
5157
|
-
transferStreams
|
|
5153
|
+
transferStreams
|
|
5158
5154
|
},
|
|
5159
5155
|
config,
|
|
5160
5156
|
streamOptions: { signal, size, onstart, onprogress, onend }
|