@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/index-native.cjs
CHANGED
|
@@ -99,6 +99,7 @@ const MAX_DATE = new Date(2107, 11, 31);
|
|
|
99
99
|
const MIN_DATE = new Date(1980, 0, 1);
|
|
100
100
|
|
|
101
101
|
const UNDEFINED_VALUE = undefined;
|
|
102
|
+
const INFINITY_VALUE = Infinity;
|
|
102
103
|
const UNDEFINED_TYPE = "undefined";
|
|
103
104
|
const FUNCTION_TYPE = "function";
|
|
104
105
|
const OBJECT_TYPE = "object";
|
|
@@ -2148,23 +2149,8 @@ async function runWebWorker(workerData, config) {
|
|
|
2148
2149
|
}
|
|
2149
2150
|
|
|
2150
2151
|
function watchClosedStream(writableSource) {
|
|
2151
|
-
|
|
2152
|
-
const closed =
|
|
2153
|
-
const writable = new WritableStream({
|
|
2154
|
-
async write(chunk) {
|
|
2155
|
-
const writer = writableSource.getWriter();
|
|
2156
|
-
await writer.ready;
|
|
2157
|
-
await writer.write(chunk);
|
|
2158
|
-
writer.releaseLock();
|
|
2159
|
-
},
|
|
2160
|
-
close() {
|
|
2161
|
-
resolveStreamClosed();
|
|
2162
|
-
},
|
|
2163
|
-
abort(reason) {
|
|
2164
|
-
const writer = writableSource.getWriter();
|
|
2165
|
-
return writer.abort(reason);
|
|
2166
|
-
}
|
|
2167
|
-
});
|
|
2152
|
+
const { writable, readable } = new TransformStream();
|
|
2153
|
+
const closed = readable.pipeTo(writableSource, { preventClose: true });
|
|
2168
2154
|
return { writable, closed };
|
|
2169
2155
|
}
|
|
2170
2156
|
|
|
@@ -3162,8 +3148,8 @@ class GenericWriter {
|
|
|
3162
3148
|
Object.assign(writer, {
|
|
3163
3149
|
diskNumber: 0,
|
|
3164
3150
|
diskOffset: 0,
|
|
3165
|
-
availableSize:
|
|
3166
|
-
maxSize:
|
|
3151
|
+
availableSize: INFINITY_VALUE,
|
|
3152
|
+
maxSize: INFINITY_VALUE
|
|
3167
3153
|
});
|
|
3168
3154
|
}
|
|
3169
3155
|
return writer;
|
|
@@ -3453,6 +3439,7 @@ const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
|
3453
3439
|
const OPTION_KEEP_ORDER = "keepOrder";
|
|
3454
3440
|
const OPTION_LEVEL = "level";
|
|
3455
3441
|
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
3442
|
+
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
3456
3443
|
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
3457
3444
|
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
3458
3445
|
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
@@ -4398,8 +4385,8 @@ class ZipWriter {
|
|
|
4398
4385
|
constructor(writer, options = {}) {
|
|
4399
4386
|
writer = new GenericWriter(writer);
|
|
4400
4387
|
const addSplitZipSignature =
|
|
4401
|
-
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !==
|
|
4402
|
-
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !==
|
|
4388
|
+
writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== INFINITY_VALUE &&
|
|
4389
|
+
writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== INFINITY_VALUE;
|
|
4403
4390
|
Object.assign(this, {
|
|
4404
4391
|
writer,
|
|
4405
4392
|
addSplitZipSignature,
|
|
@@ -4717,7 +4704,9 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
4717
4704
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
4718
4705
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
4719
4706
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
4707
|
+
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
|
|
4720
4708
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
4709
|
+
const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
4721
4710
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
|
|
4722
4711
|
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
4723
4712
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
@@ -4823,10 +4812,12 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
4823
4812
|
rawPassword,
|
|
4824
4813
|
level,
|
|
4825
4814
|
useWebWorkers,
|
|
4815
|
+
transferStreams,
|
|
4826
4816
|
encryptionStrength,
|
|
4827
4817
|
extendedTimestamp,
|
|
4828
4818
|
zipCrypto,
|
|
4829
4819
|
bufferedWrite,
|
|
4820
|
+
createTempStream,
|
|
4830
4821
|
keepOrder,
|
|
4831
4822
|
useUnicodeFileNames,
|
|
4832
4823
|
dataDescriptor,
|
|
@@ -4903,7 +4894,11 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
4903
4894
|
requestLockCurrentFileEntry();
|
|
4904
4895
|
}
|
|
4905
4896
|
if ((options.bufferedWrite || zipWriter.writerLocked || (zipWriter.bufferedWrites && keepOrder) || !dataDescriptor) && !usdz) {
|
|
4906
|
-
|
|
4897
|
+
if (options.createTempStream) {
|
|
4898
|
+
fileWriter = await options.createTempStream();
|
|
4899
|
+
} else {
|
|
4900
|
+
fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
|
|
4901
|
+
}
|
|
4907
4902
|
fileWriter.size = 0;
|
|
4908
4903
|
bufferedWrite = true;
|
|
4909
4904
|
zipWriter.bufferedWrites++;
|
|
@@ -5068,6 +5063,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
5068
5063
|
rawComment,
|
|
5069
5064
|
rawExtraField,
|
|
5070
5065
|
useWebWorkers,
|
|
5066
|
+
transferStreams,
|
|
5071
5067
|
onstart,
|
|
5072
5068
|
onprogress,
|
|
5073
5069
|
onend,
|
|
@@ -5148,7 +5144,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
5148
5144
|
encrypted: encrypted && !passThrough,
|
|
5149
5145
|
useWebWorkers,
|
|
5150
5146
|
useCompressionStream,
|
|
5151
|
-
transferStreams
|
|
5147
|
+
transferStreams
|
|
5152
5148
|
},
|
|
5153
5149
|
config,
|
|
5154
5150
|
streamOptions: { signal, size, onstart, onprogress, onend }
|