@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.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";
|
|
@@ -2158,23 +2159,8 @@
|
|
|
2158
2159
|
}
|
|
2159
2160
|
|
|
2160
2161
|
function watchClosedStream(writableSource) {
|
|
2161
|
-
|
|
2162
|
-
const closed =
|
|
2163
|
-
const writable = new WritableStream({
|
|
2164
|
-
async write(chunk) {
|
|
2165
|
-
const writer = writableSource.getWriter();
|
|
2166
|
-
await writer.ready;
|
|
2167
|
-
await writer.write(chunk);
|
|
2168
|
-
writer.releaseLock();
|
|
2169
|
-
},
|
|
2170
|
-
close() {
|
|
2171
|
-
resolveStreamClosed();
|
|
2172
|
-
},
|
|
2173
|
-
abort(reason) {
|
|
2174
|
-
const writer = writableSource.getWriter();
|
|
2175
|
-
return writer.abort(reason);
|
|
2176
|
-
}
|
|
2177
|
-
});
|
|
2162
|
+
const { writable, readable } = new TransformStream();
|
|
2163
|
+
const closed = readable.pipeTo(writableSource, { preventClose: true });
|
|
2178
2164
|
return { writable, closed };
|
|
2179
2165
|
}
|
|
2180
2166
|
|
|
@@ -3172,8 +3158,8 @@
|
|
|
3172
3158
|
Object.assign(writer, {
|
|
3173
3159
|
diskNumber: 0,
|
|
3174
3160
|
diskOffset: 0,
|
|
3175
|
-
availableSize:
|
|
3176
|
-
maxSize:
|
|
3161
|
+
availableSize: INFINITY_VALUE,
|
|
3162
|
+
maxSize: INFINITY_VALUE
|
|
3177
3163
|
});
|
|
3178
3164
|
}
|
|
3179
3165
|
return writer;
|
|
@@ -3463,6 +3449,7 @@
|
|
|
3463
3449
|
const OPTION_KEEP_ORDER = "keepOrder";
|
|
3464
3450
|
const OPTION_LEVEL = "level";
|
|
3465
3451
|
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
3452
|
+
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
3466
3453
|
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
3467
3454
|
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
3468
3455
|
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
@@ -4408,8 +4395,8 @@
|
|
|
4408
4395
|
constructor(writer, options = {}) {
|
|
4409
4396
|
writer = new GenericWriter(writer);
|
|
4410
4397
|
const addSplitZipSignature =
|
|
4411
|
-
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !==
|
|
4412
|
-
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !==
|
|
4398
|
+
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== INFINITY_VALUE &&
|
|
4399
|
+
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== INFINITY_VALUE;
|
|
4413
4400
|
Object.assign(this, {
|
|
4414
4401
|
writer,
|
|
4415
4402
|
addSplitZipSignature,
|
|
@@ -4727,7 +4714,9 @@
|
|
|
4727
4714
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
4728
4715
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
4729
4716
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
4717
|
+
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
|
|
4730
4718
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
4719
|
+
const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
4731
4720
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
|
|
4732
4721
|
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
4733
4722
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
@@ -4833,10 +4822,12 @@
|
|
|
4833
4822
|
rawPassword,
|
|
4834
4823
|
level,
|
|
4835
4824
|
useWebWorkers,
|
|
4825
|
+
transferStreams,
|
|
4836
4826
|
encryptionStrength,
|
|
4837
4827
|
extendedTimestamp,
|
|
4838
4828
|
zipCrypto,
|
|
4839
4829
|
bufferedWrite,
|
|
4830
|
+
createTempStream,
|
|
4840
4831
|
keepOrder,
|
|
4841
4832
|
useUnicodeFileNames,
|
|
4842
4833
|
dataDescriptor,
|
|
@@ -4913,7 +4904,11 @@
|
|
|
4913
4904
|
requestLockCurrentFileEntry();
|
|
4914
4905
|
}
|
|
4915
4906
|
if ((options.bufferedWrite || zipWriter.writerLocked || (zipWriter.bufferedWrites && keepOrder) || !dataDescriptor) && !usdz) {
|
|
4916
|
-
|
|
4907
|
+
if (options.createTempStream) {
|
|
4908
|
+
fileWriter = await options.createTempStream();
|
|
4909
|
+
} else {
|
|
4910
|
+
fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
|
|
4911
|
+
}
|
|
4917
4912
|
fileWriter.size = 0;
|
|
4918
4913
|
bufferedWrite = true;
|
|
4919
4914
|
zipWriter.bufferedWrites++;
|
|
@@ -5078,6 +5073,7 @@
|
|
|
5078
5073
|
rawComment,
|
|
5079
5074
|
rawExtraField,
|
|
5080
5075
|
useWebWorkers,
|
|
5076
|
+
transferStreams,
|
|
5081
5077
|
onstart,
|
|
5082
5078
|
onprogress,
|
|
5083
5079
|
onend,
|
|
@@ -5158,7 +5154,7 @@
|
|
|
5158
5154
|
encrypted: encrypted && !passThrough,
|
|
5159
5155
|
useWebWorkers,
|
|
5160
5156
|
useCompressionStream,
|
|
5161
|
-
transferStreams
|
|
5157
|
+
transferStreams
|
|
5162
5158
|
},
|
|
5163
5159
|
config,
|
|
5164
5160
|
streamOptions: { signal, size, onstart, onprogress, onend }
|