@zip.js/zip.js 2.8.52 → 2.8.54
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/README.md +1 -1
- package/deno.json +2 -1
- package/dist/zip-core-external.js +839 -528
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +847 -527
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +880 -557
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +829 -538
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +880 -557
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +895 -558
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +894 -557
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +849 -529
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +849 -529
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +848 -528
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +2 -1
- package/index-native.cjs +895 -558
- package/index-native.min.js +1 -1
- package/index.cjs +894 -557
- package/index.d.cts +672 -78
- package/index.d.ts +672 -78
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +13 -4
- package/lib/core/configuration.js +62 -21
- package/lib/core/constants.js +16 -1
- package/lib/core/io.js +44 -29
- package/lib/core/options.js +46 -2
- package/lib/core/streams/aes-crypto-stream.js +12 -12
- package/lib/core/util/decode-text.js +11 -2
- package/lib/core/web-worker-base.js +3 -2
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-entry.js +8 -0
- package/lib/core/zip-fs.js +38 -27
- package/lib/core/zip-reader.js +149 -60
- package/lib/core/zip-writer.js +329 -189
- package/lib/zip-core-base.js +6 -1
- package/lib/zip-core-reader.js +1 -0
- package/lib/zip-core-writer.js +5 -0
- package/package.json +11 -3
package/dist/zip.js
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
const LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;
|
|
47
47
|
const SPLIT_ZIP_FILE_SIGNATURE = 0x08074b50;
|
|
48
|
+
const TEMPORARY_SPLIT_ZIP_FILE_SIGNATURE = 0x30304b50;
|
|
48
49
|
const DATA_DESCRIPTOR_RECORD_SIGNATURE = SPLIT_ZIP_FILE_SIGNATURE;
|
|
49
50
|
const ARCHIVE_EXTRA_DATA_SIGNATURE = 0x08064b50;
|
|
50
51
|
const DIGITAL_SIGNATURE_RECORD_SIGNATURE = 0x05054b50;
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
const DATA_DESCRIPTOR_RECORD_LENGTH = 12;
|
|
62
63
|
const DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH = 20;
|
|
63
64
|
const DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH = 4;
|
|
65
|
+
const SPLIT_ZIP_FILE_SIGNATURE_LENGTH = 4;
|
|
64
66
|
|
|
65
67
|
const EXTRAFIELD_TYPE_ZIP64 = 0x0001;
|
|
66
68
|
const EXTRAFIELD_TYPE_AES = 0x9901;
|
|
@@ -102,6 +104,9 @@
|
|
|
102
104
|
const VERSION_ZIP64 = 0x2D;
|
|
103
105
|
const VERSION_AES = 0x33;
|
|
104
106
|
|
|
107
|
+
const VERSION_MADE_BY_MSDOS = 0x0014;
|
|
108
|
+
const VERSION_MADE_BY_UNIX = 0x0300;
|
|
109
|
+
|
|
105
110
|
const DIRECTORY_SIGNATURE = "/";
|
|
106
111
|
|
|
107
112
|
const HEADER_SIZE = 30;
|
|
@@ -109,6 +114,8 @@
|
|
|
109
114
|
const HEADER_OFFSET_SIGNATURE = 10;
|
|
110
115
|
const HEADER_OFFSET_COMPRESSED_SIZE = 14;
|
|
111
116
|
const HEADER_OFFSET_UNCOMPRESSED_SIZE = 18;
|
|
117
|
+
const HEADER_OFFSET_FILENAME_LENGTH = 22;
|
|
118
|
+
const HEADER_OFFSET_EXTRAFIELD_LENGTH = 24;
|
|
112
119
|
const LOCAL_HEADER_COMMON_OFFSET = 4;
|
|
113
120
|
|
|
114
121
|
const MAX_DATE = new Date(2107, 11, 31, 23, 59, 58);
|
|
@@ -121,9 +128,116 @@
|
|
|
121
128
|
const OBJECT_TYPE = "object";
|
|
122
129
|
const STRING_TYPE = "string";
|
|
123
130
|
const NUMBER_TYPE = "number";
|
|
131
|
+
const BOOLEAN_TYPE = "boolean";
|
|
124
132
|
|
|
125
133
|
const EMPTY_UINT8_ARRAY = new Uint8Array();
|
|
126
134
|
|
|
135
|
+
/*
|
|
136
|
+
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
137
|
+
|
|
138
|
+
Redistribution and use in source and binary forms, with or without
|
|
139
|
+
modification, are permitted provided that the following conditions are met:
|
|
140
|
+
|
|
141
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
142
|
+
this list of conditions and the following disclaimer.
|
|
143
|
+
|
|
144
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
145
|
+
notice, this list of conditions and the following disclaimer in
|
|
146
|
+
the documentation and/or other materials provided with the distribution.
|
|
147
|
+
|
|
148
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
149
|
+
derived from this software without specific prior written permission.
|
|
150
|
+
|
|
151
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
152
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
153
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
154
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
155
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
156
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
157
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
158
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
159
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
160
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
const OPTION_FILENAME_ENCODING = "filenameEncoding";
|
|
165
|
+
const OPTION_COMMENT_ENCODING = "commentEncoding";
|
|
166
|
+
const OPTION_DECODE_TEXT = "decodeText";
|
|
167
|
+
const OPTION_EXTRACT_PREPENDED_DATA = "extractPrependedData";
|
|
168
|
+
const OPTION_EXTRACT_APPENDED_DATA = "extractAppendedData";
|
|
169
|
+
const OPTION_PASSWORD = "password";
|
|
170
|
+
const OPTION_RAW_PASSWORD = "rawPassword";
|
|
171
|
+
const OPTION_PASS_THROUGH = "passThrough";
|
|
172
|
+
const OPTION_SIGNAL = "signal";
|
|
173
|
+
const OPTION_CHECK_PASSWORD_ONLY = "checkPasswordOnly";
|
|
174
|
+
const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
|
|
175
|
+
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
176
|
+
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
177
|
+
const OPTION_CHECK_LOCAL_DIRECTORY = "checkLocalDirectory";
|
|
178
|
+
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
179
|
+
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
180
|
+
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
181
|
+
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
182
|
+
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
183
|
+
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
184
|
+
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
185
|
+
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
186
|
+
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
187
|
+
const OPTION_NTFS_TIMESTAMP = "ntfsTimestamp";
|
|
188
|
+
const OPTION_KEEP_ORDER = "keepOrder";
|
|
189
|
+
const OPTION_LEVEL = "level";
|
|
190
|
+
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
191
|
+
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
192
|
+
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
193
|
+
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
194
|
+
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
195
|
+
const OPTION_SUPPORT_ZIP64_SPLIT_FILE = "supportZip64SplitFile";
|
|
196
|
+
const OPTION_ENCODE_TEXT = "encodeText";
|
|
197
|
+
const OPTION_OFFSET = "offset";
|
|
198
|
+
const OPTION_USDZ = "usdz";
|
|
199
|
+
const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
|
|
200
|
+
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
201
|
+
const OPTION_STRICTNESS = "strictness";
|
|
202
|
+
const OPTION_FILENAME_VALIDATION = "filenameValidation";
|
|
203
|
+
const OPTION_NORMALIZE_FILENAME = "normalizeFilename";
|
|
204
|
+
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
205
|
+
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
206
|
+
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
207
|
+
const TEXT_TYPE_FILENAME = "filename";
|
|
208
|
+
const TEXT_TYPE_COMMENT = "comment";
|
|
209
|
+
const STRICTNESS_STRICT = "strict";
|
|
210
|
+
const STRICTNESS_BALANCED = "balanced";
|
|
211
|
+
const STRICTNESS_TOLERANT = "tolerant";
|
|
212
|
+
|
|
213
|
+
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
214
|
+
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
215
|
+
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
216
|
+
|
|
217
|
+
function checkFunctionOption(value) {
|
|
218
|
+
if (value && typeof value != FUNCTION_TYPE) {
|
|
219
|
+
throw new Error(ERR_INVALID_FUNCTION_OPTION);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function checkSignalOption(signal) {
|
|
225
|
+
if (signal && (typeof signal.addEventListener != FUNCTION_TYPE || typeof signal.aborted != BOOLEAN_TYPE)) {
|
|
226
|
+
throw new Error(ERR_INVALID_SIGNAL);
|
|
227
|
+
}
|
|
228
|
+
return signal || UNDEFINED_VALUE;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function checkPasswordOption(password, rawPassword) {
|
|
232
|
+
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
233
|
+
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function toNumber(value) {
|
|
238
|
+
return typeof value == STRING_TYPE && value.trim() ? Number(value) : value;
|
|
239
|
+
}
|
|
240
|
+
|
|
127
241
|
/*
|
|
128
242
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
129
243
|
|
|
@@ -153,7 +267,10 @@
|
|
|
153
267
|
*/
|
|
154
268
|
|
|
155
269
|
|
|
270
|
+
const DEFAULT_CHUNK_SIZE$1 = 64 * 1024;
|
|
156
271
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
272
|
+
const MINIMUM_PROPERTY_VALUE = 1;
|
|
273
|
+
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
157
274
|
let maxWorkers = 2;
|
|
158
275
|
try {
|
|
159
276
|
if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
|
|
@@ -165,7 +282,7 @@
|
|
|
165
282
|
const DEFAULT_CONFIGURATION = {
|
|
166
283
|
workerURI: "./core/web-worker-wasm.js",
|
|
167
284
|
wasmURI: "./core/streams/zlib-wasm/zlib-streams.wasm",
|
|
168
|
-
chunkSize:
|
|
285
|
+
chunkSize: DEFAULT_CHUNK_SIZE$1,
|
|
169
286
|
maxWorkers,
|
|
170
287
|
terminateWorkerTimeout: 5000,
|
|
171
288
|
workerStarvationTimeout: 5000,
|
|
@@ -177,24 +294,38 @@
|
|
|
177
294
|
DecompressionStream: typeof DecompressionStream != UNDEFINED_TYPE && DecompressionStream
|
|
178
295
|
};
|
|
179
296
|
|
|
180
|
-
const
|
|
297
|
+
const PROPERTY_NAME_MAX_WORKERS = "maxWorkers";
|
|
298
|
+
|
|
299
|
+
const STRING_PROPERTY_NAMES = [
|
|
181
300
|
"baseURI",
|
|
182
301
|
"wasmURI",
|
|
183
|
-
"workerURI"
|
|
184
|
-
|
|
302
|
+
"workerURI"
|
|
303
|
+
];
|
|
304
|
+
const BOOLEAN_PROPERTY_NAMES = [
|
|
305
|
+
"useCompressionStream",
|
|
306
|
+
"useWebWorkers",
|
|
307
|
+
"transferStreams"
|
|
308
|
+
];
|
|
309
|
+
const NUMBER_PROPERTY_NAMES = [
|
|
185
310
|
"chunkSize",
|
|
186
|
-
|
|
311
|
+
PROPERTY_NAME_MAX_WORKERS,
|
|
187
312
|
"terminateWorkerTimeout",
|
|
188
313
|
"workerStarvationTimeout",
|
|
189
|
-
"workerStartupTimeout"
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"
|
|
314
|
+
"workerStartupTimeout"
|
|
315
|
+
];
|
|
316
|
+
const FUNCTION_PROPERTY_NAMES = [
|
|
317
|
+
"createWorker",
|
|
193
318
|
"CompressionStream",
|
|
194
319
|
"DecompressionStream",
|
|
195
320
|
"CompressionStreamFallback",
|
|
196
321
|
"DecompressionStreamFallback"
|
|
197
322
|
];
|
|
323
|
+
const CONFIGURABLE_PROPERTY_NAMES = [
|
|
324
|
+
...STRING_PROPERTY_NAMES,
|
|
325
|
+
...BOOLEAN_PROPERTY_NAMES,
|
|
326
|
+
...NUMBER_PROPERTY_NAMES,
|
|
327
|
+
...FUNCTION_PROPERTY_NAMES
|
|
328
|
+
];
|
|
198
329
|
|
|
199
330
|
const config = { ...DEFAULT_CONFIGURATION };
|
|
200
331
|
|
|
@@ -203,20 +334,43 @@
|
|
|
203
334
|
}
|
|
204
335
|
|
|
205
336
|
function getChunkSize(config) {
|
|
206
|
-
return
|
|
337
|
+
return normalizeChunkSize(config.chunkSize);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function normalizeChunkSize(chunkSize) {
|
|
341
|
+
chunkSize = toNumber(chunkSize);
|
|
342
|
+
return Number.isInteger(chunkSize) && chunkSize >= MINIMUM_PROPERTY_VALUE ? Math.max(chunkSize, MINIMUM_CHUNK_SIZE) : DEFAULT_CHUNK_SIZE$1;
|
|
207
343
|
}
|
|
208
344
|
|
|
209
345
|
function configure(configuration) {
|
|
210
|
-
|
|
346
|
+
Object.assign(config, checkConfiguration(normalizeConfiguration(configuration)));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function checkConfiguration(configuration) {
|
|
350
|
+
const checkedConfiguration = {};
|
|
211
351
|
for (const propertyName of CONFIGURABLE_PROPERTY_NAMES) {
|
|
212
352
|
const propertyValue = configuration[propertyName];
|
|
213
353
|
if (propertyValue !== UNDEFINED_VALUE) {
|
|
214
|
-
|
|
354
|
+
checkedConfiguration[propertyName] = checkPropertyValue(propertyName, propertyValue);
|
|
215
355
|
}
|
|
216
356
|
}
|
|
357
|
+
return checkedConfiguration;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function checkPropertyValue(propertyName, propertyValue) {
|
|
361
|
+
if (NUMBER_PROPERTY_NAMES.includes(propertyName)) {
|
|
362
|
+
propertyValue = toNumber(propertyValue);
|
|
363
|
+
if (propertyName == PROPERTY_NAME_MAX_WORKERS && (!Number.isInteger(propertyValue) || propertyValue < MINIMUM_PROPERTY_VALUE)) {
|
|
364
|
+
throw new Error(ERR_INVALID_MAX_WORKERS);
|
|
365
|
+
}
|
|
366
|
+
} else if (FUNCTION_PROPERTY_NAMES.includes(propertyName)) {
|
|
367
|
+
checkFunctionOption(propertyValue);
|
|
368
|
+
}
|
|
369
|
+
return propertyValue;
|
|
217
370
|
}
|
|
218
371
|
|
|
219
372
|
function normalizeConfiguration(configuration) {
|
|
373
|
+
configuration = configuration || {};
|
|
220
374
|
const { CompressionStreamZlib, DecompressionStreamZlib } = configuration;
|
|
221
375
|
if (CompressionStreamZlib === UNDEFINED_VALUE && DecompressionStreamZlib === UNDEFINED_VALUE) {
|
|
222
376
|
return configuration;
|
|
@@ -232,14 +386,9 @@
|
|
|
232
386
|
}
|
|
233
387
|
|
|
234
388
|
function setDefaultConfiguration(configuration) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (propertyValue !== UNDEFINED_VALUE) {
|
|
239
|
-
DEFAULT_CONFIGURATION[propertyName] = propertyValue;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
configure(configuration);
|
|
389
|
+
const checkedConfiguration = checkConfiguration(normalizeConfiguration(configuration));
|
|
390
|
+
Object.assign(DEFAULT_CONFIGURATION, checkedConfiguration);
|
|
391
|
+
Object.assign(config, checkedConfiguration);
|
|
243
392
|
}
|
|
244
393
|
|
|
245
394
|
function resetConfiguration() {
|
|
@@ -249,7 +398,7 @@
|
|
|
249
398
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
250
399
|
}
|
|
251
400
|
|
|
252
|
-
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:l,Promise:w,TextEncoder:u,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;C[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=C[e-1][t];C[e][t]=n>>>8^C[0][255&n]}const[A,I,x,M,P,D,F,B]=C;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let s=0;if(n>=8&&t.buffer){const r=new l(t.buffer,t.byteOffset,n),o=n-8;for(;o>=s;s+=8){const t=e^r.getInt32(s,!0),n=r.getInt32(s+4,!0);e=B[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&n]^x[n>>>8&255]^I[n>>>16&255]^A[n>>>24&255]}}for(;n>s;s++)e=e>>>8^A[255&(e^t[s])];this.o=e}get(){return~this.o}}class U extends d{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function W(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function _(t){return new l(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=T.l(n);return 32===s?t.concat(e):T.h(e,s,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+T.l(n)},m(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=T.S(e,t[n-1]&2147483648>>e-1,1)),t},S:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(e+o&31,e+o>32?n:s.pop(),1)),s}},V={bytes:{v(t){const e=T.bitLength(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},C(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(T.S(8*(3&n),s)),e}}},K=class{constructor(t){const e=this;e.blockSize=512,e.A=[1732584193,4023233417,2562383102,271733878,3285377520],e.I=[1518500249,1859775393,2400959708,3395469782],t?(e.M=t.M.slice(0),e.P=t.P.slice(0),e.D=t.D):e.reset()}reset(){const t=this;return t.M=t.A.slice(0),t.P=[],t.D=0,t}update(t){const e=this;"string"==typeof t&&(t=V.F.C(t));const n=e.P=T.concat(e.P,t),s=e.D,o=e.D=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.B(c.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}R(){const t=this;let e=t.P;const n=t.M;e=T.concat(e,[T.S(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.D/4294967296)),e.push(0|t.D);e.length;)t.B(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}W(t,e){return e<<t|e>>>32-t}B(e){const n=this,r=n.M,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=r[0],i=r[1],a=r[2],f=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.W(5,c)+n.U(t,i,a,f)+l+o[t]+n.I[s.floor(t/20)]|0;l=f,f=a,a=n.W(30,i),i=c,c=e}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+l|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,w;const u=new ArrayBuffer(o),h=new l(u);let p=0;const d=T;for(e=V.bytes.C(e),w=1;(o||1)>p;w++){for(c=i=t.encrypt(d.concat(e,[w])),a=1;n>a;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;(o||1)>p&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return u.slice(0,s/8)},_:class{constructor(t){const e=this,n=e.V=K,s=[[],[]];e.K=[new n,new n];const r=e.K[0].blockSize/32;t.length>r&&(t=(new n).update(t).R());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.K[0].update(s[0]),e.K[1].update(s[1]),e.L=new n(e.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,e=t.L.R(),n=new t.V(t.K[1]).update(e).R();return t.reset(),n}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=e.assign({hash:{name:"HMAC"}},J),X=e.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,et=[0,0,0,0],nt=typeof h!=b,st=nt&&h.subtle,rt=nt&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const e=this;e.j=[[[],[],[],[],[]],[[],[],[],[],[]]],e.j[0][0][0]||e.H();const n=e.j[0][4],s=e.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.I=[i=t.slice(0),a=[]],c=o;4*o+28>c;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const e=i[3&t?c:c-4];a[t]=4>=c||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],e=this.j[1],n=t[4],s=e[4],r=[],o=[];let c,i,a,f;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=c=0;!n[l];l^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,f=r[a=r[i=r[l]]];let w=16843009*f^65537*a^257*i^16843008*l,u=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=u=u<<24^u>>>8,e[n][o]=w=w<<24^w>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}N(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.I[e],s=n.length/4-2,o=[0,0,0,0],c=this.j[e],i=c[0],a=c[1],f=c[2],l=c[3],w=c[4];let u,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],S=t[e?1:3]^n[3],g=4;for(let t=0;s>t;t++)u=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^l[255&S]^n[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^l[255&d]^n[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^l[255&y]^n[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^l[255&m]^n[g+3],g+=4,d=u,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=w[d>>>24]<<24^w[y>>16&255]<<16^w[m>>8&255]<<8^w[255&S]^n[g++],u=d,d=y,y=m,m=S,S=u;return o}},it=class{constructor(t,e){this.G=t,this.J=e,this.X=e}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,e,n){let s;if(!(s=e.length))return[];const r=T.bitLength(e);for(let r=0;s>r;r+=4){this.$(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return T.m(e,r)}},at=E._;let ft=nt&&rt&&typeof st.importKey==k,lt=nt&&rt&&typeof st.deriveBits==k;class wt extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:i,et:a,ready:f}=n;c?(await(async(t,e,n,s)=>{const o=await dt(t,e,n,mt(s,0,Z[e])),c=mt(s,Z[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)})(n,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?e.error(new r(N)):a()):await f;const l=new o(t.length-tt-(t.length-tt)%G);e.enqueue(pt(n,t,l,0,tt,!0))},async flush(t){const{nt:e,st:n,pending:s,ready:o}=this;if(n&&e){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);n.update(t);const s=e.update(t);f=St(ot,s)}const l=mt(St(ot,n.digest()),0,tt);let w=s.length<tt?1:0;for(let t=0;tt>t;t++)w|=l[t]^a[t];if(w&&c)throw new r(H);t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:r,et:c,ready:i}=n;let a=z;s?(a=await(async(t,e,n)=>{const s=q(new o(Z[e]));return W(s,await dt(t,e,n,s))})(n,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),e.enqueue(pt(n,t,f,a.length,0))},async flush(t){const{nt:e,st:n,pending:s,ready:r}=this;if(n&&e){await r;let o=z;if(s.length){const t=e.update(gt(ot,s));n.update(t),o=St(ot,t)}const c=St(ot,n.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,n,s,r){e.assign(t,{ready:new w(e=>t.et=e),password:yt(n,s),strength:r-1,pending:z})}function pt(t,e,n,s,r,c){const{nt:i,st:a,pending:f}=t;f.length&&(e=W(f,e));const l=e.length-r;let w;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,s+(l-l%G)),w=0;l-G>=w;w+=G){const t=gt(ot,mt(e,w,w+G));c&&a.update(t);const r=i.update(t);c||a.update(r),n.set(St(ot,r),w+s)}return t.pending=mt(e,w),n}async function dt(n,s,r,c){n.password=null;const i=await(async(t,e,n,s,r)=>{if(!ft)return E.importKey(e);try{return await st.importKey("raw",e,n,!1,r)}catch{return ft=!1,E.importKey(e)}})(0,r,Q,0,Y),a=await(async(t,e,n)=>{if(!lt)return E.T(e,t.salt,X.iterations,n);try{return await st.deriveBits(t,e,n)}catch{return lt=!1,E.T(e,t.salt,X.iterations,n)}})(e.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),l=gt(ot,mt(f,0,$[s])),w=gt(ot,mt(f,$[s],2*$[s])),u=mt(f,2*$[s]);return e.assign(n,{keys:{key:l,ot:w,passwordVerification:u},nt:new it(new ct(l),t.from(et)),st:new at(w)}),u}function yt(t,e){return e===v?(t=>{if(typeof u==b){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new u).encode(t)})(t):e}function mt(t,e,n){return t.subarray(e,n)}function St(t,e){return t.v(e)}function gt(t,e){return t.C(e)}class vt extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=zt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new r(O);t=t.subarray(12)}s?e.error(new r(N)):e.enqueue(zt(n,t))}})}}class bt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;let s,r;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=q(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(Ct(n,e),0),r=12}else s=new o(t.length),r=0;s.set(Ct(n,t),r),e.enqueue(s)}})}}function kt(t,n,s,r){e.assign(t,{password:n,rawPassword:s,passwordVerification:r}),((t,n,s)=>{const r=[305419896,591751049,878082192];if(e.assign(t,{keys:r,ct:new R(r[0]),it:new R(r[2])}),s)for(let e=0;e<s.length;e++)At(t,s[e]);else for(let e=0;e<n.length;e++)At(t,n.charCodeAt(e))})(t,n,s)}function zt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,n[s]);return n}function Ct(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=It(t)^e[s],At(t,e[s]);return n}function At(t,e){let[,n]=t.keys;t.ct.append([e]);const r=~t.ct.get();n=Mt(s.imul(Mt(n+xt(r)),134775813)+1),t.it.append([n>>>24]);const o=~t.it.get();t.keys=[r,n,o]}function It(t){const e=2|t.keys[2];return xt(s.imul(e,1^e)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}const Pt=new f;function Dt(t){return Pt.get(t)}const Ft="Invalid uncompressed size",Bt=j,Rt="deflate-raw",Ut="gzip",Wt=[31,139,8];class _t extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:u,compressionMethod:h}=t,p=this;let d,y,m,S=super.readable;const g=u&&Dt(u),v=a&&r&&!w&&!g&&(!o||i)&&!(!c||!s);if(o&&!i||!a||v||(d=new U,S=jt(S,d)),r)if(g)S=Ht(S,Lt(g.CompressionStream,u,{level:f,chunkSize:e,compressionMethod:h}));else if(v)m=new Tt,S=Ht(S,new s(Ut)),S=jt(S,m);else try{S=Ot(S,c,{level:f,chunkSize:e},s,n)}catch(t){let e;try{e=new s(Ut)}catch{throw t}S=Ht(S,e),S=jt(S,new Tt)}o&&(i?S=jt(S,new bt(t)):(y=new ut(t),S=jt(S,y))),Et(p,S,()=>{o&&!i||!a||(p.crc32=v?m.crc32:new l(d.value.buffer).getUint32(0))})}}class Tt extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,r){if(e){const n=s.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=W(n,t));const c=o-8,i=s.min(c,n.length);r.enqueue(W(n.subarray(0,i),t.subarray(0,c-i))),n=W(n.subarray(i),t.subarray(c-i))},flush(){const e=_(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Vt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:u,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=jt(C,new vt(t)):(z=new wt(t),C=jt(C,z))),u){const t=m&&Dt(m);if(t)C=Ht(C,Lt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Ot(C,h,{chunkSize:e,deflate64:p},s,n)}catch(t){if(p||b===v)throw t;let e;try{e=new s(Ut)}catch{throw t}C=((t,e,n)=>{const s=new R;let c,i,a,f=0,l=!1;const u=new w((t,e)=>{i=t,a=e});u.catch(()=>{}),n||i();const h=new d({start(t){const e=new o(10);e.set(Wt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){l=!0,y();try{await u}finally{m()}const e=new o(8),r=_(e);r.setUint32(0,s.get(),!0),r.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),p=new d({transform(t,e){s.append(t),f+=t.length,n>f?l&&y():i(),e.enqueue(t)},cancel(t){a(t)}});return t=jt(t,h),jt(t=Ht(t,e),p);function y(){m(),c=setTimeout(()=>a(new r(Ft)),5e3)}function m(){clearTimeout(c)}})(C,e,b)}C=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new r("Invalid compressed data");throw e.cause=t,e}const{value:s,done:o}=n;o?t.close():t.enqueue(s)},cancel:t=>e.cancel(t)})})(C)}a&&(k=new U,C=jt(C,k)),Et(this,C,()=>{if(a){const t=new l(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Bt)}})}}const Kt=new f;function Et(t,n,s){n=jt(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function Lt(t,e,n){if(!t)throw new r("Compression method not supported");return new t(e,n)}function Ot(t,e,n,s,r){const o=e&&s?s:r||s,c=n.deflate64?"deflate64-raw":Rt;let i;try{i=new o(c,n)}catch(t){if(!e||!r||o==r)throw t;i=new r(c,n)}return Ht(t,i)}function jt(t,e){return(t=>{if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:s}=await e.read();s?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(t).pipeThrough(e)}function Ht(t,e){const n=e.writable.getWriter(),s=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await s.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(s,t)}})(),e.readable}const Nt="data",qt="close",Gt="deflate";class Jt extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Gt)?c=_t:o.startsWith("inflate")&&(c=Vt),s.outputSize=0;let i=0;const a=new c(t,n),f=super.readable,l=new d({transform(t,e){t&&t.length&&(i+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:i})}}),w=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Ft)},flush(){const{crc32:t}=a;e.assign(s,{crc32:t,inputSize:i})}});e.defineProperty(s,"readable",{get:()=>f.pipeThrough(l).pipeThrough(a).pipeThrough(w)})}}class Qt extends d{constructor(t){const e=[];let s=0;function r(){const n=new o(t);let r=0;for(;t>r;){const s=e[0],o=t-r;s.length>o?(n.set(s.subarray(0,o),r),e[0]=s.subarray(o),r+=o):(n.set(s,r),r+=s.length,e.shift())}return s-=t,n}n.isFinite(t)&&t>=1||(t=65536),super({transform(n,o){for(e.push(n),s+=n.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(((t,e)=>{const n=new o(e);let s=0;for(const e of t)n.set(e,s),s+=e.length;return n})(e,s))}})}}let Xt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Xt=navigator.hardwareConcurrency)}catch{}const Yt=new f,Zt=new f;let $t,te,ee,ne,se,re,oe=0;async function ce(t){let e,o;try{const{options:c,config:i}=t;if(c.format)try{await(async(t,e)=>{!Pt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:s}=e;if(typeof n!=k&&typeof s!=k)throw new r("Invalid codec module");Pt.set(t,{CompressionStream:n,DecompressionStream:s})})(t,await(import(e)))})(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Kt.get(t);n||(n=new f,Kt.set(t,n));let s=n.get(e);if(s===v){try{new t(e),s=!0}catch{s=!1}n.set(e,s)}return s})(c.codecType.startsWith(Gt)?i.CompressionStream:i.DecompressionStream,Rt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},l=t.readable||new y({async pull(t){const e=new w(t=>Yt.set(oe,t));ie({type:"pull",messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},a);o=t.writable||new m({async write(t){let e;const s=new w(t=>e=t);Zt.set(oe,e),ie({type:Nt,value:t,messageId:oe}),oe=(oe+1)%n.MAX_SAFE_INTEGER,await s}},a),e=new Jt(c,i),$t=new AbortController;const{signal:u}=$t;await l.pipeThrough(e).pipeThrough(new Qt((t=>s.max(t.chunkSize,64))(i))).pipeTo(o,{signal:u,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=e;ie({type:qt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=e?e.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}ae(t)}}function ie(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function ae(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:e,stack:n,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}function fe(t,e,n={}){if(!te){const t=new r("WASM module not loaded");throw t.cause=re,t}const c="number"==typeof n.level?n.level:-1,i="number"==typeof n.outBuffer?n.outBuffer:65536,a="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new d({start(){try{let n;if(this.ft=ee(i),this.in=ee(a),this.inBufferSize=a,!this.ft||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=te.deflate_process,this.ut=te.deflate_last_consumed,this.ht=te.deflate_end,this.yt=te.deflate_new(),n="gzip"===e?te.deflate_init_gzip(this.yt,c):"deflate-raw"===e?te.deflate_init_raw(this.yt,c):te.deflate_init(this.yt,c)):"deflate64-raw"===e?(this.wt=te.inflate9_process,this.ut=te.inflate9_last_consumed,this.ht=te.inflate9_end,this.yt=te.inflate9_new(),n=te.inflate9_init_raw(this.yt)):(this.wt=te.inflate_process,this.ut=te.inflate_last_consumed,this.ht=te.inflate_end,this.yt=te.inflate_new(),n="deflate-raw"===e?te.inflate_init_raw(this.yt):"gzip"===e?te.inflate_init_gzip(this.yt):te.inflate_init(this.yt)),0!==n)throw new r("init failed:"+n)}catch(t){throw f(this),t}},transform(e,n){try{const c=e,a=new o(se.buffer),f=this.wt,l=this.ut,w=this.ft,u=this.lt;let h=0;for(;h<c.length;){const e=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<e)&&(this.in&&ne&&(ne(this.in),this.in=0),this.in=ee(e),this.inBufferSize=e,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+e),this.in);const o=f(this.yt,this.in,e,w,i,0),p=16777215&o;if(p&&(u.set(a.subarray(w,w+p),0),n.enqueue(u.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=l(this.yt);if(0===d)break;h+=d}}catch(t){f(this),n.error(t)}},flush(e){try{const n=new o(se.buffer),s=this.wt,c=this.ft,a=this.lt;for(;;){const o=s(this.yt,0,0,c,i,4),f=16777215&o,l=o>>24&255;if(!t){const t=128&l?l-256:l;if(0>t)throw new r("process error:"+t)}if(f&&(a.set(n.subarray(c,c+f),0),e.enqueue(a.slice(0,f))),1===l||0===f)break}}catch(t){e.error(t)}finally{const t=f(this);0!==t&&e.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let e=0;return t.yt&&t.ht&&(e=t.ht(t.yt)),t.yt=0,t.in&&ne&&ne(t.in),t.in=0,t.ft&&ne&&ne(t.ft),t.ft=0,e}}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&ce(t),e==Nt){const t=Yt.get(n);Yt.delete(n),t({value:s||new o,done:r})}if("ack"==e){const t=Zt.get(n);Zt.delete(n),t()}e==qt&&$t.abort()}catch(t){ae(t)}}),p({type:"ready"});class le{constructor(t="deflate",e){return fe(!0,t,e)}}class we{constructor(t="deflate",e){return fe(!1,t,e)}}le.St=!0,we.St=!0;let ue=!1;((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),s&&(t.DecompressionStreamFallback=s)}})({CompressionStreamFallback:le,DecompressionStreamFallback:we,init:t=>(async(t,{baseURI:e})=>{if(!ue)try{await(async(t,e)=>{let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(te=t,({malloc:ee,free:ne,memory:se}=te),"function"!=typeof ee||"function"!=typeof ne||!se)throw te=ee=ne=se=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports)})(t,e),ue=!0}catch(t){throw(t=>{re=t})(t),t}})(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+(t=>{let n="";const s=t.length;let r=0;for(;s>r+2;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e[s>>18&63]+e[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+"=";}return n})(s)}});
|
|
401
|
+
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){"use strict";const{Array:t,Object:e,Number:n,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:l,Promise:u,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;C[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=C[e-1][t];C[e][t]=n>>>8^C[0][255&n]}const[I,A,x,M,P,D,F,B]=C;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let s=0;if(n>=8&&t.buffer){const r=new l(t.buffer,t.byteOffset,n),o=n-8;for(;o>=s;s+=8){const t=e^r.getInt32(s,!0),n=r.getInt32(s+4,!0);e=B[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&n]^x[n>>>8&255]^A[n>>>16&255]^I[n>>>24&255]}}for(;n>s;s++)e=e>>>8^I[255&(e^t[s])];this.o=e}get(){return~this.o}}class U extends d{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new l(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function W(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function _(t){return new l(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],s=T.l(n);return 32===s?t.concat(e):T.h(e,s,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+T.l(n)},m(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=T.S(e,t[n-1]&2147483648>>e-1,1)),t},S:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,e,n,s){for(void 0===s&&(s=[]);e>=32;e-=32)s.push(n),n=0;if(0===e)return s.concat(t);for(let r=0;r<t.length;r++)s.push(n|t[r]>>>e),n=t[r]<<32-e;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(e+o&31,e+o>32?n:s.pop(),1)),s}},V={bytes:{v(t){const e=T.bitLength(t)/8,n=new o(e);let s;for(let r=0;e>r;r++)3&r||(s=t[r/4]),n[r]=s>>>24,s<<=8;return n},C(t){const e=[];let n,s=0;for(n=0;n<t.length;n++)s=s<<8|t[n],3&~n||(e.push(s),s=0);return 3&n&&e.push(T.S(8*(3&n),s)),e}}},K=class{constructor(t){const e=this;e.blockSize=512,e.I=[1732584193,4023233417,2562383102,271733878,3285377520],e.A=[1518500249,1859775393,2400959708,3395469782],t?(e.M=t.M.slice(0),e.P=t.P.slice(0),e.D=t.D):e.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.D=0,t}update(t){const e=this;"string"==typeof t&&(t=V.F.C(t));const n=e.P=T.concat(e.P,t),s=e.D,o=e.D=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(n);let a=0;for(let t=e.blockSize+s-(e.blockSize+s&e.blockSize-1);o>=t;t+=e.blockSize)e.B(c.subarray(16*a,16*(a+1))),a+=1;return n.splice(0,16*a),e}R(){const t=this;let e=t.P;const n=t.M;e=T.concat(e,[T.S(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t.D/4294967296)),e.push(0|t.D);e.length;)t.B(e.splice(0,16));return t.reset(),n}U(t,e,n,s){return t>19?t>39?t>59?t>79?void 0:e^n^s:e&n|e&s|n&s:e^n^s:e&n|~e&s}W(t,e){return e<<t|e>>>32-t}B(e){const n=this,r=n.M,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=r[0],i=r[1],a=r[2],f=r[3],l=r[4];for(let t=0;79>=t;t++){16>t||(o[t]=n.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n.W(5,c)+n.U(t,i,a,f)+l+o[t]+n.A[s.floor(t/20)]|0;l=f,f=a,a=n.W(30,i),i=c,c=e}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+l|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,e,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,u;const w=new ArrayBuffer(o),h=new l(w);let p=0;const d=T;for(e=V.bytes.C(e),u=1;(o||1)>p;u++){for(c=i=t.encrypt(d.concat(e,[u])),a=1;n>a;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;(o||1)>p&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const e=this,n=e.V=K,s=[[],[]];e.K=[new n,new n];const r=e.K[0].blockSize/32;t.length>r&&(t=(new n).update(t).R());for(let e=0;r>e;e++)s[0][e]=909522486^t[e],s[1][e]=1549556828^t[e];e.K[0].update(s[0]),e.K[1].update(s[1]),e.L=new n(e.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,e=t.L.R(),n=new t.V(t.K[1]).update(e).R();return t.reset(),n}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="Invalid signature",H=j,N="zipjs-abort-check-password";function q(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const G=16,J={name:"PBKDF2"},Q=e.assign({hash:{name:"HMAC"}},J),X=e.assign({iterations:1e3,hash:{name:"SHA-1"}},J),Y=["deriveBits"],Z=[8,12,16],$=[16,24,32],tt=10,et=[0,0,0,0],nt=typeof h!=b,st=nt&&h.subtle,rt=nt&&typeof st!=b,ot=V.bytes,ct=class{constructor(t){const e=this;e.j=[[[],[],[],[],[]],[[],[],[],[],[]]],e.j[0][0][0]||e.H();const n=e.j[0][4],s=e.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.A=[i=t.slice(0),a=[]],c=o;4*o+28>c;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const e=i[3&t?c:c-4];a[t]=4>=c||4>t?e:s[0][n[e>>>24]]^s[1][n[e>>16&255]]^s[2][n[e>>8&255]]^s[3][n[255&e]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],e=this.j[1],n=t[4],s=e[4],r=[],o=[];let c,i,a,f;for(let t=0;256>t;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let l=c=0;!n[l];l^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[l]=o,s[o]=l,f=r[a=r[i=r[l]]];let u=16843009*f^65537*a^257*i^16843008*l,w=257*r[o]^16843008*o;for(let n=0;4>n;n++)t[n][l]=w=w<<24^w>>>8,e[n][o]=u=u<<24^u>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}N(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.A[e],s=n.length/4-2,o=[0,0,0,0],c=this.j[e],i=c[0],a=c[1],f=c[2],l=c[3],u=c[4];let w,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],S=t[e?1:3]^n[3],g=4;for(let t=0;s>t;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^l[255&S]^n[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^l[255&d]^n[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^l[255&y]^n[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^l[255&m]^n[g+3],g+=4,d=w,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=u[d>>>24]<<24^u[y>>16&255]<<16^u[m>>8&255]<<8^u[255&S]^n[g++],w=d,d=y,y=m,m=S,S=w;return o}},it=class{constructor(t,e){this.G=t,this.J=e,this.X=e}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,e,n){let s;if(!(s=e.length))return[];const r=T.bitLength(e);for(let r=0;s>r;r+=4){this.$(n);const s=t.encrypt(n);e[r]^=s[0],e[r+1]^=s[1],e[r+2]^=s[2],e[r+3]^=s[3]}return T.m(e,r)}},at=E._;let ft=nt&&rt&&typeof st.importKey==k,lt=nt&&rt&&typeof st.deriveBits==k;class ut extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:i,et:a,ready:f}=n;c?(await(async(t,e,n,s)=>{const o=await dt(t,e,n,mt(s,0,Z[e])),c=mt(s,Z[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)})(n,i,c,mt(t,0,Z[i]+2)),t=mt(t,Z[i]+2),s?e.error(new r(N)):a()):await f;const l=new o(t.length-tt-(t.length-tt)%G);e.enqueue(pt(n,t,l,0,tt,!0))},async flush(t){const{nt:e,st:n,ot:s,ready:o}=this;if(n&&e){await o;const i=mt(s,0,s.length-tt),a=mt(s,s.length-tt);let f=z;if(i.length){const t=gt(ot,i);n.update(t);const s=e.update(t);f=St(ot,s)}const l=mt(St(ot,n.digest()),0,tt);let u=s.length<tt?1:0;for(let t=0;tt>t;t++)u|=l[t]^a[t];if(u&&c)throw new r(H);t.enqueue(f)}}})}}class wt extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){ht(this,t,e,n)},async transform(t,e){const n=this,{password:s,strength:r,et:c,ready:i}=n;let a=z;s?(a=await(async(t,e,n)=>{const s=q(new o(Z[e]));return W(s,await dt(t,e,n,s))})(n,r,s),c()):await i;const f=new o(a.length+t.length-t.length%G);f.set(a,0),e.enqueue(pt(n,t,f,a.length,0))},async flush(t){const{nt:e,st:n,ot:s,ready:r}=this;if(n&&e){await r;let o=z;if(s.length){const t=e.update(gt(ot,s));n.update(t),o=St(ot,t)}const c=St(ot,n.digest()).slice(0,tt);t.enqueue(W(o,c))}}})}}function ht(t,n,s,r){e.assign(t,{ready:new u(e=>t.et=e),password:yt(n,s),strength:r-1,ot:z})}function pt(t,e,n,s,r,c){const{nt:i,st:a,ot:f}=t;f.length&&(e=W(f,e));const l=e.length-r;let u;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,s+(l-l%G)),u=0;l-G>=u;u+=G){const t=gt(ot,mt(e,u,u+G));c&&a.update(t);const r=i.update(t);c||a.update(r),n.set(St(ot,r),u+s)}return t.ot=mt(e,u),n}async function dt(n,s,r,c){n.password=null;const i=await(async(t,e,n,s,r)=>{if(!ft)return E.importKey(e);try{return await st.importKey("raw",e,n,!1,r)}catch{return ft=!1,E.importKey(e)}})(0,r,Q,0,Y),a=await(async(t,e,n)=>{if(!lt)return E.T(e,t.salt,X.iterations,n);try{return await st.deriveBits(t,e,n)}catch{return lt=!1,E.T(e,t.salt,X.iterations,n)}})(e.assign({salt:c},X),i,8*(2*$[s]+2)),f=new o(a),l=gt(ot,mt(f,0,$[s])),u=gt(ot,mt(f,$[s],2*$[s])),w=mt(f,2*$[s]);return e.assign(n,{keys:{key:l,ct:u,passwordVerification:w},nt:new it(new ct(l),t.from(et)),st:new at(u)}),w}function yt(t,e){return e===v?(t=>{if(typeof w==b){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new w).encode(t)})(t):e}function mt(t,e,n){return t.subarray(e,n)}function St(t,e){return t.v(e)}function gt(t,e){return t.C(e)}class vt extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=zt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new r(O);t=t.subarray(12)}s?e.error(new r(N)):e.enqueue(zt(n,t))}})}}class bt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){kt(this,t,e,n)},transform(t,e){const n=this;let s,r;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=q(new o(12));e[11]=n.passwordVerification,s=new o(t.length+e.length),s.set(Ct(n,e),0),r=12}else s=new o(t.length),r=0;s.set(Ct(n,t),r),e.enqueue(s)}})}}function kt(t,n,s,r){e.assign(t,{password:n,rawPassword:s,passwordVerification:r}),((t,n,s)=>{const r=[305419896,591751049,878082192];if(e.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let e=0;e<s.length;e++)It(t,s[e]);else for(let e=0;e<n.length;e++)It(t,n.charCodeAt(e))})(t,n,s)}function zt(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=At(t)^e[s],It(t,n[s]);return n}function Ct(t,e){const n=new o(e.length);for(let s=0;s<e.length;s++)n[s]=At(t)^e[s],It(t,e[s]);return n}function It(t,e){let[,n]=t.keys;t.it.append([e]);const r=~t.it.get();n=Mt(s.imul(Mt(n+xt(r)),134775813)+1),t.ft.append([n>>>24]);const o=~t.ft.get();t.keys=[r,n,o]}function At(t){const e=2|t.keys[2];return xt(s.imul(e,1^e)>>>8)}function xt(t){return 255&t}function Mt(t){return 4294967295&t}function Pt(t){if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:s}=await e.read();s?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})}const Dt=new f;function Ft(t){return Dt.get(t)}const Bt="Invalid uncompressed size",Rt=j,Ut="deflate-raw",Wt="gzip",_t=[31,139,8];class Tt extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:u,format:w,compressionMethod:h}=t,p=this;let d,y,m,S=super.readable;const g=w&&Ft(w),v=a&&r&&!u&&!g&&(!o||i)&&!(!c||!s);if(o&&!i||!a||v||(d=new U,S=Ht(S,d)),r)if(g)S=Nt(S,Ot(g.CompressionStream,w,{level:f,chunkSize:e,compressionMethod:h}));else if(v)m=new Vt,S=Nt(S,new s(Wt)),S=Ht(S,m);else try{S=jt(S,c,{level:f,chunkSize:e},s,n)}catch(t){let e;try{e=new s(Wt)}catch{throw t}S=Nt(S,e),S=Ht(S,new Vt)}o&&(i?S=Ht(S,new bt(t)):(y=new wt(t),S=Ht(S,y))),Lt(p,S,()=>{o&&!i||!a||(p.crc32=v?m.crc32:new l(d.value.buffer).getUint32(0))})}}class Vt extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,r){if(e){const n=s.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=W(n,t));const c=o-8,i=s.min(c,n.length);r.enqueue(W(n.subarray(0,i),t.subarray(0,c-i))),n=W(n.subarray(i),t.subarray(c-i))},flush(){const e=_(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Ht(C,new vt(t)):(z=new ut(t),C=Ht(C,z))),w){const t=m&&Ft(m);if(t)C=Nt(C,Ot(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=jt(C,h,{chunkSize:e,deflate64:p},s,n)}catch(t){if(p||b===v)throw t;let e;try{e=new s(Wt)}catch{throw t}C=((t,e,n)=>{const s=new R;let c,i,a,f=0,l=!1;const w=new u((t,e)=>{i=t,a=e});w.catch(()=>{}),n||i();const h=new d({start(t){const e=new o(10);e.set(_t),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){l=!0,y();try{await w}finally{m()}const e=new o(8),r=_(e);r.setUint32(0,s.get(),!0),r.setUint32(4,n,!0),t.enqueue(e)},cancel(t){a(t)}}),p=new d({transform(t,e){s.append(t),f+=t.length,n>f?l&&y():i(),e.enqueue(t)},cancel(t){a(t)}});return t=Ht(t,h),Ht(t=Nt(t,e),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}})(C,e,b)}C=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new r("Invalid compressed data");throw e.cause=t,e}const{value:s,done:o}=n;o?t.close():t.enqueue(s)},cancel:t=>e.cancel(t)})})(C)}a&&(k=new U,C=Ht(C,k)),Lt(this,C,()=>{if(a){const t=new l(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r(Rt)}})}}const Et=new f;function Lt(t,n,s){n=Ht(n,new d({flush:s})),e.defineProperty(t,"readable",{get:()=>n})}function Ot(t,e,n){if(!t)throw new r("Compression method not supported");return new t(e,n)}function jt(t,e,n,s,r){const o=e&&s?s:r||s,c=n.deflate64?"deflate64-raw":Ut;let i;try{i=new o(c,n)}catch(t){if(!e||!r||o==r)throw t;i=new r(c,n)}return Nt(t,i)}function Ht(t,e){return Pt(t).pipeThrough(e)}function Nt(t,e){const n=e.writable.getWriter(),s=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await s.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(s,t)}})(),e.readable}const qt="data",Gt="close",Jt="deflate";class Qt extends d{constructor(t,n){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Jt)?c=Tt:o.startsWith("inflate")&&(c=Kt),s.outputSize=0;let i=0;const a=new c(t,n),f=super.readable,l=new d({transform(t,e){t&&t.length&&(i+=t.length,e.enqueue(t))},flush(){e.assign(s,{inputSize:i})}}),u=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),s.outputSize+=e.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;e.assign(s,{crc32:t,inputSize:i})}});e.defineProperty(s,"readable",{get:()=>f.pipeThrough(l).pipeThrough(a).pipeThrough(u)})}}class Xt extends d{constructor(t){const e=[];let s=0;function r(){const n=new o(t);let r=0;for(;t>r;){const s=e[0],o=t-r;s.length>o?(n.set(s.subarray(0,o),r),e[0]=s.subarray(o),r+=o):(n.set(s,r),r+=s.length,e.shift())}return s-=t,n}n.isFinite(t)&&t>=1||(t=65536),super({transform(n,o){for(e.push(n),s+=n.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(((t,e)=>{const n=new o(e);let s=0;for(const e of t)n.set(e,s),s+=e.length;return n})(e,s))}})}}let Yt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Yt=navigator.hardwareConcurrency)}catch{}const Zt=new f,$t=new f;let te,ee,ne,se,re,oe,ce=0;async function ie(t){let e,o;try{const{options:c,config:i}=t;if(c.format)try{await(async(t,e)=>{!Dt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:s}=e;if(typeof n!=k&&typeof s!=k)throw new r("Invalid codec module");Dt.set(t,{CompressionStream:n,DecompressionStream:s})})(t,await(import(e)))})(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Et.get(t);n||(n=new f,Et.set(t,n));let s=n.get(e);if(s===v){try{new t(e),s=!0}catch{s=!1}n.set(e,s)}return s})(c.codecType.startsWith(Jt)?i.CompressionStream:i.DecompressionStream,Ut))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},l=t.readable?Pt(t.readable):new y({async pull(t){const e=new u(t=>Zt.set(ce,t));ae({type:"pull",messageId:ce}),ce=(ce+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await e;t.enqueue(s),r&&t.close()}},a);o=t.writable?(t=>{if(t instanceof m)return t;const e=t.getWriter();return new m({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})})(t.writable):new m({async write(t){let e;const s=new u(t=>e=t);$t.set(ce,e),ae({type:qt,value:t,messageId:ce}),ce=(ce+1)%n.MAX_SAFE_INTEGER,await s}},a),e=new Qt(c,i),te=new AbortController;const{signal:w}=te;await l.pipeThrough(e).pipeThrough(new Xt((t=>{return r="string"==typeof(e=r=t.chunkSize)&&e.trim()?n(e):e,n.isInteger(r)&&r>=1?s.max(r,64):65536;var e,r})(i))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=e;ae({type:Gt,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=e?e.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}fe(t)}}function ae(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function fe(t=new r("Unknown error")){const{message:e,stack:n,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:e,stack:n,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}function le(t,e,n={}){if(!ee){const t=new r("WASM module not loaded");throw t.cause=oe,t}const c="number"==typeof n.level?n.level:-1,i="number"==typeof n.outBuffer?n.outBuffer:65536,a="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new d({start(){try{let n;if(this.lt=ne(i),this.in=ne(a),this.inBufferSize=a,!this.lt||!this.in)throw new r("allocation failed");if(this.ut=new o(i),t?(this.wt=ee.deflate_process,this.ht=ee.deflate_last_consumed,this.yt=ee.deflate_end,this.St=ee.deflate_new(),n="gzip"===e?ee.deflate_init_gzip(this.St,c):"deflate-raw"===e?ee.deflate_init_raw(this.St,c):ee.deflate_init(this.St,c)):"deflate64-raw"===e?(this.wt=ee.inflate9_process,this.ht=ee.inflate9_last_consumed,this.yt=ee.inflate9_end,this.St=ee.inflate9_new(),n=ee.inflate9_init_raw(this.St)):(this.wt=ee.inflate_process,this.ht=ee.inflate_last_consumed,this.yt=ee.inflate_end,this.St=ee.inflate_new(),n="deflate-raw"===e?ee.inflate_init_raw(this.St):"gzip"===e?ee.inflate_init_gzip(this.St):ee.inflate_init(this.St)),0!==n)throw new r("init failed:"+n)}catch(t){throw f(this),t}},transform(e,n){try{const c=e,a=new o(re.buffer),f=this.wt,l=this.ht,u=this.lt,w=this.ut;let h=0;for(;h<c.length;){const e=s.min(c.length-h,32768);if((!this.in||this.inBufferSize<e)&&(this.in&&se&&(se(this.in),this.in=0),this.in=ne(e),this.inBufferSize=e,!this.in))throw new r("allocation failed");a.set(c.subarray(h,h+e),this.in);const o=f(this.St,this.in,e,u,i,0),p=16777215&o;if(p&&(w.set(a.subarray(u,u+p),0),n.enqueue(w.slice(0,p))),!t){const t=o>>24&255,e=128&t?t-256:t;if(0>e)throw new r("process error:"+e)}const d=l(this.St);if(0===d)break;h+=d}}catch(t){f(this),n.error(t)}},flush(e){try{const n=new o(re.buffer),s=this.wt,c=this.lt,a=this.ut;for(;;){const o=s(this.St,0,0,c,i,4),f=16777215&o,l=o>>24&255;if(!t){const t=128&l?l-256:l;if(0>t)throw new r("process error:"+t)}if(f&&(a.set(n.subarray(c,c+f),0),e.enqueue(a.slice(0,f))),1===l||0===f)break}}catch(t){e.error(t)}finally{const t=f(this);0!==t&&e.error(new r("end error:"+t))}},cancel(){f(this)}});function f(t){let e=0;return t.St&&t.yt&&(e=t.yt(t.St)),t.St=0,t.in&&se&&se(t.in),t.in=0,t.lt&&se&&se(t.lt),t.lt=0,e}}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:s,done:r}=t;try{if("start"==e&&ie(t),e==qt){const t=Zt.get(n);Zt.delete(n),t({value:s||new o,done:r})}if("ack"==e){const t=$t.get(n);$t.delete(n),t()}e==Gt&&te.abort()}catch(t){fe(t)}}),p({type:"ready"});class ue{constructor(t="deflate",e){return le(!0,t,e)}}class we{constructor(t="deflate",e){return le(!1,t,e)}}ue.gt=!0,we.gt=!0;let he=!1;((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),s&&(t.DecompressionStreamFallback=s)}})({CompressionStreamFallback:ue,DecompressionStreamFallback:we,init:t=>(async(t,{baseURI:e})=>{if(!he)try{await(async(t,e)=>{let n,s;try{try{s=new URL(t,e)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;n=(t=>{const e=t.split(",")[1],n=atob(e),s=n.length,r=new o(s);for(let t=0;s>t;++t)r[t]=n.charCodeAt(t);return r.buffer})(t)}(t=>{if(ee=t,({malloc:ne,free:se,memory:re}=ee),"function"!=typeof ne||"function"!=typeof se||!re)throw ee=ne=se=re=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports)})(t,e),he=!0}catch(t){throw(t=>{oe=t})(t),t}})(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+(t=>{let n="";const s=t.length;let r=0;for(;s>r+2;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+e[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e[s>>18&63]+e[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e[s>>18&63]+e[s>>12&63]+e[s>>6&63]+"=";}return n})(s)}});
|
|
253
402
|
|
|
254
403
|
/*
|
|
255
404
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -1397,13 +1546,13 @@
|
|
|
1397
1546
|
const {
|
|
1398
1547
|
ctr,
|
|
1399
1548
|
hmac,
|
|
1400
|
-
|
|
1549
|
+
pendingInput,
|
|
1401
1550
|
ready
|
|
1402
1551
|
} = this;
|
|
1403
1552
|
if (hmac && ctr) {
|
|
1404
1553
|
await ready;
|
|
1405
|
-
const chunkToDecrypt = subarray(
|
|
1406
|
-
const originalAuthenticationCode = subarray(
|
|
1554
|
+
const chunkToDecrypt = subarray(pendingInput, 0, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
|
|
1555
|
+
const originalAuthenticationCode = subarray(pendingInput, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
|
|
1407
1556
|
let decryptedChunkArray = EMPTY_UINT8_ARRAY;
|
|
1408
1557
|
if (chunkToDecrypt.length) {
|
|
1409
1558
|
const encryptedChunk = toBits(codecBytes, chunkToDecrypt);
|
|
@@ -1412,7 +1561,7 @@
|
|
|
1412
1561
|
decryptedChunkArray = fromBits(codecBytes, decryptedChunk);
|
|
1413
1562
|
}
|
|
1414
1563
|
const authenticationCode = subarray(fromBits(codecBytes, hmac.digest()), 0, AUTHENTICATION_CODE_LENGTH);
|
|
1415
|
-
let invalidAuthenticationCode =
|
|
1564
|
+
let invalidAuthenticationCode = pendingInput.length < AUTHENTICATION_CODE_LENGTH ? 1 : 0;
|
|
1416
1565
|
for (let indexByte = 0; indexByte < AUTHENTICATION_CODE_LENGTH; indexByte++) {
|
|
1417
1566
|
invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
|
|
1418
1567
|
}
|
|
@@ -1456,14 +1605,14 @@
|
|
|
1456
1605
|
const {
|
|
1457
1606
|
ctr,
|
|
1458
1607
|
hmac,
|
|
1459
|
-
|
|
1608
|
+
pendingInput,
|
|
1460
1609
|
ready
|
|
1461
1610
|
} = this;
|
|
1462
1611
|
if (hmac && ctr) {
|
|
1463
1612
|
await ready;
|
|
1464
1613
|
let encryptedChunkArray = EMPTY_UINT8_ARRAY;
|
|
1465
|
-
if (
|
|
1466
|
-
const encryptedChunk = ctr.update(toBits(codecBytes,
|
|
1614
|
+
if (pendingInput.length) {
|
|
1615
|
+
const encryptedChunk = ctr.update(toBits(codecBytes, pendingInput));
|
|
1467
1616
|
hmac.update(encryptedChunk);
|
|
1468
1617
|
encryptedChunkArray = fromBits(codecBytes, encryptedChunk);
|
|
1469
1618
|
}
|
|
@@ -1480,7 +1629,7 @@
|
|
|
1480
1629
|
ready: new Promise(resolve => aesCrypto.resolveReady = resolve),
|
|
1481
1630
|
password: encodePassword(password, rawPassword),
|
|
1482
1631
|
strength: encryptionStrength - 1,
|
|
1483
|
-
|
|
1632
|
+
pendingInput: EMPTY_UINT8_ARRAY
|
|
1484
1633
|
});
|
|
1485
1634
|
}
|
|
1486
1635
|
|
|
@@ -1488,10 +1637,10 @@
|
|
|
1488
1637
|
const {
|
|
1489
1638
|
ctr,
|
|
1490
1639
|
hmac,
|
|
1491
|
-
|
|
1640
|
+
pendingInput
|
|
1492
1641
|
} = aesCrypto;
|
|
1493
|
-
if (
|
|
1494
|
-
input = concat(
|
|
1642
|
+
if (pendingInput.length) {
|
|
1643
|
+
input = concat(pendingInput, input);
|
|
1495
1644
|
}
|
|
1496
1645
|
const inputLength = input.length - paddingEnd;
|
|
1497
1646
|
output = expand(output, paddingStart + (inputLength - (inputLength % BLOCK_LENGTH)));
|
|
@@ -1507,7 +1656,7 @@
|
|
|
1507
1656
|
}
|
|
1508
1657
|
output.set(fromBits(codecBytes, outputChunk), offset + paddingStart);
|
|
1509
1658
|
}
|
|
1510
|
-
aesCrypto.
|
|
1659
|
+
aesCrypto.pendingInput = subarray(input, offset);
|
|
1511
1660
|
return output;
|
|
1512
1661
|
}
|
|
1513
1662
|
|
|
@@ -2762,6 +2911,7 @@
|
|
|
2762
2911
|
worker,
|
|
2763
2912
|
workerAlive: false,
|
|
2764
2913
|
terminated: false,
|
|
2914
|
+
startupError: null,
|
|
2765
2915
|
interface: {
|
|
2766
2916
|
run: async () => {
|
|
2767
2917
|
try {
|
|
@@ -2789,6 +2939,13 @@
|
|
|
2789
2939
|
}
|
|
2790
2940
|
|
|
2791
2941
|
async function runWebWorker(workerData, config) {
|
|
2942
|
+
if (!workerData.worker) {
|
|
2943
|
+
const { startupError } = workerData;
|
|
2944
|
+
workerData.startupError = null;
|
|
2945
|
+
const error = startupError || new Error(ERR_WORKER_STARTUP_TIMEOUT);
|
|
2946
|
+
error.workerStartupFailed = true;
|
|
2947
|
+
throw error;
|
|
2948
|
+
}
|
|
2792
2949
|
let resolveResult, rejectResult;
|
|
2793
2950
|
const result = new Promise((resolve, reject) => {
|
|
2794
2951
|
resolveResult = resolve;
|
|
@@ -3002,11 +3159,12 @@
|
|
|
3002
3159
|
if (!workerAlive) {
|
|
3003
3160
|
workerData.worker = null;
|
|
3004
3161
|
}
|
|
3162
|
+
let error = event.error || new Error(event.message || ERROR_EVENT_TYPE);
|
|
3163
|
+
if (!workerAlive) {
|
|
3164
|
+
error = Object.assign(new Error(error.message || ERROR_EVENT_TYPE), { workerStartupFailed: true });
|
|
3165
|
+
workerData.startupError = error;
|
|
3166
|
+
}
|
|
3005
3167
|
if (rejectResult) {
|
|
3006
|
-
let error = event.error || new Error(event.message || ERROR_EVENT_TYPE);
|
|
3007
|
-
if (!workerAlive) {
|
|
3008
|
-
error = Object.assign(new Error(error.message || ERROR_EVENT_TYPE), { workerStartupFailed: true });
|
|
3009
|
-
}
|
|
3010
3168
|
rejectResult(error);
|
|
3011
3169
|
if (writer) {
|
|
3012
3170
|
writer.releaseLock();
|
|
@@ -3275,6 +3433,96 @@
|
|
|
3275
3433
|
resetWebWorkerSupport();
|
|
3276
3434
|
}
|
|
3277
3435
|
|
|
3436
|
+
/*
|
|
3437
|
+
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
3438
|
+
|
|
3439
|
+
Redistribution and use in source and binary forms, with or without
|
|
3440
|
+
modification, are permitted provided that the following conditions are met:
|
|
3441
|
+
|
|
3442
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
3443
|
+
this list of conditions and the following disclaimer.
|
|
3444
|
+
|
|
3445
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
3446
|
+
notice, this list of conditions and the following disclaimer in
|
|
3447
|
+
the documentation and/or other materials provided with the distribution.
|
|
3448
|
+
|
|
3449
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
3450
|
+
derived from this software without specific prior written permission.
|
|
3451
|
+
|
|
3452
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
3453
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
3454
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
3455
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
3456
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
3457
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
3458
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
3459
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
3460
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
3461
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3462
|
+
*/
|
|
3463
|
+
|
|
3464
|
+
/* global TextDecoder */
|
|
3465
|
+
|
|
3466
|
+
const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
|
|
3467
|
+
const VALID_CP437 = CP437.length == 256;
|
|
3468
|
+
|
|
3469
|
+
function decodeCP437(stringValue) {
|
|
3470
|
+
if (VALID_CP437) {
|
|
3471
|
+
let result = "";
|
|
3472
|
+
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
|
|
3473
|
+
result += CP437[stringValue[indexCharacter]];
|
|
3474
|
+
}
|
|
3475
|
+
return result;
|
|
3476
|
+
} else {
|
|
3477
|
+
return new TextDecoder().decode(stringValue);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
/*
|
|
3482
|
+
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
3483
|
+
|
|
3484
|
+
Redistribution and use in source and binary forms, with or without
|
|
3485
|
+
modification, are permitted provided that the following conditions are met:
|
|
3486
|
+
|
|
3487
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
3488
|
+
this list of conditions and the following disclaimer.
|
|
3489
|
+
|
|
3490
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
3491
|
+
notice, this list of conditions and the following disclaimer in
|
|
3492
|
+
the documentation and/or other materials provided with the distribution.
|
|
3493
|
+
|
|
3494
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
3495
|
+
derived from this software without specific prior written permission.
|
|
3496
|
+
|
|
3497
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
3498
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
3499
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
3500
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
3501
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
3502
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
3503
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
3504
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
3505
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
3506
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3507
|
+
*/
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+
function decodeText(value, encoding) {
|
|
3511
|
+
return decode(value, encoding, true);
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
function decodeTextRemovingBOM(value, encoding) {
|
|
3515
|
+
return decode(value, encoding, false);
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
function decode(value, encoding, ignoreBOM) {
|
|
3519
|
+
if (encoding && encoding.trim().toLowerCase() == "cp437") {
|
|
3520
|
+
return decodeCP437(value);
|
|
3521
|
+
} else {
|
|
3522
|
+
return new TextDecoder(encoding, { ignoreBOM }).decode(value);
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3278
3526
|
/*
|
|
3279
3527
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3280
3528
|
|
|
@@ -3347,6 +3595,7 @@
|
|
|
3347
3595
|
createReadable({ offset = 0, size, chunkSize = getChunkSize(getConfiguration()) } = {}) {
|
|
3348
3596
|
const reader = this;
|
|
3349
3597
|
let chunkOffset = 0;
|
|
3598
|
+
chunkSize = normalizeChunkSize(chunkSize);
|
|
3350
3599
|
return new ReadableStream({
|
|
3351
3600
|
async pull(controller) {
|
|
3352
3601
|
const dataSize = size === UNDEFINED_VALUE ? chunkSize : Math.min(chunkSize, size - chunkOffset);
|
|
@@ -3354,7 +3603,7 @@
|
|
|
3354
3603
|
if (data.length) {
|
|
3355
3604
|
controller.enqueue(data);
|
|
3356
3605
|
}
|
|
3357
|
-
if ((chunkOffset + chunkSize >= size) || (
|
|
3606
|
+
if ((chunkOffset + chunkSize >= size) || (!data.length && dataSize)) {
|
|
3358
3607
|
controller.close();
|
|
3359
3608
|
} else {
|
|
3360
3609
|
chunkOffset += chunkSize;
|
|
@@ -3434,31 +3683,31 @@
|
|
|
3434
3683
|
Object.assign(this, {
|
|
3435
3684
|
contentType,
|
|
3436
3685
|
data: "data:" + (contentType || "") + ";base64,",
|
|
3437
|
-
|
|
3686
|
+
pendingCharacters: ""
|
|
3438
3687
|
});
|
|
3439
3688
|
}
|
|
3440
3689
|
|
|
3441
3690
|
writeUint8Array(array) {
|
|
3442
3691
|
const writer = this;
|
|
3443
3692
|
let indexArray;
|
|
3444
|
-
let dataString = writer.
|
|
3445
|
-
const delta = writer.
|
|
3446
|
-
writer.
|
|
3693
|
+
let dataString = writer.pendingCharacters;
|
|
3694
|
+
const delta = writer.pendingCharacters.length;
|
|
3695
|
+
writer.pendingCharacters = "";
|
|
3447
3696
|
for (indexArray = 0; indexArray < (Math.floor((delta + array.length) / 3) * 3) - delta; indexArray++) {
|
|
3448
3697
|
dataString += String.fromCharCode(array[indexArray]);
|
|
3449
3698
|
}
|
|
3450
3699
|
for (; indexArray < array.length; indexArray++) {
|
|
3451
|
-
writer.
|
|
3700
|
+
writer.pendingCharacters += String.fromCharCode(array[indexArray]);
|
|
3452
3701
|
}
|
|
3453
3702
|
if (dataString.length > 2) {
|
|
3454
3703
|
writer.data += btoa(dataString);
|
|
3455
3704
|
} else {
|
|
3456
|
-
writer.
|
|
3705
|
+
writer.pendingCharacters = dataString + writer.pendingCharacters;
|
|
3457
3706
|
}
|
|
3458
3707
|
}
|
|
3459
3708
|
|
|
3460
3709
|
getData() {
|
|
3461
|
-
return this.data + btoa(this.
|
|
3710
|
+
return this.data + btoa(this.pendingCharacters);
|
|
3462
3711
|
}
|
|
3463
3712
|
}
|
|
3464
3713
|
|
|
@@ -3488,7 +3737,7 @@
|
|
|
3488
3737
|
constructor(blob) {
|
|
3489
3738
|
super();
|
|
3490
3739
|
Object.assign(this, {
|
|
3491
|
-
blob,
|
|
3740
|
+
sourceBlob: blob,
|
|
3492
3741
|
size: blob.size
|
|
3493
3742
|
});
|
|
3494
3743
|
if (!blobSliceProbe) {
|
|
@@ -3498,13 +3747,13 @@
|
|
|
3498
3747
|
|
|
3499
3748
|
createReadable(options) {
|
|
3500
3749
|
const reader = this;
|
|
3501
|
-
const {
|
|
3750
|
+
const { sourceBlob, size } = reader;
|
|
3502
3751
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3503
3752
|
if (!offset && readSize >= size) {
|
|
3504
|
-
return toCompatibleReadable(
|
|
3753
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3505
3754
|
}
|
|
3506
3755
|
if (blobSliceReliable) {
|
|
3507
|
-
return toCompatibleReadable(
|
|
3756
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3508
3757
|
}
|
|
3509
3758
|
return super.createReadable(options);
|
|
3510
3759
|
}
|
|
@@ -3513,7 +3762,7 @@
|
|
|
3513
3762
|
const reader = this;
|
|
3514
3763
|
const offsetEnd = offset + length;
|
|
3515
3764
|
const readsWholeBlob = !offset && offsetEnd >= reader.size;
|
|
3516
|
-
const blob = readsWholeBlob ? reader.
|
|
3765
|
+
const blob = readsWholeBlob ? reader.sourceBlob : reader.sourceBlob.slice(offset, offsetEnd);
|
|
3517
3766
|
let arrayBuffer = await blob.arrayBuffer();
|
|
3518
3767
|
const sliceIgnoredByBuggyImplementation = arrayBuffer.byteLength > length;
|
|
3519
3768
|
if (sliceIgnoredByBuggyImplementation) {
|
|
@@ -3535,12 +3784,12 @@
|
|
|
3535
3784
|
}
|
|
3536
3785
|
});
|
|
3537
3786
|
writer.contentType = contentType;
|
|
3538
|
-
writer.
|
|
3539
|
-
writer.
|
|
3787
|
+
writer.blobPromise = streamToBlob(transformStream.readable, contentType);
|
|
3788
|
+
writer.blobPromise.catch(() => { });
|
|
3540
3789
|
}
|
|
3541
3790
|
|
|
3542
3791
|
getData() {
|
|
3543
|
-
return this.
|
|
3792
|
+
return this.blobPromise;
|
|
3544
3793
|
}
|
|
3545
3794
|
}
|
|
3546
3795
|
|
|
@@ -3554,7 +3803,7 @@
|
|
|
3554
3803
|
class TextWriter extends BlobWriter {
|
|
3555
3804
|
|
|
3556
3805
|
constructor(encoding) {
|
|
3557
|
-
super(
|
|
3806
|
+
super();
|
|
3558
3807
|
Object.assign(this, {
|
|
3559
3808
|
encoding,
|
|
3560
3809
|
utf8: !encoding || encoding.toLowerCase() == "utf-8"
|
|
@@ -3570,14 +3819,7 @@
|
|
|
3570
3819
|
if (blob.text && utf8) {
|
|
3571
3820
|
return blob.text();
|
|
3572
3821
|
} else {
|
|
3573
|
-
|
|
3574
|
-
return new Promise((resolve, reject) => {
|
|
3575
|
-
Object.assign(reader, {
|
|
3576
|
-
onload: ({ target }) => resolve(target.result),
|
|
3577
|
-
onerror: () => reject(reader.error)
|
|
3578
|
-
});
|
|
3579
|
-
reader.readAsText(blob, encoding);
|
|
3580
|
-
});
|
|
3822
|
+
return decodeTextRemovingBOM(new Uint8Array(await blob.arrayBuffer()), encoding);
|
|
3581
3823
|
}
|
|
3582
3824
|
}
|
|
3583
3825
|
}
|
|
@@ -4035,9 +4277,8 @@
|
|
|
4035
4277
|
|
|
4036
4278
|
async init() {
|
|
4037
4279
|
const reader = this;
|
|
4038
|
-
const { readers } = reader;
|
|
4039
4280
|
reader.lastDiskNumber = 0;
|
|
4040
|
-
await Promise.all(readers.map(
|
|
4281
|
+
const readers = reader.readers = await Promise.all(reader.readers.map(initDiskReader));
|
|
4041
4282
|
reader.diskOffsets = readers.map(diskReader => {
|
|
4042
4283
|
const diskOffset = reader.size;
|
|
4043
4284
|
reader.size += diskReader.size;
|
|
@@ -4232,89 +4473,27 @@
|
|
|
4232
4473
|
}
|
|
4233
4474
|
}
|
|
4234
4475
|
|
|
4235
|
-
function
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
Redistribution and use in source and binary forms, with or without
|
|
4243
|
-
modification, are permitted provided that the following conditions are met:
|
|
4244
|
-
|
|
4245
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
4246
|
-
this list of conditions and the following disclaimer.
|
|
4247
|
-
|
|
4248
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
4249
|
-
notice, this list of conditions and the following disclaimer in
|
|
4250
|
-
the documentation and/or other materials provided with the distribution.
|
|
4251
|
-
|
|
4252
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
4253
|
-
derived from this software without specific prior written permission.
|
|
4254
|
-
|
|
4255
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4256
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
4257
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4258
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4259
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
4260
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
4261
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
4262
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
4263
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
4264
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4265
|
-
*/
|
|
4266
|
-
|
|
4267
|
-
/* global TextDecoder */
|
|
4268
|
-
|
|
4269
|
-
const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
|
|
4270
|
-
const VALID_CP437 = CP437.length == 256;
|
|
4271
|
-
|
|
4272
|
-
function decodeCP437(stringValue) {
|
|
4273
|
-
if (VALID_CP437) {
|
|
4274
|
-
let result = "";
|
|
4275
|
-
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
|
|
4276
|
-
result += CP437[stringValue[indexCharacter]];
|
|
4277
|
-
}
|
|
4278
|
-
return result;
|
|
4279
|
-
} else {
|
|
4280
|
-
return new TextDecoder().decode(stringValue);
|
|
4476
|
+
async function initDiskReader(diskReader) {
|
|
4477
|
+
diskReader = new GenericReader(diskReader);
|
|
4478
|
+
await initStream(diskReader);
|
|
4479
|
+
if (diskReader.size === UNDEFINED_VALUE || !diskReader.readUint8Array) {
|
|
4480
|
+
diskReader = new BlobReader(await streamToBlob(diskReader.readable));
|
|
4481
|
+
await initStream(diskReader);
|
|
4281
4482
|
}
|
|
4483
|
+
return diskReader;
|
|
4282
4484
|
}
|
|
4283
4485
|
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
Redistribution and use in source and binary forms, with or without
|
|
4288
|
-
modification, are permitted provided that the following conditions are met:
|
|
4289
|
-
|
|
4290
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
4291
|
-
this list of conditions and the following disclaimer.
|
|
4292
|
-
|
|
4293
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
4294
|
-
notice, this list of conditions and the following disclaimer in
|
|
4295
|
-
the documentation and/or other materials provided with the distribution.
|
|
4296
|
-
|
|
4297
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
4298
|
-
derived from this software without specific prior written permission.
|
|
4299
|
-
|
|
4300
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4301
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
4302
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4303
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4304
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
4305
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
4306
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
4307
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
4308
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
4309
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4310
|
-
*/
|
|
4311
|
-
|
|
4486
|
+
function readUint8Array(reader, offset, size) {
|
|
4487
|
+
return reader.readUint8Array(offset, size);
|
|
4488
|
+
}
|
|
4312
4489
|
|
|
4313
|
-
function
|
|
4314
|
-
if (
|
|
4315
|
-
return
|
|
4490
|
+
function createReadable(reader, options) {
|
|
4491
|
+
if (reader.createReadable) {
|
|
4492
|
+
return reader.createReadable(options);
|
|
4493
|
+
} else if (reader.readUint8Array) {
|
|
4494
|
+
return Reader.prototype.createReadable.call(reader, options);
|
|
4316
4495
|
} else {
|
|
4317
|
-
return
|
|
4496
|
+
return reader.readable;
|
|
4318
4497
|
}
|
|
4319
4498
|
}
|
|
4320
4499
|
|
|
@@ -4390,6 +4569,10 @@
|
|
|
4390
4569
|
const PROPERTY_NAME_SETGID = "setgid";
|
|
4391
4570
|
const PROPERTY_NAME_STICKY = "sticky";
|
|
4392
4571
|
const PROPERTY_NAME_BITFLAG = "bitFlag";
|
|
4572
|
+
const PROPERTY_NAME_RAW_BITFLAG = "rawBitFlag";
|
|
4573
|
+
const PROPERTY_NAME_FILENAME_LENGTH = "filenameLength";
|
|
4574
|
+
const PROPERTY_NAME_EXTRA_FIELD_LENGTH = "extraFieldLength";
|
|
4575
|
+
const PROPERTY_NAME_UNIX_EXTERNAL_UPPER = "unixExternalUpper";
|
|
4393
4576
|
const PROPERTY_NAME_FILENAME_UTF8 = "filenameUTF8";
|
|
4394
4577
|
const PROPERTY_NAME_COMMENT_UTF8 = "commentUTF8";
|
|
4395
4578
|
const PROPERTY_NAME_RAW_EXTRA_FIELD = "rawExtraField";
|
|
@@ -4442,10 +4625,14 @@
|
|
|
4442
4625
|
PROPERTY_NAME_UID,
|
|
4443
4626
|
PROPERTY_NAME_GID,
|
|
4444
4627
|
PROPERTY_NAME_UNIX_MODE,
|
|
4628
|
+
PROPERTY_NAME_UNIX_EXTERNAL_UPPER,
|
|
4445
4629
|
PROPERTY_NAME_SETUID,
|
|
4446
4630
|
PROPERTY_NAME_SETGID,
|
|
4447
4631
|
PROPERTY_NAME_STICKY,
|
|
4448
4632
|
PROPERTY_NAME_BITFLAG,
|
|
4633
|
+
PROPERTY_NAME_RAW_BITFLAG,
|
|
4634
|
+
PROPERTY_NAME_FILENAME_LENGTH,
|
|
4635
|
+
PROPERTY_NAME_EXTRA_FIELD_LENGTH,
|
|
4449
4636
|
PROPERTY_NAME_FILENAME_UTF8,
|
|
4450
4637
|
PROPERTY_NAME_COMMENT_UTF8,
|
|
4451
4638
|
PROPERTY_NAME_RAW_EXTRA_FIELD,
|
|
@@ -4466,82 +4653,6 @@
|
|
|
4466
4653
|
|
|
4467
4654
|
}
|
|
4468
4655
|
|
|
4469
|
-
/*
|
|
4470
|
-
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
4471
|
-
|
|
4472
|
-
Redistribution and use in source and binary forms, with or without
|
|
4473
|
-
modification, are permitted provided that the following conditions are met:
|
|
4474
|
-
|
|
4475
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
4476
|
-
this list of conditions and the following disclaimer.
|
|
4477
|
-
|
|
4478
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
4479
|
-
notice, this list of conditions and the following disclaimer in
|
|
4480
|
-
the documentation and/or other materials provided with the distribution.
|
|
4481
|
-
|
|
4482
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
4483
|
-
derived from this software without specific prior written permission.
|
|
4484
|
-
|
|
4485
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4486
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
4487
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4488
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4489
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
4490
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
4491
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
4492
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
4493
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
4494
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4495
|
-
*/
|
|
4496
|
-
|
|
4497
|
-
const OPTION_FILENAME_ENCODING = "filenameEncoding";
|
|
4498
|
-
const OPTION_COMMENT_ENCODING = "commentEncoding";
|
|
4499
|
-
const OPTION_DECODE_TEXT = "decodeText";
|
|
4500
|
-
const OPTION_EXTRACT_PREPENDED_DATA = "extractPrependedData";
|
|
4501
|
-
const OPTION_EXTRACT_APPENDED_DATA = "extractAppendedData";
|
|
4502
|
-
const OPTION_PASSWORD = "password";
|
|
4503
|
-
const OPTION_RAW_PASSWORD = "rawPassword";
|
|
4504
|
-
const OPTION_PASS_THROUGH = "passThrough";
|
|
4505
|
-
const OPTION_SIGNAL = "signal";
|
|
4506
|
-
const OPTION_CHECK_PASSWORD_ONLY = "checkPasswordOnly";
|
|
4507
|
-
const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
|
|
4508
|
-
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
4509
|
-
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
4510
|
-
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
4511
|
-
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
4512
|
-
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
4513
|
-
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
4514
|
-
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
4515
|
-
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
4516
|
-
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
4517
|
-
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
4518
|
-
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
4519
|
-
const OPTION_NTFS_TIMESTAMP = "ntfsTimestamp";
|
|
4520
|
-
const OPTION_KEEP_ORDER = "keepOrder";
|
|
4521
|
-
const OPTION_LEVEL = "level";
|
|
4522
|
-
const OPTION_BUFFERED_WRITE = "bufferedWrite";
|
|
4523
|
-
const OPTION_CREATE_TEMP_STREAM = "createTempStream";
|
|
4524
|
-
const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
|
|
4525
|
-
const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
|
|
4526
|
-
const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
|
|
4527
|
-
const OPTION_SUPPORT_ZIP64_SPLIT_FILE = "supportZip64SplitFile";
|
|
4528
|
-
const OPTION_ENCODE_TEXT = "encodeText";
|
|
4529
|
-
const OPTION_OFFSET = "offset";
|
|
4530
|
-
const OPTION_USDZ = "usdz";
|
|
4531
|
-
const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
|
|
4532
|
-
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
4533
|
-
const OPTION_STRICTNESS = "strictness";
|
|
4534
|
-
const OPTION_FILENAME_VALIDATION = "filenameValidation";
|
|
4535
|
-
const OPTION_NORMALIZE_FILENAME = "normalizeFilename";
|
|
4536
|
-
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
4537
|
-
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
4538
|
-
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
4539
|
-
const TEXT_TYPE_FILENAME = "filename";
|
|
4540
|
-
const TEXT_TYPE_COMMENT = "comment";
|
|
4541
|
-
const STRICTNESS_STRICT = "strict";
|
|
4542
|
-
const STRICTNESS_BALANCED = "balanced";
|
|
4543
|
-
const STRICTNESS_TOLERANT = "tolerant";
|
|
4544
|
-
|
|
4545
4656
|
/*
|
|
4546
4657
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
4547
4658
|
|
|
@@ -4582,6 +4693,7 @@
|
|
|
4582
4693
|
const ERR_UNSUPPORTED_COMPRESSION$1 = "Compression method not supported";
|
|
4583
4694
|
const ERR_SPLIT_ZIP_FILE = "Split zip file";
|
|
4584
4695
|
const ERR_OVERLAPPING_ENTRY = "Overlapping entry found";
|
|
4696
|
+
const ERR_ENTRY_DATA_OUT_OF_BOUNDS = "Entry data out of bounds";
|
|
4585
4697
|
const ERR_AMBIGUOUS_ARCHIVE = "Ambiguous archive";
|
|
4586
4698
|
const ERR_ENCRYPTED_CENTRAL_DIRECTORY = "Encrypted central directory is not supported";
|
|
4587
4699
|
const ERR_UNSAFE_FILENAME = "Unsafe filename";
|
|
@@ -4602,7 +4714,7 @@
|
|
|
4602
4714
|
];
|
|
4603
4715
|
const ZIP64_EXTRACTION = {
|
|
4604
4716
|
[MAX_16_BITS]: {
|
|
4605
|
-
getValue: getUint32,
|
|
4717
|
+
getValue: getUint32$1,
|
|
4606
4718
|
bytes: 4
|
|
4607
4719
|
},
|
|
4608
4720
|
[MAX_32_BITS]: {
|
|
@@ -4611,6 +4723,7 @@
|
|
|
4611
4723
|
}
|
|
4612
4724
|
};
|
|
4613
4725
|
const MAX_END_OF_CENTRAL_DIR_PROBES = 64;
|
|
4726
|
+
const MAX_DEFLATE_EXPANSION_RATIO = 1032;
|
|
4614
4727
|
const CENTRAL_DIRECTORY_UNREACHABLE = 0;
|
|
4615
4728
|
const CENTRAL_DIRECTORY_PLAUSIBLE = 1;
|
|
4616
4729
|
const CENTRAL_DIRECTORY_REACHABLE = 2;
|
|
@@ -4621,7 +4734,6 @@
|
|
|
4621
4734
|
Object.assign(this, {
|
|
4622
4735
|
reader: new GenericReader(reader),
|
|
4623
4736
|
options,
|
|
4624
|
-
config: getConfiguration(),
|
|
4625
4737
|
readRanges: new Map()
|
|
4626
4738
|
});
|
|
4627
4739
|
}
|
|
@@ -4629,7 +4741,6 @@
|
|
|
4629
4741
|
async* getEntriesGenerator(options = {}) {
|
|
4630
4742
|
const zipReader = this;
|
|
4631
4743
|
let { reader } = zipReader;
|
|
4632
|
-
const { config } = zipReader;
|
|
4633
4744
|
await initStream(reader);
|
|
4634
4745
|
if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) {
|
|
4635
4746
|
reader = new BlobReader(await streamToBlob(reader.readable));
|
|
@@ -4638,7 +4749,7 @@
|
|
|
4638
4749
|
if (reader.size < END_OF_CENTRAL_DIR_LENGTH) {
|
|
4639
4750
|
throw new Error(ERR_BAD_FORMAT);
|
|
4640
4751
|
}
|
|
4641
|
-
const strictness = getStrictness(
|
|
4752
|
+
const strictness = getStrictness(options, zipReader.options);
|
|
4642
4753
|
const checkAmbiguity = strictness == STRICTNESS_STRICT;
|
|
4643
4754
|
const rejectAmbiguousEndOfDirectory = strictness != STRICTNESS_TOLERANT;
|
|
4644
4755
|
const maxAppendedDataSize = getMaxAppendedDataSize(getOptionValue$1(zipReader, options, OPTION_MAX_APPENDED_DATA_SIZE), strictness);
|
|
@@ -4646,9 +4757,7 @@
|
|
|
4646
4757
|
const normalizeFilename = getOptionValue$1(zipReader, options, OPTION_NORMALIZE_FILENAME);
|
|
4647
4758
|
const { endOfDirectoryInfo, endOfDirectoryReachingEndCount } = await findEndOfCentralDirectory(reader, rejectAmbiguousEndOfDirectory, maxAppendedDataSize);
|
|
4648
4759
|
if (!endOfDirectoryInfo) {
|
|
4649
|
-
|
|
4650
|
-
const signatureView = getDataView(signatureArray);
|
|
4651
|
-
if (getUint32(signatureView) == SPLIT_ZIP_FILE_SIGNATURE) {
|
|
4760
|
+
if (await startsWithSplitZipSignature$1(reader)) {
|
|
4652
4761
|
throw new Error(ERR_SPLIT_ZIP_FILE);
|
|
4653
4762
|
} else {
|
|
4654
4763
|
throw new Error(ERR_EOCDR_NOT_FOUND);
|
|
@@ -4658,18 +4767,18 @@
|
|
|
4658
4767
|
throwAmbiguousArchive("multiple end of central directory records");
|
|
4659
4768
|
}
|
|
4660
4769
|
const endOfDirectoryView = getDataView(endOfDirectoryInfo);
|
|
4661
|
-
let directoryDataLength = getUint32(endOfDirectoryView, 12);
|
|
4662
|
-
let directoryDataOffset = getUint32(endOfDirectoryView, 16);
|
|
4770
|
+
let directoryDataLength = getUint32$1(endOfDirectoryView, 12);
|
|
4771
|
+
let directoryDataOffset = getUint32$1(endOfDirectoryView, 16);
|
|
4663
4772
|
const commentOffset = endOfDirectoryInfo.offset;
|
|
4664
|
-
const commentLength = getUint16(endOfDirectoryView, 20);
|
|
4773
|
+
const commentLength = getUint16$1(endOfDirectoryView, 20);
|
|
4665
4774
|
const appendedDataOffset = commentOffset + END_OF_CENTRAL_DIR_LENGTH + commentLength;
|
|
4666
4775
|
if (reader.size - appendedDataOffset > maxAppendedDataSize) {
|
|
4667
4776
|
throwAmbiguousArchive("appended data");
|
|
4668
4777
|
}
|
|
4669
|
-
let lastDiskNumber = getUint16(endOfDirectoryView, 4);
|
|
4778
|
+
let lastDiskNumber = getUint16$1(endOfDirectoryView, 4);
|
|
4670
4779
|
const expectedLastDiskNumber = reader.lastDiskNumber || 0;
|
|
4671
|
-
let diskNumber = getUint16(endOfDirectoryView, 6);
|
|
4672
|
-
let filesLength = getUint16(endOfDirectoryView, 10);
|
|
4780
|
+
let diskNumber = getUint16$1(endOfDirectoryView, 6);
|
|
4781
|
+
let filesLength = getUint16$1(endOfDirectoryView, 10);
|
|
4673
4782
|
let prependedDataLength = 0;
|
|
4674
4783
|
let startOffset;
|
|
4675
4784
|
let zip64EndOfDirectory;
|
|
@@ -4685,12 +4794,12 @@
|
|
|
4685
4794
|
EMPTY_UINT8_ARRAY;
|
|
4686
4795
|
const endOfDirectoryLocatorView = getDataView(endOfDirectoryLocatorArray);
|
|
4687
4796
|
if (endOfDirectoryLocatorArray.length == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH &&
|
|
4688
|
-
getUint32(endOfDirectoryLocatorView, 0) == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) {
|
|
4689
|
-
directoryDataOffset = getDiskOffset$1(reader, getUint32(endOfDirectoryLocatorView, 4)) + getBigUint64(endOfDirectoryLocatorView, 8);
|
|
4797
|
+
getUint32$1(endOfDirectoryLocatorView, 0) == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) {
|
|
4798
|
+
directoryDataOffset = getDiskOffset$1(reader, getUint32$1(endOfDirectoryLocatorView, 4)) + getBigUint64(endOfDirectoryLocatorView, 8);
|
|
4690
4799
|
let endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4691
4800
|
let endOfDirectoryView = getDataView(endOfDirectoryArray);
|
|
4692
4801
|
const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH - ZIP64_END_OF_CENTRAL_DIR_LENGTH;
|
|
4693
|
-
if ((endOfDirectoryArray.length < ZIP64_END_OF_CENTRAL_DIR_LENGTH || getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) &&
|
|
4802
|
+
if ((endOfDirectoryArray.length < ZIP64_END_OF_CENTRAL_DIR_LENGTH || getUint32$1(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) &&
|
|
4694
4803
|
directoryDataOffset != expectedDirectoryDataOffset && expectedDirectoryDataOffset >= 0) {
|
|
4695
4804
|
const originalDirectoryDataOffset = directoryDataOffset;
|
|
4696
4805
|
directoryDataOffset = expectedDirectoryDataOffset;
|
|
@@ -4700,7 +4809,7 @@
|
|
|
4700
4809
|
endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4701
4810
|
endOfDirectoryView = getDataView(endOfDirectoryArray);
|
|
4702
4811
|
}
|
|
4703
|
-
if (endOfDirectoryArray.length < ZIP64_END_OF_CENTRAL_DIR_LENGTH || getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) {
|
|
4812
|
+
if (endOfDirectoryArray.length < ZIP64_END_OF_CENTRAL_DIR_LENGTH || getUint32$1(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) {
|
|
4704
4813
|
throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);
|
|
4705
4814
|
}
|
|
4706
4815
|
zip64EndOfDirectory = true;
|
|
@@ -4715,13 +4824,13 @@
|
|
|
4715
4824
|
}
|
|
4716
4825
|
}
|
|
4717
4826
|
if (lastDiskNumber == MAX_16_BITS) {
|
|
4718
|
-
lastDiskNumber = getUint32(endOfDirectoryView, 16);
|
|
4719
|
-
} else if (checkAmbiguity && lastDiskNumber != getUint32(endOfDirectoryView, 16)) {
|
|
4827
|
+
lastDiskNumber = getUint32$1(endOfDirectoryView, 16);
|
|
4828
|
+
} else if (checkAmbiguity && lastDiskNumber != getUint32$1(endOfDirectoryView, 16)) {
|
|
4720
4829
|
throwAmbiguousArchive("mismatched zip64 end of central directory record");
|
|
4721
4830
|
}
|
|
4722
4831
|
if (diskNumber == MAX_16_BITS) {
|
|
4723
|
-
diskNumber = getUint32(endOfDirectoryView, 20);
|
|
4724
|
-
} else if (checkAmbiguity && diskNumber != getUint32(endOfDirectoryView, 20)) {
|
|
4832
|
+
diskNumber = getUint32$1(endOfDirectoryView, 20);
|
|
4833
|
+
} else if (checkAmbiguity && diskNumber != getUint32$1(endOfDirectoryView, 20)) {
|
|
4725
4834
|
throwAmbiguousArchive("mismatched zip64 end of central directory record");
|
|
4726
4835
|
}
|
|
4727
4836
|
if (filesLength == MAX_16_BITS) {
|
|
@@ -4759,11 +4868,11 @@
|
|
|
4759
4868
|
}
|
|
4760
4869
|
const expectedDirectoryDataOffset = centralDirectoryEndOffset - directoryDataLength;
|
|
4761
4870
|
if (directoryDataOffset != expectedDirectoryDataOffset && diskNumber == lastDiskNumber) {
|
|
4762
|
-
const storedPointsAtDirectory = getUint32(directoryView, offset) == CENTRAL_FILE_HEADER_SIGNATURE;
|
|
4871
|
+
const storedPointsAtDirectory = getUint32$1(directoryView, offset) == CENTRAL_FILE_HEADER_SIGNATURE;
|
|
4763
4872
|
let reconcile = !storedPointsAtDirectory;
|
|
4764
4873
|
if (!reconcile && expectedDirectoryDataOffset >= 0 && expectedDirectoryDataOffset + 4 <= reader.size) {
|
|
4765
4874
|
const expectedSignatureArray = await readUint8Array(reader, expectedDirectoryDataOffset, 4);
|
|
4766
|
-
reconcile = getUint32(getDataView(expectedSignatureArray), 0) == CENTRAL_FILE_HEADER_SIGNATURE;
|
|
4875
|
+
reconcile = getUint32$1(getDataView(expectedSignatureArray), 0) == CENTRAL_FILE_HEADER_SIGNATURE;
|
|
4767
4876
|
}
|
|
4768
4877
|
if (reconcile) {
|
|
4769
4878
|
const originalDirectoryDataOffset = directoryDataOffset;
|
|
@@ -4787,10 +4896,10 @@
|
|
|
4787
4896
|
}
|
|
4788
4897
|
zipReader.directoryOffset = directoryDataOffset;
|
|
4789
4898
|
zipReader.directoryLength = declaredDirectoryDataLength;
|
|
4790
|
-
const decryptCentralDirectory =
|
|
4899
|
+
const decryptCentralDirectory = getFunctionOptionValue$1(zipReader, options, OPTION_DECRYPT_CENTRAL_DIRECTORY);
|
|
4791
4900
|
let decryptedDirectory;
|
|
4792
4901
|
if (decryptCentralDirectory && filesLength && directoryArray.length >= 4 &&
|
|
4793
|
-
getUint32(directoryView, 0) != CENTRAL_FILE_HEADER_SIGNATURE &&
|
|
4902
|
+
getUint32$1(directoryView, 0) != CENTRAL_FILE_HEADER_SIGNATURE &&
|
|
4794
4903
|
(zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4795
4904
|
directoryArray = await decryptCentralDirectory(directoryArray, directoryEncryptionInfo);
|
|
4796
4905
|
directoryView = getDataView(directoryArray);
|
|
@@ -4803,8 +4912,8 @@
|
|
|
4803
4912
|
const filenames = checkAmbiguity ? new Set() : UNDEFINED_VALUE;
|
|
4804
4913
|
let duplicateFilename;
|
|
4805
4914
|
for (let indexFile = 0; indexFile < filesLength; indexFile++) {
|
|
4806
|
-
const fileEntry = new ZipEntry(reader,
|
|
4807
|
-
if (offset + CENTRAL_FILE_HEADER_LENGTH > directoryArray.length || getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {
|
|
4915
|
+
const fileEntry = new ZipEntry(reader, zipReader.options);
|
|
4916
|
+
if (offset + CENTRAL_FILE_HEADER_LENGTH > directoryArray.length || getUint32$1(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {
|
|
4808
4917
|
if (indexFile == 0 && !decryptedDirectory && (zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4809
4918
|
throw new Error(ERR_ENCRYPTED_CENTRAL_DIRECTORY);
|
|
4810
4919
|
}
|
|
@@ -4815,16 +4924,16 @@
|
|
|
4815
4924
|
const filenameOffset = offset + CENTRAL_FILE_HEADER_LENGTH;
|
|
4816
4925
|
const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
|
|
4817
4926
|
const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
|
|
4818
|
-
const versionMadeBy = getUint16(directoryView, offset + 4);
|
|
4927
|
+
const versionMadeBy = getUint16$1(directoryView, offset + 4);
|
|
4819
4928
|
const msDosCompatible = versionMadeBy >> 8 == 0;
|
|
4820
4929
|
const unixCompatible = versionMadeBy >> 8 == 3;
|
|
4821
4930
|
const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
|
|
4822
|
-
const commentLength = getUint16(directoryView, offset + 32);
|
|
4931
|
+
const commentLength = getUint16$1(directoryView, offset + 32);
|
|
4823
4932
|
const endOffset = commentOffset + commentLength;
|
|
4824
4933
|
const rawComment = directoryArray.subarray(commentOffset, endOffset);
|
|
4825
4934
|
const filenameUTF8 = languageEncodingFlag;
|
|
4826
4935
|
const commentUTF8 = languageEncodingFlag;
|
|
4827
|
-
const externalFileAttributes = getUint32(directoryView, offset + 38);
|
|
4936
|
+
const externalFileAttributes = getUint32$1(directoryView, offset + 38);
|
|
4828
4937
|
const msdosAttributesRaw = externalFileAttributes & MAX_8_BITS;
|
|
4829
4938
|
const msdosAttributes = {
|
|
4830
4939
|
readOnly: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_READONLY_MASK),
|
|
@@ -4833,8 +4942,8 @@
|
|
|
4833
4942
|
directory: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_DIR_MASK),
|
|
4834
4943
|
archive: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_ARCHIVE_MASK)
|
|
4835
4944
|
};
|
|
4836
|
-
const offsetFileEntry = getUint32(directoryView, offset + 42);
|
|
4837
|
-
const decode =
|
|
4945
|
+
const offsetFileEntry = getUint32$1(directoryView, offset + 42);
|
|
4946
|
+
const decode = getFunctionOptionValue$1(zipReader, options, OPTION_DECODE_TEXT) || decodeText;
|
|
4838
4947
|
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
|
|
4839
4948
|
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
|
|
4840
4949
|
let filename = decode(rawFilename, rawFilenameEncoding, TEXT_TYPE_FILENAME);
|
|
@@ -4860,12 +4969,13 @@
|
|
|
4860
4969
|
index: indexFile,
|
|
4861
4970
|
versionMadeBy,
|
|
4862
4971
|
msDosCompatible,
|
|
4972
|
+
zip64: false,
|
|
4863
4973
|
compressedSize: 0,
|
|
4864
4974
|
uncompressedSize: 0,
|
|
4865
4975
|
commentLength,
|
|
4866
4976
|
offset: offsetFileEntry,
|
|
4867
|
-
diskNumberStart: getUint16(directoryView, offset + 34),
|
|
4868
|
-
internalFileAttributes: getUint16(directoryView, offset + 36),
|
|
4977
|
+
diskNumberStart: getUint16$1(directoryView, offset + 34),
|
|
4978
|
+
internalFileAttributes: getUint16$1(directoryView, offset + 36),
|
|
4869
4979
|
externalFileAttributes,
|
|
4870
4980
|
msdosAttributesRaw,
|
|
4871
4981
|
msdosAttributes,
|
|
@@ -4933,8 +5043,8 @@
|
|
|
4933
5043
|
yield entry;
|
|
4934
5044
|
}
|
|
4935
5045
|
let offsetAfterSignature = offset;
|
|
4936
|
-
if (offset + 6 <= directoryArray.length && getUint32(directoryView, offset) == DIGITAL_SIGNATURE_RECORD_SIGNATURE) {
|
|
4937
|
-
const signatureDataLength = getUint16(directoryView, offset + 4);
|
|
5046
|
+
if (offset + 6 <= directoryArray.length && getUint32$1(directoryView, offset) == DIGITAL_SIGNATURE_RECORD_SIGNATURE) {
|
|
5047
|
+
const signatureDataLength = getUint16$1(directoryView, offset + 4);
|
|
4938
5048
|
if (offset + 6 + signatureDataLength <= directoryArray.length) {
|
|
4939
5049
|
zipReader.digitalSignature = directoryArray.subarray(offset + 6, offset + 6 + signatureDataLength);
|
|
4940
5050
|
offsetAfterSignature = offset + 6 + signatureDataLength;
|
|
@@ -4946,13 +5056,17 @@
|
|
|
4946
5056
|
if (duplicateFilename) {
|
|
4947
5057
|
throwAmbiguousArchive("duplicate filename");
|
|
4948
5058
|
}
|
|
4949
|
-
if (checkAmbiguity && (prependedDataLength || (filesLength && startOffset > 0))) {
|
|
4950
|
-
throwAmbiguousArchive("prepended data");
|
|
4951
|
-
}
|
|
4952
5059
|
const extractPrependedData = getOptionValue$1(zipReader, options, OPTION_EXTRACT_PREPENDED_DATA);
|
|
4953
5060
|
const extractAppendedData = getOptionValue$1(zipReader, options, OPTION_EXTRACT_APPENDED_DATA);
|
|
5061
|
+
const splitZipSignatureLength = (checkAmbiguity || extractPrependedData) && filesLength &&
|
|
5062
|
+
startOffset == SPLIT_ZIP_FILE_SIGNATURE_LENGTH && await startsWithSplitZipMarker(reader) ? SPLIT_ZIP_FILE_SIGNATURE_LENGTH : 0;
|
|
5063
|
+
if (checkAmbiguity && (prependedDataLength || (filesLength && startOffset > splitZipSignatureLength))) {
|
|
5064
|
+
throwAmbiguousArchive("prepended data");
|
|
5065
|
+
}
|
|
4954
5066
|
if (extractPrependedData) {
|
|
4955
|
-
zipReader.prependedData = startOffset >
|
|
5067
|
+
zipReader.prependedData = startOffset > splitZipSignatureLength ?
|
|
5068
|
+
await readUint8Array(reader, splitZipSignatureLength, startOffset - splitZipSignatureLength) :
|
|
5069
|
+
EMPTY_UINT8_ARRAY;
|
|
4956
5070
|
}
|
|
4957
5071
|
zipReader.comment = commentLength ? await readUint8Array(reader, commentOffset + END_OF_CENTRAL_DIR_LENGTH, commentLength) : EMPTY_UINT8_ARRAY;
|
|
4958
5072
|
if (extractAppendedData) {
|
|
@@ -5019,16 +5133,16 @@
|
|
|
5019
5133
|
|
|
5020
5134
|
class ZipEntry {
|
|
5021
5135
|
|
|
5022
|
-
constructor(reader,
|
|
5136
|
+
constructor(reader, options) {
|
|
5023
5137
|
Object.assign(this, {
|
|
5024
5138
|
reader,
|
|
5025
|
-
config,
|
|
5026
5139
|
options
|
|
5027
5140
|
});
|
|
5028
5141
|
}
|
|
5029
5142
|
|
|
5030
5143
|
async getData(writer, fileEntry, readRanges, options = {}) {
|
|
5031
5144
|
const zipEntry = this;
|
|
5145
|
+
const config = getConfiguration();
|
|
5032
5146
|
const {
|
|
5033
5147
|
reader,
|
|
5034
5148
|
index,
|
|
@@ -5037,7 +5151,6 @@
|
|
|
5037
5151
|
extraFieldAES,
|
|
5038
5152
|
extraFieldZip64,
|
|
5039
5153
|
compressionMethod,
|
|
5040
|
-
config,
|
|
5041
5154
|
bitFlag,
|
|
5042
5155
|
rawBitFlag,
|
|
5043
5156
|
crc32,
|
|
@@ -5055,6 +5168,7 @@
|
|
|
5055
5168
|
let password = getOptionValue$1(zipEntry, options, OPTION_PASSWORD);
|
|
5056
5169
|
let rawPassword = getOptionValue$1(zipEntry, options, OPTION_RAW_PASSWORD);
|
|
5057
5170
|
const passThrough = getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH);
|
|
5171
|
+
checkPasswordOption(password, rawPassword);
|
|
5058
5172
|
password = password && password.length && password;
|
|
5059
5173
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
5060
5174
|
if (extraFieldAES) {
|
|
@@ -5062,7 +5176,7 @@
|
|
|
5062
5176
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION$1);
|
|
5063
5177
|
}
|
|
5064
5178
|
}
|
|
5065
|
-
if (dataArray.length < HEADER_SIZE || getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
|
|
5179
|
+
if (dataArray.length < HEADER_SIZE || getUint32$1(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
|
|
5066
5180
|
throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);
|
|
5067
5181
|
}
|
|
5068
5182
|
readCommonHeader(localDirectory, dataView, 4);
|
|
@@ -5070,9 +5184,12 @@
|
|
|
5070
5184
|
extraFieldLength,
|
|
5071
5185
|
filenameLength
|
|
5072
5186
|
} = localDirectory;
|
|
5073
|
-
const
|
|
5187
|
+
const checkLocalDirectoryOption = getOptionValue$1(zipEntry, options, OPTION_CHECK_LOCAL_DIRECTORY);
|
|
5188
|
+
const entryStrictness = getStrictness(options, zipEntry.options);
|
|
5189
|
+
const checkLocalDirectory = getCheckLocalDirectory(checkLocalDirectoryOption, entryStrictness);
|
|
5190
|
+
const checkLocalFilename = getCheckLocalFilename(checkLocalDirectoryOption, entryStrictness);
|
|
5074
5191
|
let rawLocalFilename = EMPTY_UINT8_ARRAY;
|
|
5075
|
-
if (
|
|
5192
|
+
if (checkLocalFilename && (filenameLength || extraFieldLength)) {
|
|
5076
5193
|
const trailingDataArray = await readUint8Array(reader, localHeaderOffset + HEADER_SIZE, filenameLength + extraFieldLength);
|
|
5077
5194
|
rawLocalFilename = trailingDataArray.subarray(0, filenameLength);
|
|
5078
5195
|
localDirectory.rawExtraField = trailingDataArray.subarray(filenameLength);
|
|
@@ -5081,17 +5198,26 @@
|
|
|
5081
5198
|
await readUint8Array(reader, localHeaderOffset + HEADER_SIZE + filenameLength, extraFieldLength) :
|
|
5082
5199
|
EMPTY_UINT8_ARRAY;
|
|
5083
5200
|
}
|
|
5201
|
+
if (checkLocalFilename) {
|
|
5202
|
+
localDirectory.rawFilename = rawLocalFilename;
|
|
5203
|
+
}
|
|
5084
5204
|
readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
|
|
5085
|
-
if (
|
|
5086
|
-
|
|
5205
|
+
if (checkLocalDirectory) {
|
|
5206
|
+
validateLocalDirectory(zipEntry, localDirectory, rawLocalFilename, checkLocalFilename);
|
|
5087
5207
|
}
|
|
5088
|
-
const { lastAccessDate, creationDate } = localDirectory;
|
|
5208
|
+
const { lastAccessDate, creationDate, uid, gid } = localDirectory;
|
|
5089
5209
|
if (lastAccessDate) {
|
|
5090
5210
|
fileEntry.lastAccessDate = lastAccessDate;
|
|
5091
5211
|
}
|
|
5092
5212
|
if (creationDate) {
|
|
5093
5213
|
fileEntry.creationDate = creationDate;
|
|
5094
5214
|
}
|
|
5215
|
+
if (uid !== UNDEFINED_VALUE && fileEntry.uid === UNDEFINED_VALUE) {
|
|
5216
|
+
fileEntry.uid = uid;
|
|
5217
|
+
}
|
|
5218
|
+
if (gid !== UNDEFINED_VALUE && fileEntry.gid === UNDEFINED_VALUE) {
|
|
5219
|
+
fileEntry.gid = gid;
|
|
5220
|
+
}
|
|
5095
5221
|
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
|
|
5096
5222
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5097
5223
|
if (!passThrough) {
|
|
@@ -5112,9 +5238,12 @@
|
|
|
5112
5238
|
}
|
|
5113
5239
|
}
|
|
5114
5240
|
const dataOffset = localHeaderOffset + HEADER_SIZE + filenameLength + extraFieldLength;
|
|
5241
|
+
if (dataOffset + compressedSize > reader.size) {
|
|
5242
|
+
throw new Error(ERR_ENTRY_DATA_OUT_OF_BOUNDS);
|
|
5243
|
+
}
|
|
5115
5244
|
const size = compressedSize;
|
|
5116
5245
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5117
|
-
const signal = getOptionValue$1(zipEntry, options, OPTION_SIGNAL);
|
|
5246
|
+
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5118
5247
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5119
5248
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5120
5249
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -5122,6 +5251,8 @@
|
|
|
5122
5251
|
checkOverlappingEntry = true;
|
|
5123
5252
|
}
|
|
5124
5253
|
const { onstart, onprogress, onend } = options;
|
|
5254
|
+
const compressed = compressionMethod != COMPRESSION_METHOD_STORE && !passThrough;
|
|
5255
|
+
const outputSize = passThrough ? compressedSize : uncompressedSize;
|
|
5125
5256
|
const deflate64 = compressionMethod == COMPRESSION_METHOD_DEFLATE_64;
|
|
5126
5257
|
let useCompressionStream = getOptionValue$1(zipEntry, options, OPTION_USE_COMPRESSION_STREAM);
|
|
5127
5258
|
if (deflate64) {
|
|
@@ -5142,9 +5273,9 @@
|
|
|
5142
5273
|
checkCrc32,
|
|
5143
5274
|
checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
|
|
5144
5275
|
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((crc32 >>> 24) & MAX_8_BITS)),
|
|
5145
|
-
outputSize
|
|
5276
|
+
outputSize,
|
|
5146
5277
|
crc32,
|
|
5147
|
-
compressed
|
|
5278
|
+
compressed,
|
|
5148
5279
|
encrypted,
|
|
5149
5280
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
5150
5281
|
useCompressionStream,
|
|
@@ -5181,11 +5312,11 @@
|
|
|
5181
5312
|
writer = new WritableStream();
|
|
5182
5313
|
}
|
|
5183
5314
|
writer = new GenericWriter(writer);
|
|
5184
|
-
await initStream(writer,
|
|
5315
|
+
await initStream(writer, getDecodableOutputSize(outputSize, compressedSize, compressed));
|
|
5185
5316
|
({ writable } = writer);
|
|
5186
|
-
const { outputSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5187
|
-
writer.size +=
|
|
5188
|
-
if (
|
|
5317
|
+
const { outputSize: writtenSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5318
|
+
writer.size += writtenSize;
|
|
5319
|
+
if (writtenSize != outputSize) {
|
|
5189
5320
|
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
5190
5321
|
}
|
|
5191
5322
|
}
|
|
@@ -5219,7 +5350,7 @@
|
|
|
5219
5350
|
function detectEncryptedCentralDirectory(directoryView) {
|
|
5220
5351
|
const maxOffset = Math.min(directoryView.byteLength, 1024) - 3;
|
|
5221
5352
|
for (let offset = 0; offset < maxOffset; offset++) {
|
|
5222
|
-
if (getUint32(directoryView, offset) == ARCHIVE_EXTRA_DATA_SIGNATURE) {
|
|
5353
|
+
if (getUint32$1(directoryView, offset) == ARCHIVE_EXTRA_DATA_SIGNATURE) {
|
|
5223
5354
|
return true;
|
|
5224
5355
|
}
|
|
5225
5356
|
}
|
|
@@ -5230,15 +5361,15 @@
|
|
|
5230
5361
|
const directoryEncryptionInfo = { rawExtensibleData };
|
|
5231
5362
|
if (rawExtensibleData.length >= 28) {
|
|
5232
5363
|
const extensibleDataView = getDataView(rawExtensibleData);
|
|
5233
|
-
const hashDataLength = getUint16(extensibleDataView, 26);
|
|
5364
|
+
const hashDataLength = getUint16$1(extensibleDataView, 26);
|
|
5234
5365
|
Object.assign(directoryEncryptionInfo, {
|
|
5235
|
-
compressionMethod: getUint16(extensibleDataView, 0),
|
|
5366
|
+
compressionMethod: getUint16$1(extensibleDataView, 0),
|
|
5236
5367
|
compressedSize: Number(getBigUint64(extensibleDataView, 2)),
|
|
5237
5368
|
uncompressedSize: Number(getBigUint64(extensibleDataView, 10)),
|
|
5238
|
-
encryptionAlgorithm: getUint16(extensibleDataView, 18),
|
|
5239
|
-
bitLength: getUint16(extensibleDataView, 20),
|
|
5240
|
-
flags: getUint16(extensibleDataView, 22),
|
|
5241
|
-
hashAlgorithm: getUint16(extensibleDataView, 24),
|
|
5369
|
+
encryptionAlgorithm: getUint16$1(extensibleDataView, 18),
|
|
5370
|
+
bitLength: getUint16$1(extensibleDataView, 20),
|
|
5371
|
+
flags: getUint16$1(extensibleDataView, 22),
|
|
5372
|
+
hashAlgorithm: getUint16$1(extensibleDataView, 24),
|
|
5242
5373
|
hashData: rawExtensibleData.subarray(28, 28 + hashDataLength)
|
|
5243
5374
|
});
|
|
5244
5375
|
}
|
|
@@ -5246,12 +5377,12 @@
|
|
|
5246
5377
|
}
|
|
5247
5378
|
|
|
5248
5379
|
function readCommonHeader(directory, dataView, offset) {
|
|
5249
|
-
const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);
|
|
5380
|
+
const rawBitFlag = directory.rawBitFlag = getUint16$1(dataView, offset + 2);
|
|
5250
5381
|
const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
|
|
5251
|
-
const rawLastModDate = getUint32(dataView, offset + 6);
|
|
5382
|
+
const rawLastModDate = getUint32$1(dataView, offset + 6);
|
|
5252
5383
|
Object.assign(directory, {
|
|
5253
5384
|
encrypted,
|
|
5254
|
-
version: getUint16(dataView, offset),
|
|
5385
|
+
version: getUint16$1(dataView, offset),
|
|
5255
5386
|
bitFlag: {
|
|
5256
5387
|
level: (rawBitFlag & BITFLAG_LEVEL) >> 1,
|
|
5257
5388
|
dataDescriptor: (rawBitFlag & BITFLAG_DATA_DESCRIPTOR) == BITFLAG_DATA_DESCRIPTOR,
|
|
@@ -5259,8 +5390,8 @@
|
|
|
5259
5390
|
},
|
|
5260
5391
|
rawLastModDate,
|
|
5261
5392
|
lastModDate: getDate(rawLastModDate),
|
|
5262
|
-
filenameLength: getUint16(dataView, offset + 22),
|
|
5263
|
-
extraFieldLength: getUint16(dataView, offset + 24)
|
|
5393
|
+
filenameLength: getUint16$1(dataView, offset + 22),
|
|
5394
|
+
extraFieldLength: getUint16$1(dataView, offset + 24)
|
|
5264
5395
|
});
|
|
5265
5396
|
}
|
|
5266
5397
|
|
|
@@ -5271,8 +5402,8 @@
|
|
|
5271
5402
|
let offsetExtraField = 0;
|
|
5272
5403
|
try {
|
|
5273
5404
|
while (offsetExtraField < rawExtraField.length) {
|
|
5274
|
-
const type = getUint16(rawExtraFieldView, offsetExtraField);
|
|
5275
|
-
const size = getUint16(rawExtraFieldView, offsetExtraField + 2);
|
|
5405
|
+
const type = getUint16$1(rawExtraFieldView, offsetExtraField);
|
|
5406
|
+
const size = getUint16$1(rawExtraFieldView, offsetExtraField + 2);
|
|
5276
5407
|
extraField.set(type, {
|
|
5277
5408
|
type,
|
|
5278
5409
|
data: rawExtraField.slice(offsetExtraField + 4, offsetExtraField + 4 + size)
|
|
@@ -5282,12 +5413,12 @@
|
|
|
5282
5413
|
} catch {
|
|
5283
5414
|
// ignored
|
|
5284
5415
|
}
|
|
5285
|
-
const compressionMethod = getUint16(dataView, offset + 4);
|
|
5416
|
+
const compressionMethod = getUint16$1(dataView, offset + 4);
|
|
5286
5417
|
Object.assign(directory, {
|
|
5287
|
-
signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5288
|
-
crc32: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5289
|
-
compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
|
|
5290
|
-
uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
|
|
5418
|
+
signature: getUint32$1(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5419
|
+
crc32: getUint32$1(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5420
|
+
compressedSize: getUint32$1(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
|
|
5421
|
+
uncompressedSize: getUint32$1(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
|
|
5291
5422
|
});
|
|
5292
5423
|
const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
|
|
5293
5424
|
if (extraFieldZip64) {
|
|
@@ -5327,10 +5458,12 @@
|
|
|
5327
5458
|
directory.extraFieldNTFS = extraFieldNTFS;
|
|
5328
5459
|
}
|
|
5329
5460
|
const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
|
|
5461
|
+
let unixIdsRead;
|
|
5330
5462
|
if (extraFieldUnix) {
|
|
5331
|
-
readExtraFieldUnix(extraFieldUnix, directory, false);
|
|
5463
|
+
unixIdsRead = readExtraFieldUnix(extraFieldUnix, directory, false);
|
|
5332
5464
|
directory.extraFieldUnix = extraFieldUnix;
|
|
5333
|
-
}
|
|
5465
|
+
}
|
|
5466
|
+
if (!unixIdsRead) {
|
|
5334
5467
|
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5335
5468
|
if (extraFieldInfoZip) {
|
|
5336
5469
|
readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
@@ -5374,11 +5507,11 @@
|
|
|
5374
5507
|
computedCrc32.append(fileEntry[rawPropertyName]);
|
|
5375
5508
|
const computedCrc32View = getDataView(new Uint8Array(4));
|
|
5376
5509
|
computedCrc32View.setUint32(0, computedCrc32.get(), true);
|
|
5377
|
-
const nameCrc32 = getUint32(extraFieldView, 1);
|
|
5510
|
+
const nameCrc32 = getUint32$1(extraFieldView, 1);
|
|
5378
5511
|
Object.assign(extraFieldUnicode, {
|
|
5379
5512
|
version: getUint8(extraFieldView, 0),
|
|
5380
5513
|
[propertyName]: decodeText(extraFieldUnicode.data.subarray(5)),
|
|
5381
|
-
valid: !fileEntry.bitFlag.languageEncodingFlag && nameCrc32 == getUint32(computedCrc32View, 0)
|
|
5514
|
+
valid: !fileEntry.bitFlag.languageEncodingFlag && nameCrc32 == getUint32$1(computedCrc32View, 0)
|
|
5382
5515
|
});
|
|
5383
5516
|
if (extraFieldUnicode.valid) {
|
|
5384
5517
|
directory[propertyName] = extraFieldUnicode[propertyName];
|
|
@@ -5394,7 +5527,7 @@
|
|
|
5394
5527
|
vendorId: getUint8(extraFieldView, 2),
|
|
5395
5528
|
strength,
|
|
5396
5529
|
originalCompressionMethod: compressionMethod,
|
|
5397
|
-
compressionMethod: getUint16(extraFieldView, 5)
|
|
5530
|
+
compressionMethod: getUint16$1(extraFieldView, 5)
|
|
5398
5531
|
});
|
|
5399
5532
|
directory.compressionMethod = extraFieldAES.compressionMethod;
|
|
5400
5533
|
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1$1) {
|
|
@@ -5408,8 +5541,8 @@
|
|
|
5408
5541
|
let tag1Data;
|
|
5409
5542
|
try {
|
|
5410
5543
|
while (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) {
|
|
5411
|
-
const tagValue = getUint16(extraFieldView, offsetExtraField);
|
|
5412
|
-
const attributeSize = getUint16(extraFieldView, offsetExtraField + 2);
|
|
5544
|
+
const tagValue = getUint16$1(extraFieldView, offsetExtraField);
|
|
5545
|
+
const attributeSize = getUint16$1(extraFieldView, offsetExtraField + 2);
|
|
5413
5546
|
if (tagValue == EXTRAFIELD_TYPE_NTFS_TAG1) {
|
|
5414
5547
|
tag1Data = extraFieldNTFS.data.slice(offsetExtraField + 4, offsetExtraField + 4 + attributeSize);
|
|
5415
5548
|
}
|
|
@@ -5433,7 +5566,7 @@
|
|
|
5433
5566
|
const creationDate = getDateNTFS(rawCreationDate);
|
|
5434
5567
|
const extraFieldData = { lastModDate, lastAccessDate, creationDate };
|
|
5435
5568
|
Object.assign(extraFieldNTFS, extraFieldData);
|
|
5436
|
-
Object.assign(directory, extraFieldData);
|
|
5569
|
+
Object.assign(directory, extraFieldData, { rawLastAccessDate, rawCreationDate });
|
|
5437
5570
|
}
|
|
5438
5571
|
}
|
|
5439
5572
|
|
|
@@ -5442,12 +5575,12 @@
|
|
|
5442
5575
|
return;
|
|
5443
5576
|
}
|
|
5444
5577
|
const extraFieldView = getDataView(extraField.data);
|
|
5445
|
-
const lastAccessDate = new Date((getUint32(extraFieldView, 0) | 0) * 1000);
|
|
5446
|
-
const lastModDate = new Date((getUint32(extraFieldView, 4) | 0) * 1000);
|
|
5578
|
+
const lastAccessDate = new Date((getUint32$1(extraFieldView, 0) | 0) * 1000);
|
|
5579
|
+
const lastModDate = new Date((getUint32$1(extraFieldView, 4) | 0) * 1000);
|
|
5447
5580
|
const extraFieldData = { lastAccessDate, lastModDate };
|
|
5448
5581
|
if (extraField.data.length >= 12) {
|
|
5449
|
-
extraFieldData.uid = getUint16(extraFieldView, 8);
|
|
5450
|
-
extraFieldData.gid = getUint16(extraFieldView, 10);
|
|
5582
|
+
extraFieldData.uid = getUint16$1(extraFieldView, 8);
|
|
5583
|
+
extraFieldData.gid = getUint16$1(extraFieldView, 10);
|
|
5451
5584
|
}
|
|
5452
5585
|
Object.assign(extraField, extraFieldData);
|
|
5453
5586
|
Object.assign(directory, extraFieldData);
|
|
@@ -5467,8 +5600,8 @@
|
|
|
5467
5600
|
gid = unpackUnixId(extraField.data.subarray(offset, offset + gidSize));
|
|
5468
5601
|
Object.assign(extraField, { version, uid, gid });
|
|
5469
5602
|
} else if (extraField.data.length >= 4) {
|
|
5470
|
-
uid = getUint16(view, 0);
|
|
5471
|
-
gid = getUint16(view, 2);
|
|
5603
|
+
uid = getUint16$1(view, 0);
|
|
5604
|
+
gid = getUint16$1(view, 2);
|
|
5472
5605
|
Object.assign(extraField, { uid, gid });
|
|
5473
5606
|
}
|
|
5474
5607
|
if (uid !== UNDEFINED_VALUE) {
|
|
@@ -5477,6 +5610,7 @@
|
|
|
5477
5610
|
if (gid !== UNDEFINED_VALUE) {
|
|
5478
5611
|
directory.gid = gid;
|
|
5479
5612
|
}
|
|
5613
|
+
return uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE;
|
|
5480
5614
|
} catch {
|
|
5481
5615
|
// ignored
|
|
5482
5616
|
}
|
|
@@ -5517,7 +5651,7 @@
|
|
|
5517
5651
|
let offset = 1;
|
|
5518
5652
|
timeProperties.forEach((propertyName, indexProperty) => {
|
|
5519
5653
|
if (extraFieldExtendedTimestamp.data.length >= offset + 4) {
|
|
5520
|
-
const time = getUint32(extraFieldView, offset);
|
|
5654
|
+
const time = getUint32$1(extraFieldView, offset);
|
|
5521
5655
|
directory[propertyName] = extraFieldExtendedTimestamp[propertyName] = new Date((time | 0) * 1000);
|
|
5522
5656
|
const rawPropertyName = timeRawProperties[indexProperty];
|
|
5523
5657
|
extraFieldExtendedTimestamp[rawPropertyName] = time;
|
|
@@ -5549,26 +5683,25 @@
|
|
|
5549
5683
|
}
|
|
5550
5684
|
if (dataDescriptorLength) {
|
|
5551
5685
|
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
5552
|
-
const
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
if (extraFieldZip64) {
|
|
5559
|
-
readCompressedSize = getBigUint64(getDataView(dataDescriptorArray), 8);
|
|
5560
|
-
readUncompressedSize = getBigUint64(getDataView(dataDescriptorArray), 16);
|
|
5561
|
-
} else {
|
|
5562
|
-
readCompressedSize = getUint32(getDataView(dataDescriptorArray), 8);
|
|
5563
|
-
readUncompressedSize = getUint32(getDataView(dataDescriptorArray), 12);
|
|
5564
|
-
}
|
|
5565
|
-
const matchCrc32 = (fileEntry.encrypted && !fileEntry.zipCrypto) || readCrc32 == crc32;
|
|
5686
|
+
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
5687
|
+
let signature = dataDescriptorArray.length == dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH &&
|
|
5688
|
+
getUint32$1(dataDescriptorView, 0) == DATA_DESCRIPTOR_RECORD_SIGNATURE;
|
|
5689
|
+
if (signature) {
|
|
5690
|
+
const signedDataDescriptor = readDataDescriptor(dataDescriptorView, DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH, extraFieldZip64);
|
|
5691
|
+
const matchCrc32 = (fileEntry.encrypted && !fileEntry.zipCrypto) || signedDataDescriptor.crc32 == crc32;
|
|
5566
5692
|
if (matchCrc32 &&
|
|
5567
|
-
|
|
5568
|
-
|
|
5693
|
+
signedDataDescriptor.compressedSize == compressedSize &&
|
|
5694
|
+
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
5569
5695
|
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
5696
|
+
} else {
|
|
5697
|
+
signature = false;
|
|
5570
5698
|
}
|
|
5571
5699
|
}
|
|
5700
|
+
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
5701
|
+
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
5702
|
+
localDataDescriptor.signature = signature;
|
|
5703
|
+
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
5704
|
+
}
|
|
5572
5705
|
}
|
|
5573
5706
|
const range = {
|
|
5574
5707
|
start: offset,
|
|
@@ -5585,22 +5718,80 @@
|
|
|
5585
5718
|
readRanges.set(index, range);
|
|
5586
5719
|
}
|
|
5587
5720
|
|
|
5721
|
+
function readDataDescriptor(dataDescriptorView, offset, extraFieldZip64) {
|
|
5722
|
+
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
5723
|
+
let compressedSize;
|
|
5724
|
+
let uncompressedSize;
|
|
5725
|
+
if (extraFieldZip64) {
|
|
5726
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
5727
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
5728
|
+
} else {
|
|
5729
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
5730
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
5731
|
+
}
|
|
5732
|
+
return { crc32, compressedSize, uncompressedSize };
|
|
5733
|
+
}
|
|
5734
|
+
|
|
5588
5735
|
function getDiskOffset$1(reader, diskNumber) {
|
|
5589
5736
|
return reader.getDiskOffset ? reader.getDiskOffset(diskNumber) : 0;
|
|
5590
5737
|
}
|
|
5591
5738
|
|
|
5739
|
+
async function startsWithSplitZipSignature$1(reader) {
|
|
5740
|
+
return await getFirstSignature(reader) == SPLIT_ZIP_FILE_SIGNATURE;
|
|
5741
|
+
}
|
|
5742
|
+
|
|
5743
|
+
async function startsWithSplitZipMarker(reader) {
|
|
5744
|
+
const signature = await getFirstSignature(reader);
|
|
5745
|
+
return signature == SPLIT_ZIP_FILE_SIGNATURE || signature == TEMPORARY_SPLIT_ZIP_FILE_SIGNATURE;
|
|
5746
|
+
}
|
|
5747
|
+
|
|
5748
|
+
async function getFirstSignature(reader) {
|
|
5749
|
+
const signatureArray = await readUint8Array(reader, 0, SPLIT_ZIP_FILE_SIGNATURE_LENGTH);
|
|
5750
|
+
return getUint32$1(getDataView(signatureArray));
|
|
5751
|
+
}
|
|
5752
|
+
|
|
5592
5753
|
function isStrictnessValue(value) {
|
|
5593
5754
|
return value === STRICTNESS_STRICT || value === STRICTNESS_BALANCED || value === STRICTNESS_TOLERANT;
|
|
5594
5755
|
}
|
|
5595
5756
|
|
|
5596
|
-
function
|
|
5597
|
-
|
|
5598
|
-
|
|
5757
|
+
function getDecodableOutputSize(outputSize, compressedSize, compressed) {
|
|
5758
|
+
return Math.min(outputSize, compressed ? compressedSize * MAX_DEFLATE_EXPANSION_RATIO : compressedSize);
|
|
5759
|
+
}
|
|
5760
|
+
|
|
5761
|
+
function getStrictness(options, inheritedOptions) {
|
|
5762
|
+
return resolveStrictness(options, resolveStrictness(inheritedOptions, STRICTNESS_BALANCED));
|
|
5763
|
+
}
|
|
5764
|
+
|
|
5765
|
+
function resolveStrictness(options, inheritedStrictness) {
|
|
5766
|
+
const strictness = options[OPTION_STRICTNESS];
|
|
5767
|
+
if (strictness !== UNDEFINED_VALUE) {
|
|
5768
|
+
if (!isStrictnessValue(strictness)) {
|
|
5769
|
+
throw new Error(ERR_INVALID_STRICTNESS);
|
|
5770
|
+
}
|
|
5771
|
+
return strictness;
|
|
5772
|
+
}
|
|
5773
|
+
const checkAmbiguity = options[OPTION_CHECK_AMBIGUITY];
|
|
5774
|
+
if (checkAmbiguity === UNDEFINED_VALUE) {
|
|
5775
|
+
return inheritedStrictness;
|
|
5776
|
+
}
|
|
5777
|
+
if (checkAmbiguity) {
|
|
5778
|
+
return STRICTNESS_STRICT;
|
|
5779
|
+
}
|
|
5780
|
+
return inheritedStrictness == STRICTNESS_TOLERANT ? STRICTNESS_TOLERANT : STRICTNESS_BALANCED;
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5783
|
+
function getCheckLocalDirectory(checkLocalDirectory, strictness) {
|
|
5784
|
+
if (checkLocalDirectory === UNDEFINED_VALUE) {
|
|
5785
|
+
return strictness != STRICTNESS_TOLERANT;
|
|
5599
5786
|
}
|
|
5600
|
-
|
|
5601
|
-
|
|
5787
|
+
return Boolean(checkLocalDirectory);
|
|
5788
|
+
}
|
|
5789
|
+
|
|
5790
|
+
function getCheckLocalFilename(checkLocalFilename, strictness) {
|
|
5791
|
+
if (checkLocalFilename === UNDEFINED_VALUE) {
|
|
5792
|
+
return strictness == STRICTNESS_STRICT;
|
|
5602
5793
|
}
|
|
5603
|
-
return
|
|
5794
|
+
return Boolean(checkLocalFilename);
|
|
5604
5795
|
}
|
|
5605
5796
|
|
|
5606
5797
|
function getFilenameValidation(filenameValidation, strictness) {
|
|
@@ -5629,7 +5820,7 @@
|
|
|
5629
5820
|
|
|
5630
5821
|
function getMaxAppendedDataSize(maxAppendedDataSize, strictness) {
|
|
5631
5822
|
if (maxAppendedDataSize !== UNDEFINED_VALUE) {
|
|
5632
|
-
const size = toNumber
|
|
5823
|
+
const size = toNumber(maxAppendedDataSize);
|
|
5633
5824
|
if (typeof size != NUMBER_TYPE || Number.isNaN(size) || size < 0) {
|
|
5634
5825
|
throw new Error(ERR_INVALID_MAX_APPENDED_DATA_SIZE);
|
|
5635
5826
|
}
|
|
@@ -5652,7 +5843,7 @@
|
|
|
5652
5843
|
let plausibleEndOfDirectoryInfo;
|
|
5653
5844
|
let endOfDirectoryReachingEndCount = 0;
|
|
5654
5845
|
for await (const [anchoredView, anchoredOffset, anchoredArray, indexByte, offset] of scanEndOfCentralDirectory(reader, anchoredLength)) {
|
|
5655
|
-
const commentLength = getUint16(anchoredView, indexByte + 20);
|
|
5846
|
+
const commentLength = getUint16$1(anchoredView, indexByte + 20);
|
|
5656
5847
|
if (offset + END_OF_CENTRAL_DIR_LENGTH + commentLength == size) {
|
|
5657
5848
|
const reachability = await getCentralDirectoryReachability(reader, anchoredView, anchoredOffset, indexByte, offset, size, remoteProbeBudget);
|
|
5658
5849
|
if (reachability == CENTRAL_DIRECTORY_REACHABLE) {
|
|
@@ -5703,7 +5894,7 @@
|
|
|
5703
5894
|
const scanArray = await readUint8Array(reader, scanOffset, scanLength);
|
|
5704
5895
|
const scanView = getDataView(scanArray);
|
|
5705
5896
|
for (let indexByte = scanArray.length - END_OF_CENTRAL_DIR_LENGTH; indexByte >= 0; indexByte--) {
|
|
5706
|
-
if (getUint32(scanView, indexByte) == END_OF_CENTRAL_DIR_SIGNATURE) {
|
|
5897
|
+
if (getUint32$1(scanView, indexByte) == END_OF_CENTRAL_DIR_SIGNATURE) {
|
|
5707
5898
|
yield [scanView, scanOffset, scanArray, indexByte, scanOffset + indexByte];
|
|
5708
5899
|
}
|
|
5709
5900
|
}
|
|
@@ -5714,9 +5905,9 @@
|
|
|
5714
5905
|
}
|
|
5715
5906
|
|
|
5716
5907
|
async function getCentralDirectoryReachability(reader, view, anchoredOffset, indexByte, offset, size, remoteProbeBudget) {
|
|
5717
|
-
const filesLength = getUint16(view, indexByte + 10);
|
|
5718
|
-
const directoryDataLength = getUint32(view, indexByte + 12);
|
|
5719
|
-
const directoryDataOffset = getUint32(view, indexByte + 16);
|
|
5908
|
+
const filesLength = getUint16$1(view, indexByte + 10);
|
|
5909
|
+
const directoryDataLength = getUint32$1(view, indexByte + 12);
|
|
5910
|
+
const directoryDataOffset = getUint32$1(view, indexByte + 16);
|
|
5720
5911
|
if (filesLength == MAX_16_BITS || directoryDataLength == MAX_32_BITS || directoryDataOffset == MAX_32_BITS) {
|
|
5721
5912
|
const locatorSignature = await readSignature(reader, view, anchoredOffset, offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH, size, remoteProbeBudget);
|
|
5722
5913
|
return locatorSignature == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE ? CENTRAL_DIRECTORY_REACHABLE : CENTRAL_DIRECTORY_UNREACHABLE;
|
|
@@ -5724,7 +5915,7 @@
|
|
|
5724
5915
|
if (!filesLength && !directoryDataLength) {
|
|
5725
5916
|
return CENTRAL_DIRECTORY_PLAUSIBLE;
|
|
5726
5917
|
}
|
|
5727
|
-
const directoryDiskNumber = getUint16(view, indexByte + 6);
|
|
5918
|
+
const directoryDiskNumber = getUint16$1(view, indexByte + 6);
|
|
5728
5919
|
for (const centralDirectoryOffset of [offset - directoryDataLength, getDiskOffset$1(reader, directoryDiskNumber) + directoryDataOffset]) {
|
|
5729
5920
|
if (await readSignature(reader, view, anchoredOffset, centralDirectoryOffset, size, remoteProbeBudget) == CENTRAL_FILE_HEADER_SIGNATURE) {
|
|
5730
5921
|
return CENTRAL_DIRECTORY_REACHABLE;
|
|
@@ -5738,20 +5929,21 @@
|
|
|
5738
5929
|
return UNDEFINED_VALUE;
|
|
5739
5930
|
}
|
|
5740
5931
|
if (signatureOffset >= anchoredOffset) {
|
|
5741
|
-
return getUint32(view, signatureOffset - anchoredOffset);
|
|
5932
|
+
return getUint32$1(view, signatureOffset - anchoredOffset);
|
|
5742
5933
|
}
|
|
5743
5934
|
if (remoteProbeBudget.count > 0) {
|
|
5744
5935
|
remoteProbeBudget.count--;
|
|
5745
5936
|
const signatureArray = await readUint8Array(reader, signatureOffset, 4);
|
|
5746
|
-
return getUint32(getDataView(signatureArray), 0);
|
|
5937
|
+
return getUint32$1(getDataView(signatureArray), 0);
|
|
5747
5938
|
}
|
|
5748
5939
|
return UNDEFINED_VALUE;
|
|
5749
5940
|
}
|
|
5750
5941
|
|
|
5751
|
-
function
|
|
5942
|
+
function validateLocalDirectory(zipEntry, localDirectory, rawLocalFilename, checkLocalFilename) {
|
|
5752
5943
|
const { rawFilename } = zipEntry;
|
|
5753
|
-
if (
|
|
5754
|
-
rawLocalFilename.
|
|
5944
|
+
if (checkLocalFilename &&
|
|
5945
|
+
(rawLocalFilename.length != rawFilename.length ||
|
|
5946
|
+
rawLocalFilename.some((byteValue, indexByte) => byteValue != rawFilename[indexByte]))) {
|
|
5755
5947
|
throwAmbiguousArchive("mismatched local file header (filename)");
|
|
5756
5948
|
}
|
|
5757
5949
|
if ((localDirectory.rawBitFlag & BITFLAG_AMBIGUITY_MASK) != (zipEntry.rawBitFlag & BITFLAG_AMBIGUITY_MASK)) {
|
|
@@ -5779,10 +5971,11 @@
|
|
|
5779
5971
|
return options[name] === UNDEFINED_VALUE ? zipReader.options[name] : options[name];
|
|
5780
5972
|
}
|
|
5781
5973
|
|
|
5782
|
-
function
|
|
5783
|
-
return
|
|
5974
|
+
function getFunctionOptionValue$1(zipReader, options, name) {
|
|
5975
|
+
return checkFunctionOption(getOptionValue$1(zipReader, options, name));
|
|
5784
5976
|
}
|
|
5785
5977
|
|
|
5978
|
+
|
|
5786
5979
|
function getDate(timeRaw) {
|
|
5787
5980
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
|
|
5788
5981
|
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
@@ -5796,11 +5989,11 @@
|
|
|
5796
5989
|
return view.getUint8(offset);
|
|
5797
5990
|
}
|
|
5798
5991
|
|
|
5799
|
-
function getUint16(view, offset) {
|
|
5992
|
+
function getUint16$1(view, offset) {
|
|
5800
5993
|
return view.getUint16(offset, true);
|
|
5801
5994
|
}
|
|
5802
5995
|
|
|
5803
|
-
function getUint32(view, offset) {
|
|
5996
|
+
function getUint32$1(view, offset) {
|
|
5804
5997
|
return view.getUint32(offset, true);
|
|
5805
5998
|
}
|
|
5806
5999
|
|
|
@@ -5815,6 +6008,7 @@
|
|
|
5815
6008
|
ERR_CENTRAL_DIRECTORY_NOT_FOUND: ERR_CENTRAL_DIRECTORY_NOT_FOUND,
|
|
5816
6009
|
ERR_ENCRYPTED: ERR_ENCRYPTED,
|
|
5817
6010
|
ERR_ENCRYPTED_CENTRAL_DIRECTORY: ERR_ENCRYPTED_CENTRAL_DIRECTORY,
|
|
6011
|
+
ERR_ENTRY_DATA_OUT_OF_BOUNDS: ERR_ENTRY_DATA_OUT_OF_BOUNDS,
|
|
5818
6012
|
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
5819
6013
|
ERR_EOCDR_NOT_FOUND: ERR_EOCDR_NOT_FOUND,
|
|
5820
6014
|
ERR_EXTRAFIELD_ZIP64_NOT_FOUND: ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
@@ -5869,13 +6063,18 @@
|
|
|
5869
6063
|
|
|
5870
6064
|
const ERR_DUPLICATED_NAME = "File already exists";
|
|
5871
6065
|
const ERR_INVALID_COMMENT = "Zip file comment exceeds 64KB";
|
|
6066
|
+
const ERR_INVALID_COMMENT_TYPE = "Invalid zip file comment (must be a Uint8Array)";
|
|
5872
6067
|
const ERR_INVALID_ENTRY_COMMENT = "File entry comment exceeds 64KB";
|
|
6068
|
+
const ERR_INVALID_ENTRY_COMMENT_TYPE = "Invalid file entry comment (must be a string)";
|
|
6069
|
+
const ERR_INVALID_DATE = "Invalid date (must be a valid Date instance)";
|
|
5873
6070
|
const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
|
|
5874
6071
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
5875
6072
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
5876
6073
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
5877
6074
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
5878
|
-
const
|
|
6075
|
+
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6076
|
+
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
6077
|
+
const ERR_INVALID_EXTRAFIELD_DATA_TYPE = "Invalid extra field data (must be a Uint8Array)";
|
|
5879
6078
|
const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
|
|
5880
6079
|
const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
|
|
5881
6080
|
const MIN_UNIX_TIME = -2147483648;
|
|
@@ -5895,7 +6094,6 @@
|
|
|
5895
6094
|
const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be integer 0..255)";
|
|
5896
6095
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
5897
6096
|
const ERR_INVALID_LEVEL = "Invalid level (must be integer 0..9)";
|
|
5898
|
-
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
5899
6097
|
const ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
5900
6098
|
|
|
5901
6099
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
@@ -5920,8 +6118,7 @@
|
|
|
5920
6118
|
writer,
|
|
5921
6119
|
addSplitZipSignature,
|
|
5922
6120
|
options,
|
|
5923
|
-
|
|
5924
|
-
files: new Map(),
|
|
6121
|
+
fileEntries: new Map(),
|
|
5925
6122
|
filenames: new Set(),
|
|
5926
6123
|
offset: options[OPTION_OFFSET] === UNDEFINED_VALUE ? writer.size || writer.writable.size || 0 : options[OPTION_OFFSET],
|
|
5927
6124
|
initialOffset: options[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : options[OPTION_OFFSET] - (writer.size || writer.writable.size || 0),
|
|
@@ -5937,15 +6134,28 @@
|
|
|
5937
6134
|
}
|
|
5938
6135
|
reader = new GenericReader(reader);
|
|
5939
6136
|
await initStream(reader);
|
|
6137
|
+
if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) {
|
|
6138
|
+
reader = new BlobReader(await streamToBlob(reader.readable));
|
|
6139
|
+
await initStream(reader);
|
|
6140
|
+
}
|
|
5940
6141
|
const { ZipReader } = await Promise.resolve().then(function () { return zipReader; });
|
|
5941
|
-
const zipReader$1 = new ZipReader(reader
|
|
6142
|
+
const zipReader$1 = new ZipReader(reader);
|
|
5942
6143
|
const entries = await zipReader$1.getEntries();
|
|
5943
6144
|
await zipReader$1.close();
|
|
5944
6145
|
await initStream(this.writer);
|
|
5945
|
-
|
|
5946
|
-
|
|
6146
|
+
const { directoryOffset } = zipReader$1;
|
|
6147
|
+
let splitZipSignatureLength = 0;
|
|
6148
|
+
if (this.addSplitZipSignature) {
|
|
6149
|
+
delete this.addSplitZipSignature;
|
|
6150
|
+
if (!await startsWithSplitZipSignature(reader)) {
|
|
6151
|
+
await writeData(this.writer, getSplitZipSignatureArray());
|
|
6152
|
+
splitZipSignatureLength = SPLIT_ZIP_FILE_SIGNATURE_LENGTH;
|
|
6153
|
+
this.offset += splitZipSignatureLength;
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
const entryPositions = await copyZipData(this, reader, entries, directoryOffset, splitZipSignatureLength);
|
|
5947
6157
|
this.filenames = new Set(entries.map(entry => entry.filename));
|
|
5948
|
-
this.
|
|
6158
|
+
this.fileEntries = new Map(entries.map(entry => {
|
|
5949
6159
|
const {
|
|
5950
6160
|
version,
|
|
5951
6161
|
rawLastModDate,
|
|
@@ -6000,11 +6210,12 @@
|
|
|
6000
6210
|
if (crc32 !== UNDEFINED_VALUE) {
|
|
6001
6211
|
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
6002
6212
|
}
|
|
6213
|
+
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6003
6214
|
Object.assign(entry, {
|
|
6004
6215
|
zip64UncompressedSize,
|
|
6005
6216
|
zip64CompressedSize,
|
|
6006
|
-
|
|
6007
|
-
diskNumberStart
|
|
6217
|
+
offset,
|
|
6218
|
+
diskNumberStart,
|
|
6008
6219
|
zip64DiskNumberStart: false,
|
|
6009
6220
|
rawExtraFieldZip64,
|
|
6010
6221
|
rawExtraFieldAES,
|
|
@@ -6024,11 +6235,8 @@
|
|
|
6024
6235
|
async add(name = "", reader, options = {}) {
|
|
6025
6236
|
const zipWriter = this;
|
|
6026
6237
|
options = Object.assign({}, options);
|
|
6027
|
-
const {
|
|
6028
|
-
|
|
6029
|
-
config
|
|
6030
|
-
} = zipWriter;
|
|
6031
|
-
if (workers < config.maxWorkers) {
|
|
6238
|
+
const { pendingAddFileCalls } = zipWriter;
|
|
6239
|
+
if (workers < getConfiguration().maxWorkers) {
|
|
6032
6240
|
workers++;
|
|
6033
6241
|
} else {
|
|
6034
6242
|
await new Promise(resolve => pendingEntries.push(resolve));
|
|
@@ -6065,16 +6273,16 @@
|
|
|
6065
6273
|
}
|
|
6066
6274
|
|
|
6067
6275
|
remove(entry) {
|
|
6068
|
-
const { filenames,
|
|
6276
|
+
const { filenames, fileEntries } = this;
|
|
6069
6277
|
// deno-lint-ignore valid-typeof
|
|
6070
6278
|
if (typeof entry == STRING_TYPE) {
|
|
6071
|
-
entry =
|
|
6279
|
+
entry = fileEntries.get(entry);
|
|
6072
6280
|
}
|
|
6073
6281
|
if (entry && entry.filename !== UNDEFINED_VALUE) {
|
|
6074
6282
|
const { filename } = entry;
|
|
6075
|
-
if (filenames.has(filename) &&
|
|
6283
|
+
if (filenames.has(filename) && fileEntries.has(filename)) {
|
|
6076
6284
|
filenames.delete(filename);
|
|
6077
|
-
|
|
6285
|
+
fileEntries.delete(filename);
|
|
6078
6286
|
return true;
|
|
6079
6287
|
}
|
|
6080
6288
|
}
|
|
@@ -6085,6 +6293,9 @@
|
|
|
6085
6293
|
const zipWriter = this;
|
|
6086
6294
|
const { pendingAddFileCalls, writer } = this;
|
|
6087
6295
|
const { writable } = writer;
|
|
6296
|
+
if (!(comment instanceof Uint8Array)) {
|
|
6297
|
+
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
6298
|
+
}
|
|
6088
6299
|
if (getLength(comment) > MAX_16_BITS) {
|
|
6089
6300
|
throw new Error(ERR_INVALID_COMMENT);
|
|
6090
6301
|
}
|
|
@@ -6168,12 +6379,12 @@
|
|
|
6168
6379
|
const metadataInfo = resolveMetadata(zipWriter, name, options);
|
|
6169
6380
|
const { comment } = metadataInfo;
|
|
6170
6381
|
const extraField = options[PROPERTY_NAME_EXTRA_FIELD];
|
|
6171
|
-
zipWriter.
|
|
6382
|
+
zipWriter.fileEntries.set(name, UNDEFINED_VALUE);
|
|
6172
6383
|
let fileEntry;
|
|
6173
6384
|
try {
|
|
6174
6385
|
const { resolvedOptions } = metadataInfo;
|
|
6175
6386
|
if (resolvedOptions.level != 0 && resolvedOptions.compressionMethod === UNDEFINED_VALUE &&
|
|
6176
|
-
!resolvedOptions.passThrough && !(await supportsDeflate(
|
|
6387
|
+
!resolvedOptions.passThrough && !(await supportsDeflate(getConfiguration()))) {
|
|
6177
6388
|
resolvedOptions.level = 0;
|
|
6178
6389
|
}
|
|
6179
6390
|
const sizesInfo = await resolveSizes(zipWriter, reader, metadataInfo, options);
|
|
@@ -6181,8 +6392,6 @@
|
|
|
6181
6392
|
const diskOffset = getDiskOffset(zipWriter.writer);
|
|
6182
6393
|
const diskNumber = getDiskNumber(zipWriter.writer);
|
|
6183
6394
|
options = Object.assign({}, options, attributesInfo.resolvedOptions, metadataInfo.resolvedOptions, sizesInfo.resolvedOptions, {
|
|
6184
|
-
internalFileAttribute: metadataInfo.resolvedOptions.internalFileAttributes,
|
|
6185
|
-
externalFileAttribute: attributesInfo.resolvedOptions.externalFileAttributes,
|
|
6186
6395
|
signature: options[PROPERTY_NAME_SIGNATURE],
|
|
6187
6396
|
crc32: options.crc32 === UNDEFINED_VALUE ? options[PROPERTY_NAME_SIGNATURE] : options.crc32,
|
|
6188
6397
|
offset: zipWriter.offset - diskOffset,
|
|
@@ -6193,17 +6402,23 @@
|
|
|
6193
6402
|
const metadataSize = getLength(headerInfo.localHeaderArray, dataDescriptorInfo.dataDescriptorArray);
|
|
6194
6403
|
fileEntry = await getFileEntry(zipWriter, name, reader, { headerInfo, dataDescriptorInfo, metadataSize }, options);
|
|
6195
6404
|
} catch (error) {
|
|
6196
|
-
zipWriter.
|
|
6405
|
+
zipWriter.fileEntries.delete(name);
|
|
6197
6406
|
throw error;
|
|
6198
6407
|
}
|
|
6199
|
-
Object.assign(fileEntry, {
|
|
6408
|
+
Object.assign(fileEntry, {
|
|
6409
|
+
name,
|
|
6410
|
+
comment,
|
|
6411
|
+
extraField,
|
|
6412
|
+
[PROPERTY_NAME_DEPRECATED_INTERNAL_FILE_ATTRIBUTES]: fileEntry.internalFileAttributes,
|
|
6413
|
+
[PROPERTY_NAME_DEPRECATED_EXTERNAL_FILE_ATTRIBUTES]: fileEntry.externalFileAttributes
|
|
6414
|
+
});
|
|
6200
6415
|
return new Entry(fileEntry);
|
|
6201
6416
|
}
|
|
6202
6417
|
|
|
6203
6418
|
function resolveAttributes(zipWriter, name, options) {
|
|
6204
6419
|
name = name.trim();
|
|
6205
6420
|
let msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
|
|
6206
|
-
let versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ?
|
|
6421
|
+
let versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? VERSION_MADE_BY_MSDOS : VERSION_MADE_BY_UNIX);
|
|
6207
6422
|
const executable = getOptionValue(zipWriter, options, PROPERTY_NAME_EXECUTABLE);
|
|
6208
6423
|
const uid = getNumberOptionValue(zipWriter, options, PROPERTY_NAME_UID);
|
|
6209
6424
|
const gid = getNumberOptionValue(zipWriter, options, PROPERTY_NAME_GID);
|
|
@@ -6231,21 +6446,21 @@
|
|
|
6231
6446
|
if (unixExtraFieldType === UNDEFINED_VALUE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
6232
6447
|
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE;
|
|
6233
6448
|
}
|
|
6234
|
-
let msdosAttributesRaw =
|
|
6449
|
+
let msdosAttributesRaw = getNumberOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW);
|
|
6235
6450
|
let msdosAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES);
|
|
6236
|
-
const hasUnixMetadata = uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE || unixMode !== UNDEFINED_VALUE || unixExtraFieldType;
|
|
6451
|
+
const hasUnixMetadata = uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE || unixMode !== UNDEFINED_VALUE || unixExtraFieldType || executable;
|
|
6237
6452
|
const hasMsDosProvided = msdosAttributesRaw !== UNDEFINED_VALUE || msdosAttributes !== UNDEFINED_VALUE;
|
|
6238
6453
|
if (hasUnixMetadata) {
|
|
6239
6454
|
msDosCompatible = false;
|
|
6240
|
-
versionMadeBy = (versionMadeBy &
|
|
6455
|
+
versionMadeBy = (versionMadeBy & MAX_8_BITS) | VERSION_MADE_BY_UNIX;
|
|
6241
6456
|
} else if (hasMsDosProvided) {
|
|
6242
6457
|
msDosCompatible = true;
|
|
6243
6458
|
versionMadeBy = (versionMadeBy & MAX_8_BITS);
|
|
6244
6459
|
}
|
|
6245
|
-
if (msdosAttributesRaw !== UNDEFINED_VALUE && (msdosAttributesRaw < 0 || msdosAttributesRaw > MAX_8_BITS)) {
|
|
6460
|
+
if (msdosAttributesRaw !== UNDEFINED_VALUE && (!Number.isInteger(msdosAttributesRaw) || msdosAttributesRaw < 0 || msdosAttributesRaw > MAX_8_BITS)) {
|
|
6246
6461
|
throw new Error(ERR_INVALID_MSDOS_ATTRIBUTES);
|
|
6247
6462
|
}
|
|
6248
|
-
if (msdosAttributes && typeof msdosAttributes !== OBJECT_TYPE) {
|
|
6463
|
+
if (msdosAttributes && (typeof msdosAttributes !== OBJECT_TYPE || Array.isArray(msdosAttributes))) {
|
|
6249
6464
|
throw new Error(ERR_INVALID_MSDOS_DATA);
|
|
6250
6465
|
}
|
|
6251
6466
|
if (versionMadeBy > MAX_16_BITS) {
|
|
@@ -6277,11 +6492,10 @@
|
|
|
6277
6492
|
externalFileAttributes = FILE_ATTR_UNIX_DEFAULT_MASK << 16;
|
|
6278
6493
|
}
|
|
6279
6494
|
}
|
|
6280
|
-
let unixExternalUpper;
|
|
6281
6495
|
if (!msDosCompatible) {
|
|
6282
6496
|
const unixModeProvided = unixMode !== UNDEFINED_VALUE || Boolean(setuid || setgid || sticky);
|
|
6283
|
-
|
|
6284
|
-
unixMode = unixMode === UNDEFINED_VALUE ?
|
|
6497
|
+
const defaultUnixMode = (externalFileAttributes >> 16) & MAX_16_BITS;
|
|
6498
|
+
unixMode = unixMode === UNDEFINED_VALUE ? defaultUnixMode : (unixMode & MAX_16_BITS);
|
|
6285
6499
|
if (setuid) {
|
|
6286
6500
|
unixMode |= FILE_ATTR_UNIX_SETUID_MASK;
|
|
6287
6501
|
} else {
|
|
@@ -6310,17 +6524,20 @@
|
|
|
6310
6524
|
if (hasMsDosProvided) {
|
|
6311
6525
|
externalFileAttributes = (externalFileAttributes & MAX_32_BITS) | (msdosAttributesRaw & MAX_8_BITS);
|
|
6312
6526
|
}
|
|
6527
|
+
const unixExternalUpper = (externalFileAttributes >> 16) & MAX_16_BITS;
|
|
6528
|
+
const symlink = unixMode !== UNDEFINED_VALUE && ((unixMode & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_SYMLINK);
|
|
6313
6529
|
return {
|
|
6314
6530
|
name,
|
|
6315
6531
|
resolvedOptions: {
|
|
6316
6532
|
versionMadeBy,
|
|
6317
|
-
msDosCompatible,
|
|
6533
|
+
msDosCompatible: Boolean(msDosCompatible),
|
|
6318
6534
|
externalFileAttributes,
|
|
6319
6535
|
unixExternalUpper,
|
|
6320
6536
|
uid,
|
|
6321
6537
|
gid,
|
|
6322
6538
|
unixMode,
|
|
6323
6539
|
unixExtraFieldType,
|
|
6540
|
+
symlink,
|
|
6324
6541
|
setuid,
|
|
6325
6542
|
setgid,
|
|
6326
6543
|
sticky,
|
|
@@ -6331,7 +6548,7 @@
|
|
|
6331
6548
|
}
|
|
6332
6549
|
|
|
6333
6550
|
function resolveMetadata(zipWriter, name, options) {
|
|
6334
|
-
const encode =
|
|
6551
|
+
const encode = getFunctionOptionValue(zipWriter, options, OPTION_ENCODE_TEXT) || encodeText;
|
|
6335
6552
|
let rawFilename = encode(name, TEXT_TYPE_FILENAME);
|
|
6336
6553
|
if (rawFilename === UNDEFINED_VALUE) {
|
|
6337
6554
|
rawFilename = encodeText(name);
|
|
@@ -6340,6 +6557,10 @@
|
|
|
6340
6557
|
throw new Error(ERR_INVALID_ENTRY_NAME);
|
|
6341
6558
|
}
|
|
6342
6559
|
const comment = options[PROPERTY_NAME_COMMENT] || "";
|
|
6560
|
+
// deno-lint-ignore valid-typeof
|
|
6561
|
+
if (typeof comment != STRING_TYPE) {
|
|
6562
|
+
throw new Error(ERR_INVALID_ENTRY_COMMENT_TYPE);
|
|
6563
|
+
}
|
|
6343
6564
|
let rawComment = encode(comment, TEXT_TYPE_COMMENT);
|
|
6344
6565
|
if (rawComment === UNDEFINED_VALUE) {
|
|
6345
6566
|
rawComment = encodeText(comment);
|
|
@@ -6351,16 +6572,14 @@
|
|
|
6351
6572
|
if (version > MAX_16_BITS) {
|
|
6352
6573
|
throw new Error(ERR_INVALID_VERSION);
|
|
6353
6574
|
}
|
|
6354
|
-
const lastModDate =
|
|
6355
|
-
const lastAccessDate =
|
|
6356
|
-
const creationDate =
|
|
6575
|
+
const lastModDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
|
|
6576
|
+
const lastAccessDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
6577
|
+
const creationDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
|
|
6357
6578
|
const internalFileAttributes = getAliasedOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_DEPRECATED_INTERNAL_FILE_ATTRIBUTES, 0);
|
|
6358
6579
|
const passThrough = getOptionValue(zipWriter, options, OPTION_PASS_THROUGH);
|
|
6359
6580
|
const password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
|
|
6360
6581
|
const rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
|
|
6361
|
-
|
|
6362
|
-
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
6363
|
-
}
|
|
6582
|
+
checkPasswordOption(password, rawPassword);
|
|
6364
6583
|
const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
|
|
6365
6584
|
const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
|
|
6366
6585
|
const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
|
|
@@ -6369,9 +6588,9 @@
|
|
|
6369
6588
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
6370
6589
|
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS);
|
|
6371
6590
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
6372
|
-
const createTempStream =
|
|
6591
|
+
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6373
6592
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6374
|
-
const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
|
|
6593
|
+
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6375
6594
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6376
6595
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6377
6596
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -6451,18 +6670,26 @@
|
|
|
6451
6670
|
if (!extraField) {
|
|
6452
6671
|
return EMPTY_UINT8_ARRAY;
|
|
6453
6672
|
}
|
|
6673
|
+
if (!(extraField instanceof Map)) {
|
|
6674
|
+
throw new Error(ERR_INVALID_EXTRAFIELD);
|
|
6675
|
+
}
|
|
6454
6676
|
let extraFieldSize = 0;
|
|
6455
6677
|
let offset = 0;
|
|
6456
|
-
extraField.forEach(data => extraFieldSize += 4 + getLength(data));
|
|
6457
|
-
const rawExtraField = new Uint8Array(extraFieldSize);
|
|
6458
|
-
const rawExtraFieldView = getDataView(rawExtraField);
|
|
6459
6678
|
extraField.forEach((data, type) => {
|
|
6460
|
-
if (type > MAX_16_BITS) {
|
|
6679
|
+
if (!Number.isInteger(type) || type < 0 || type > MAX_16_BITS) {
|
|
6461
6680
|
throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
|
|
6462
6681
|
}
|
|
6682
|
+
if (!(data instanceof Uint8Array)) {
|
|
6683
|
+
throw new Error(ERR_INVALID_EXTRAFIELD_DATA_TYPE);
|
|
6684
|
+
}
|
|
6463
6685
|
if (getLength(data) > MAX_16_BITS) {
|
|
6464
6686
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6465
6687
|
}
|
|
6688
|
+
extraFieldSize += 4 + getLength(data);
|
|
6689
|
+
});
|
|
6690
|
+
const rawExtraField = new Uint8Array(extraFieldSize);
|
|
6691
|
+
const rawExtraFieldView = getDataView(rawExtraField);
|
|
6692
|
+
extraField.forEach((data, type) => {
|
|
6466
6693
|
setUint16(rawExtraFieldView, offset, type);
|
|
6467
6694
|
setUint16(rawExtraFieldView, offset + 2, getLength(data));
|
|
6468
6695
|
arraySet(rawExtraField, data, offset + 4);
|
|
@@ -6550,7 +6777,7 @@
|
|
|
6550
6777
|
|
|
6551
6778
|
async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
6552
6779
|
const {
|
|
6553
|
-
|
|
6780
|
+
fileEntries,
|
|
6554
6781
|
writer
|
|
6555
6782
|
} = zipWriter;
|
|
6556
6783
|
const {
|
|
@@ -6572,12 +6799,12 @@
|
|
|
6572
6799
|
let writerSizeBeforeEntry;
|
|
6573
6800
|
let flushedBufferedSize = 0;
|
|
6574
6801
|
let fileWriter;
|
|
6575
|
-
|
|
6802
|
+
fileEntries.set(name, fileEntry);
|
|
6576
6803
|
zipWriter.lastFileEntry = fileEntry;
|
|
6577
6804
|
try {
|
|
6578
6805
|
let lockPreviousFileEntry;
|
|
6579
6806
|
if (keepOrder) {
|
|
6580
|
-
lockPreviousFileEntry = previousFileEntry && previousFileEntry.
|
|
6807
|
+
lockPreviousFileEntry = previousFileEntry && previousFileEntry.lockFileEntry;
|
|
6581
6808
|
requestLockCurrentFileEntry();
|
|
6582
6809
|
}
|
|
6583
6810
|
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || !dataDescriptor) {
|
|
@@ -6598,11 +6825,8 @@
|
|
|
6598
6825
|
const diskOffset = getDiskOffset(writer);
|
|
6599
6826
|
if (zipWriter.addSplitZipSignature) {
|
|
6600
6827
|
delete zipWriter.addSplitZipSignature;
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
setUint32(signatureArrayView, 0, SPLIT_ZIP_FILE_SIGNATURE);
|
|
6604
|
-
await writeData(writer, signatureArray);
|
|
6605
|
-
zipWriter.offset += 4;
|
|
6828
|
+
await writeData(writer, getSplitZipSignatureArray());
|
|
6829
|
+
zipWriter.offset += SPLIT_ZIP_FILE_SIGNATURE_LENGTH;
|
|
6606
6830
|
}
|
|
6607
6831
|
if (usdz && !bufferedWrite) {
|
|
6608
6832
|
appendExtraFieldUSDZ(entryInfo, zipWriter.offset - diskOffset);
|
|
@@ -6620,11 +6844,11 @@
|
|
|
6620
6844
|
writerSizeBeforeEntry = writer.size;
|
|
6621
6845
|
await writeData(fileWriter, localHeaderArray);
|
|
6622
6846
|
}
|
|
6623
|
-
fileEntry = await createFileEntry(reader, fileWriter, fileEntry, entryInfo,
|
|
6847
|
+
fileEntry = await createFileEntry(reader, fileWriter, fileEntry, entryInfo, getConfiguration(), options);
|
|
6624
6848
|
if (!bufferedWrite) {
|
|
6625
6849
|
writingEntryData = false;
|
|
6626
6850
|
}
|
|
6627
|
-
|
|
6851
|
+
fileEntries.set(name, fileEntry);
|
|
6628
6852
|
fileEntry.filename = name;
|
|
6629
6853
|
if (bufferedWrite) {
|
|
6630
6854
|
await Promise.all([fileWriter.writable.getWriter().close(), lockPreviousFileEntry]);
|
|
@@ -6665,7 +6889,7 @@
|
|
|
6665
6889
|
zipWriter.offset += flushedBufferedSize;
|
|
6666
6890
|
}
|
|
6667
6891
|
}
|
|
6668
|
-
|
|
6892
|
+
fileEntries.delete(name);
|
|
6669
6893
|
throw error;
|
|
6670
6894
|
} finally {
|
|
6671
6895
|
if (bufferedWrite) {
|
|
@@ -6687,7 +6911,7 @@
|
|
|
6687
6911
|
}
|
|
6688
6912
|
|
|
6689
6913
|
function requestLockCurrentFileEntry() {
|
|
6690
|
-
fileEntry.
|
|
6914
|
+
fileEntry.lockFileEntry = new Promise(resolve => releaseLockCurrentFileEntry = resolve);
|
|
6691
6915
|
}
|
|
6692
6916
|
|
|
6693
6917
|
async function requestLockWriter() {
|
|
@@ -6707,7 +6931,7 @@
|
|
|
6707
6931
|
}
|
|
6708
6932
|
}
|
|
6709
6933
|
|
|
6710
|
-
async function createFileEntry(reader, writer, { diskNumberStart,
|
|
6934
|
+
async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry }, entryInfo, config, options) {
|
|
6711
6935
|
const {
|
|
6712
6936
|
headerInfo,
|
|
6713
6937
|
dataDescriptorInfo,
|
|
@@ -6762,6 +6986,7 @@
|
|
|
6762
6986
|
uid,
|
|
6763
6987
|
gid,
|
|
6764
6988
|
unixMode,
|
|
6989
|
+
symlink,
|
|
6765
6990
|
setuid,
|
|
6766
6991
|
setgid,
|
|
6767
6992
|
sticky,
|
|
@@ -6774,7 +6999,7 @@
|
|
|
6774
6999
|
codecURI
|
|
6775
7000
|
} = options;
|
|
6776
7001
|
const fileEntry = {
|
|
6777
|
-
|
|
7002
|
+
lockFileEntry,
|
|
6778
7003
|
versionMadeBy,
|
|
6779
7004
|
zip64,
|
|
6780
7005
|
directory: Boolean(directory),
|
|
@@ -6798,6 +7023,7 @@
|
|
|
6798
7023
|
uid,
|
|
6799
7024
|
gid,
|
|
6800
7025
|
unixMode,
|
|
7026
|
+
symlink: Boolean(symlink),
|
|
6801
7027
|
setuid,
|
|
6802
7028
|
setgid,
|
|
6803
7029
|
sticky,
|
|
@@ -6815,7 +7041,7 @@
|
|
|
6815
7041
|
}
|
|
6816
7042
|
const { writable } = writer;
|
|
6817
7043
|
if (reader) {
|
|
6818
|
-
const readable = toCompatibleReadable(
|
|
7044
|
+
const readable = toCompatibleReadable(createReadable(reader));
|
|
6819
7045
|
const size = reader.size;
|
|
6820
7046
|
const workerOptions = {
|
|
6821
7047
|
options: {
|
|
@@ -6878,8 +7104,8 @@
|
|
|
6878
7104
|
rawLastModDate,
|
|
6879
7105
|
creationDate,
|
|
6880
7106
|
lastAccessDate,
|
|
6881
|
-
encrypted,
|
|
6882
|
-
zipCrypto,
|
|
7107
|
+
encrypted: Boolean(encrypted),
|
|
7108
|
+
zipCrypto: Boolean(zipCrypto),
|
|
6883
7109
|
size: metadataSize + compressedSize,
|
|
6884
7110
|
compressionMethod,
|
|
6885
7111
|
version,
|
|
@@ -6927,14 +7153,14 @@
|
|
|
6927
7153
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
6928
7154
|
const length = 4 + 16;
|
|
6929
7155
|
const extraFieldZip64 = createRecordWriter(length);
|
|
6930
|
-
extraFieldZip64.
|
|
6931
|
-
extraFieldZip64.
|
|
7156
|
+
extraFieldZip64.writeUint16(EXTRAFIELD_TYPE_ZIP64);
|
|
7157
|
+
extraFieldZip64.writeUint16(length - 4);
|
|
6932
7158
|
rawLocalExtraFieldZip64 = extraFieldZip64.array;
|
|
6933
7159
|
if (zip64ExtraFieldComplete) {
|
|
6934
|
-
extraFieldZip64.
|
|
7160
|
+
extraFieldZip64.writeUint64(uncompressedSize);
|
|
6935
7161
|
if (uncompressedFile) {
|
|
6936
7162
|
const encryptionOverhead = encrypted ? (zipCrypto ? 12 : 16 + encryptionStrength * 4) : 0;
|
|
6937
|
-
extraFieldZip64.
|
|
7163
|
+
extraFieldZip64.writeUint64(passThrough ? 0 : uncompressedSize + encryptionOverhead);
|
|
6938
7164
|
}
|
|
6939
7165
|
}
|
|
6940
7166
|
} else {
|
|
@@ -6943,8 +7169,8 @@
|
|
|
6943
7169
|
let rawExtraFieldAES;
|
|
6944
7170
|
if (encrypted && !zipCrypto) {
|
|
6945
7171
|
const extraFieldAES = createRecordWriter(getLength(EXTRAFIELD_DATA_AES) + 2);
|
|
6946
|
-
extraFieldAES.
|
|
6947
|
-
extraFieldAES.
|
|
7172
|
+
extraFieldAES.writeUint16(EXTRAFIELD_TYPE_AES);
|
|
7173
|
+
extraFieldAES.writeBytes(EXTRAFIELD_DATA_AES);
|
|
6948
7174
|
rawExtraFieldAES = extraFieldAES.array;
|
|
6949
7175
|
rawExtraFieldAES[8] = encryptionStrength;
|
|
6950
7176
|
} else {
|
|
@@ -6960,15 +7186,15 @@
|
|
|
6960
7186
|
const extraFieldTimestampLength = 9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0);
|
|
6961
7187
|
const extraFieldTimestamp = createRecordWriter(extraFieldTimestampLength);
|
|
6962
7188
|
extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
|
|
6963
|
-
extraFieldTimestamp.
|
|
6964
|
-
extraFieldTimestamp.
|
|
6965
|
-
extraFieldTimestamp.
|
|
6966
|
-
extraFieldTimestamp.
|
|
7189
|
+
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7190
|
+
extraFieldTimestamp.writeUint16(extraFieldTimestampLength - 4);
|
|
7191
|
+
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
7192
|
+
extraFieldTimestamp.writeUint32(lastModTimeUnix);
|
|
6967
7193
|
if (lastAccessDate) {
|
|
6968
|
-
extraFieldTimestamp.
|
|
7194
|
+
extraFieldTimestamp.writeUint32(clampUnixTime(getTimeUnix(lastAccessDate)));
|
|
6969
7195
|
}
|
|
6970
7196
|
if (creationDate) {
|
|
6971
|
-
extraFieldTimestamp.
|
|
7197
|
+
extraFieldTimestamp.writeUint32(clampUnixTime(getTimeUnix(creationDate)));
|
|
6972
7198
|
}
|
|
6973
7199
|
rawExtraFieldExtendedTimestamp = extraFieldTimestamp.array;
|
|
6974
7200
|
} else {
|
|
@@ -6981,14 +7207,14 @@
|
|
|
6981
7207
|
try {
|
|
6982
7208
|
const lastModTimeNTFS = getTimeNTFS(lastModDate);
|
|
6983
7209
|
const extraFieldNTFS = createRecordWriter(36);
|
|
6984
|
-
extraFieldNTFS.
|
|
6985
|
-
extraFieldNTFS.
|
|
7210
|
+
extraFieldNTFS.writeUint16(EXTRAFIELD_TYPE_NTFS);
|
|
7211
|
+
extraFieldNTFS.writeUint16(32);
|
|
6986
7212
|
extraFieldNTFS.skip(4);
|
|
6987
|
-
extraFieldNTFS.
|
|
6988
|
-
extraFieldNTFS.
|
|
6989
|
-
extraFieldNTFS.
|
|
6990
|
-
extraFieldNTFS.
|
|
6991
|
-
extraFieldNTFS.
|
|
7213
|
+
extraFieldNTFS.writeUint16(EXTRAFIELD_TYPE_NTFS_TAG1);
|
|
7214
|
+
extraFieldNTFS.writeUint16(24);
|
|
7215
|
+
extraFieldNTFS.writeUint64(lastModTimeNTFS);
|
|
7216
|
+
extraFieldNTFS.writeUint64(lastAccessDate ? getTimeNTFS(lastAccessDate) : lastModTimeNTFS);
|
|
7217
|
+
extraFieldNTFS.writeUint64(creationDate ? getTimeNTFS(creationDate) : lastModTimeNTFS);
|
|
6992
7218
|
rawExtraFieldNTFS = extraFieldNTFS.array;
|
|
6993
7219
|
} catch {
|
|
6994
7220
|
rawExtraFieldNTFS = EMPTY_UINT8_ARRAY;
|
|
@@ -7007,20 +7233,20 @@
|
|
|
7007
7233
|
const gidBytes = packUnixId(gid);
|
|
7008
7234
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
7009
7235
|
const extraFieldUnix = createRecordWriter(4 + payloadLength);
|
|
7010
|
-
extraFieldUnix.
|
|
7011
|
-
extraFieldUnix.
|
|
7012
|
-
extraFieldUnix.
|
|
7013
|
-
extraFieldUnix.
|
|
7014
|
-
extraFieldUnix.
|
|
7015
|
-
extraFieldUnix.
|
|
7016
|
-
extraFieldUnix.
|
|
7236
|
+
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_INFOZIP);
|
|
7237
|
+
extraFieldUnix.writeUint16(payloadLength);
|
|
7238
|
+
extraFieldUnix.writeUint8(1);
|
|
7239
|
+
extraFieldUnix.writeUint8(uidBytes.length);
|
|
7240
|
+
extraFieldUnix.writeBytes(uidBytes);
|
|
7241
|
+
extraFieldUnix.writeUint8(gidBytes.length);
|
|
7242
|
+
extraFieldUnix.writeBytes(gidBytes);
|
|
7017
7243
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7018
7244
|
} else if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7019
7245
|
const extraFieldUnix = createRecordWriter(8);
|
|
7020
|
-
extraFieldUnix.
|
|
7021
|
-
extraFieldUnix.
|
|
7022
|
-
extraFieldUnix.
|
|
7023
|
-
extraFieldUnix.
|
|
7246
|
+
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
7247
|
+
extraFieldUnix.writeUint16(4);
|
|
7248
|
+
extraFieldUnix.writeUint16((uid === UNDEFINED_VALUE ? 0 : uid) & MAX_16_BITS);
|
|
7249
|
+
extraFieldUnix.writeUint16((gid === UNDEFINED_VALUE ? 0 : gid) & MAX_16_BITS);
|
|
7024
7250
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7025
7251
|
} else {
|
|
7026
7252
|
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
@@ -7070,18 +7296,18 @@
|
|
|
7070
7296
|
const localHeader = createRecordWriter(HEADER_SIZE + getLength(rawFilename) + extraFieldLength);
|
|
7071
7297
|
const localHeaderArray = localHeader.array;
|
|
7072
7298
|
const localHeaderView = getDataView(localHeaderArray);
|
|
7073
|
-
localHeader.
|
|
7074
|
-
localHeader.
|
|
7075
|
-
localHeader.
|
|
7299
|
+
localHeader.writeUint32(LOCAL_FILE_HEADER_SIGNATURE);
|
|
7300
|
+
localHeader.writeBytes(headerArray);
|
|
7301
|
+
localHeader.writeBytes(rawFilename);
|
|
7076
7302
|
if (writeLocalExtraFieldZip64) {
|
|
7077
|
-
localHeader.
|
|
7078
|
-
}
|
|
7079
|
-
localHeader.
|
|
7080
|
-
localHeader.
|
|
7081
|
-
localHeader.
|
|
7082
|
-
localHeader.
|
|
7083
|
-
localHeader.
|
|
7084
|
-
localHeader.
|
|
7303
|
+
localHeader.writeBytes(rawLocalExtraFieldZip64);
|
|
7304
|
+
}
|
|
7305
|
+
localHeader.writeBytes(rawExtraFieldAES);
|
|
7306
|
+
localHeader.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
7307
|
+
localHeader.writeBytes(rawExtraFieldNTFS);
|
|
7308
|
+
localHeader.writeBytes(rawExtraFieldUnix);
|
|
7309
|
+
localHeader.writeBytes(rawExtraField);
|
|
7310
|
+
localHeader.writeBytes(rawLocalExtraField);
|
|
7085
7311
|
if (dataDescriptor) {
|
|
7086
7312
|
if (!zip64CompressedSize) {
|
|
7087
7313
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + LOCAL_HEADER_COMMON_OFFSET, 0);
|
|
@@ -7271,7 +7497,7 @@
|
|
|
7271
7497
|
|
|
7272
7498
|
|
|
7273
7499
|
async function closeFile(zipWriter, comment, options) {
|
|
7274
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.
|
|
7500
|
+
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7275
7501
|
const { directoryStart, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7276
7502
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7277
7503
|
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryDataLength, signatureLength });
|
|
@@ -7301,19 +7527,19 @@
|
|
|
7301
7527
|
if (zip64Offset || zip64DiskNumberStart || zip64UncompressedSize || zip64CompressedSize) {
|
|
7302
7528
|
const length = 4 + (zip64UncompressedSize ? 8 : 0) + (zip64CompressedSize ? 8 : 0) + (zip64Offset ? 8 : 0) + (zip64DiskNumberStart ? 4 : 0);
|
|
7303
7529
|
const extraFieldZip64 = createRecordWriter(length);
|
|
7304
|
-
extraFieldZip64.
|
|
7305
|
-
extraFieldZip64.
|
|
7530
|
+
extraFieldZip64.writeUint16(EXTRAFIELD_TYPE_ZIP64);
|
|
7531
|
+
extraFieldZip64.writeUint16(length - 4);
|
|
7306
7532
|
if (zip64UncompressedSize) {
|
|
7307
|
-
extraFieldZip64.
|
|
7533
|
+
extraFieldZip64.writeUint64(uncompressedSize);
|
|
7308
7534
|
}
|
|
7309
7535
|
if (zip64CompressedSize) {
|
|
7310
|
-
extraFieldZip64.
|
|
7536
|
+
extraFieldZip64.writeUint64(compressedSize);
|
|
7311
7537
|
}
|
|
7312
7538
|
if (zip64Offset) {
|
|
7313
|
-
extraFieldZip64.
|
|
7539
|
+
extraFieldZip64.writeUint64(fileEntry.offset);
|
|
7314
7540
|
}
|
|
7315
7541
|
if (zip64DiskNumberStart) {
|
|
7316
|
-
extraFieldZip64.
|
|
7542
|
+
extraFieldZip64.writeUint32(fileEntry.diskNumberStart);
|
|
7317
7543
|
}
|
|
7318
7544
|
rawExtraFieldZip64 = extraFieldZip64.array;
|
|
7319
7545
|
} else {
|
|
@@ -7326,10 +7552,10 @@
|
|
|
7326
7552
|
const lastModTimeUnix = getTimeUnix(lastModDate);
|
|
7327
7553
|
if (extendedTimestamp && inUnixTimeRange(lastModTimeUnix)) {
|
|
7328
7554
|
const extraFieldTimestamp = createRecordWriter(9);
|
|
7329
|
-
extraFieldTimestamp.
|
|
7330
|
-
extraFieldTimestamp.
|
|
7331
|
-
extraFieldTimestamp.
|
|
7332
|
-
extraFieldTimestamp.
|
|
7555
|
+
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7556
|
+
extraFieldTimestamp.writeUint16(5);
|
|
7557
|
+
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
7558
|
+
extraFieldTimestamp.writeUint32(lastModTimeUnix);
|
|
7333
7559
|
rawExtraFieldTimestamp = extraFieldTimestamp.array;
|
|
7334
7560
|
} else {
|
|
7335
7561
|
rawExtraFieldTimestamp = EMPTY_UINT8_ARRAY;
|
|
@@ -7351,14 +7577,14 @@
|
|
|
7351
7577
|
}
|
|
7352
7578
|
|
|
7353
7579
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
7354
|
-
const {
|
|
7580
|
+
const { fileEntries, writer } = zipWriter;
|
|
7355
7581
|
const directoryArray = new Uint8Array(directoryDataLength);
|
|
7356
7582
|
await initStream(writer);
|
|
7357
7583
|
let offset = 0;
|
|
7358
7584
|
let directoryDiskOffset = 0;
|
|
7359
7585
|
let directoryStartDiskNumber = getDiskNumber(writer);
|
|
7360
7586
|
let directoryStartDiskOffset = getDiskOffset(writer);
|
|
7361
|
-
for (const [indexFileEntry, fileEntry] of Array.from(
|
|
7587
|
+
for (const [indexFileEntry, fileEntry] of Array.from(fileEntries.values()).entries()) {
|
|
7362
7588
|
const {
|
|
7363
7589
|
offset: fileEntryOffset,
|
|
7364
7590
|
rawFilename,
|
|
@@ -7403,28 +7629,28 @@
|
|
|
7403
7629
|
setUint16(headerView, HEADER_OFFSET_VERSION, VERSION_ZIP64);
|
|
7404
7630
|
}
|
|
7405
7631
|
const directoryRecord = createRecordWriter(directoryRecordLength);
|
|
7406
|
-
directoryRecord.
|
|
7407
|
-
directoryRecord.
|
|
7408
|
-
directoryRecord.
|
|
7409
|
-
directoryRecord.
|
|
7410
|
-
directoryRecord.
|
|
7411
|
-
directoryRecord.
|
|
7412
|
-
directoryRecord.
|
|
7413
|
-
directoryRecord.
|
|
7414
|
-
directoryRecord.
|
|
7415
|
-
directoryRecord.
|
|
7416
|
-
directoryRecord.
|
|
7417
|
-
directoryRecord.
|
|
7418
|
-
directoryRecord.
|
|
7419
|
-
directoryRecord.
|
|
7420
|
-
directoryRecord.
|
|
7421
|
-
directoryRecord.
|
|
7422
|
-
directoryRecord.
|
|
7632
|
+
directoryRecord.writeUint32(CENTRAL_FILE_HEADER_SIGNATURE);
|
|
7633
|
+
directoryRecord.writeUint16(versionMadeBy);
|
|
7634
|
+
directoryRecord.writeBytes(headerArray.subarray(0, HEADER_SIZE - 4 - 2));
|
|
7635
|
+
directoryRecord.writeUint16(extraFieldLength);
|
|
7636
|
+
directoryRecord.writeUint16(getLength(rawComment));
|
|
7637
|
+
directoryRecord.writeUint16(zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
|
|
7638
|
+
directoryRecord.writeUint16(internalFileAttributes);
|
|
7639
|
+
directoryRecord.writeUint32(externalFileAttributes);
|
|
7640
|
+
directoryRecord.writeUint32(zip64Offset ? MAX_32_BITS : fileEntryOffset);
|
|
7641
|
+
directoryRecord.writeBytes(rawFilename);
|
|
7642
|
+
directoryRecord.writeBytes(rawExtraFieldZip64);
|
|
7643
|
+
directoryRecord.writeBytes(rawExtraFieldAES);
|
|
7644
|
+
directoryRecord.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
7645
|
+
directoryRecord.writeBytes(rawExtraFieldNTFS);
|
|
7646
|
+
directoryRecord.writeBytes(rawExtraFieldUnix);
|
|
7647
|
+
directoryRecord.writeBytes(rawExtraField);
|
|
7648
|
+
directoryRecord.writeBytes(rawComment);
|
|
7423
7649
|
arraySet(directoryArray, directoryRecord.array, offset);
|
|
7424
7650
|
offset += directoryRecordLength;
|
|
7425
7651
|
if (options.onprogress) {
|
|
7426
7652
|
try {
|
|
7427
|
-
await options.onprogress(indexFileEntry + 1,
|
|
7653
|
+
await options.onprogress(indexFileEntry + 1, fileEntries.size, new Entry(fileEntry));
|
|
7428
7654
|
} catch {
|
|
7429
7655
|
// ignored
|
|
7430
7656
|
}
|
|
@@ -7438,7 +7664,7 @@
|
|
|
7438
7664
|
}
|
|
7439
7665
|
|
|
7440
7666
|
async function writeDigitalSignatureRecord(zipWriter, directoryArray, options) {
|
|
7441
|
-
const signCentralDirectory =
|
|
7667
|
+
const signCentralDirectory = getFunctionOptionValue(zipWriter, options, OPTION_SIGN_CENTRAL_DIRECTORY);
|
|
7442
7668
|
if (signCentralDirectory) {
|
|
7443
7669
|
const signatureData = await signCentralDirectory(directoryArray);
|
|
7444
7670
|
const signatureDataLength = getLength(signatureData);
|
|
@@ -7446,9 +7672,9 @@
|
|
|
7446
7672
|
throw new Error(ERR_INVALID_SIGNATURE_DATA);
|
|
7447
7673
|
}
|
|
7448
7674
|
const signatureRecord = createRecordWriter(6 + signatureDataLength);
|
|
7449
|
-
signatureRecord.
|
|
7450
|
-
signatureRecord.
|
|
7451
|
-
signatureRecord.
|
|
7675
|
+
signatureRecord.writeUint32(DIGITAL_SIGNATURE_RECORD_SIGNATURE);
|
|
7676
|
+
signatureRecord.writeUint16(signatureDataLength);
|
|
7677
|
+
signatureRecord.writeBytes(signatureData);
|
|
7452
7678
|
await writeData(zipWriter.writer, signatureRecord.array);
|
|
7453
7679
|
return 6 + signatureDataLength;
|
|
7454
7680
|
}
|
|
@@ -7459,7 +7685,7 @@
|
|
|
7459
7685
|
const { writer } = zipWriter;
|
|
7460
7686
|
const { directoryStart, signatureLength } = cdInfo;
|
|
7461
7687
|
let { directoryDataLength } = cdInfo;
|
|
7462
|
-
let
|
|
7688
|
+
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
7463
7689
|
let diskNumber = directoryStart.diskNumber;
|
|
7464
7690
|
let directoryOffset = getSegmentOffset(zipWriter, directoryStart);
|
|
7465
7691
|
let lastDiskNumber = getDiskNumber(writer);
|
|
@@ -7467,7 +7693,7 @@
|
|
|
7467
7693
|
lastDiskNumber++;
|
|
7468
7694
|
}
|
|
7469
7695
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
7470
|
-
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS ||
|
|
7696
|
+
if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || fileEntriesLength >= MAX_16_BITS || lastDiskNumber >= MAX_16_BITS) {
|
|
7471
7697
|
if (zip64 === false) {
|
|
7472
7698
|
throw new Error(ERR_UNSUPPORTED_FORMAT);
|
|
7473
7699
|
} else {
|
|
@@ -7484,37 +7710,37 @@
|
|
|
7484
7710
|
}
|
|
7485
7711
|
lastDiskNumber = getDiskNumber(writer);
|
|
7486
7712
|
if (zip64) {
|
|
7487
|
-
endOfdirectoryRecord.
|
|
7488
|
-
endOfdirectoryRecord.
|
|
7489
|
-
endOfdirectoryRecord.
|
|
7490
|
-
endOfdirectoryRecord.
|
|
7491
|
-
endOfdirectoryRecord.
|
|
7492
|
-
endOfdirectoryRecord.
|
|
7493
|
-
endOfdirectoryRecord.
|
|
7494
|
-
endOfdirectoryRecord.
|
|
7495
|
-
endOfdirectoryRecord.
|
|
7496
|
-
endOfdirectoryRecord.
|
|
7497
|
-
endOfdirectoryRecord.
|
|
7498
|
-
endOfdirectoryRecord.
|
|
7499
|
-
endOfdirectoryRecord.
|
|
7500
|
-
endOfdirectoryRecord.
|
|
7713
|
+
endOfdirectoryRecord.writeUint32(ZIP64_END_OF_CENTRAL_DIR_SIGNATURE);
|
|
7714
|
+
endOfdirectoryRecord.writeUint64(44);
|
|
7715
|
+
endOfdirectoryRecord.writeUint16(45);
|
|
7716
|
+
endOfdirectoryRecord.writeUint16(45);
|
|
7717
|
+
endOfdirectoryRecord.writeUint32(lastDiskNumber);
|
|
7718
|
+
endOfdirectoryRecord.writeUint32(diskNumber);
|
|
7719
|
+
endOfdirectoryRecord.writeUint64(fileEntriesLength);
|
|
7720
|
+
endOfdirectoryRecord.writeUint64(fileEntriesLength);
|
|
7721
|
+
endOfdirectoryRecord.writeUint64(directoryDataLength);
|
|
7722
|
+
endOfdirectoryRecord.writeUint64(directoryOffset);
|
|
7723
|
+
endOfdirectoryRecord.writeUint32(ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);
|
|
7724
|
+
endOfdirectoryRecord.writeUint32(lastDiskNumber);
|
|
7725
|
+
endOfdirectoryRecord.writeUint64(BigInt(getSegmentOffset(zipWriter, writer)) + BigInt(directoryDataLength) + BigInt(signatureLength));
|
|
7726
|
+
endOfdirectoryRecord.writeUint32(lastDiskNumber + 1);
|
|
7501
7727
|
const supportZip64SplitFile = getOptionValue(zipWriter, options, OPTION_SUPPORT_ZIP64_SPLIT_FILE, true);
|
|
7502
7728
|
if (supportZip64SplitFile) {
|
|
7503
7729
|
lastDiskNumber = MAX_16_BITS;
|
|
7504
7730
|
diskNumber = MAX_16_BITS;
|
|
7505
7731
|
}
|
|
7506
|
-
|
|
7732
|
+
fileEntriesLength = MAX_16_BITS;
|
|
7507
7733
|
directoryOffset = MAX_32_BITS;
|
|
7508
7734
|
directoryDataLength = MAX_32_BITS;
|
|
7509
7735
|
}
|
|
7510
|
-
endOfdirectoryRecord.
|
|
7511
|
-
endOfdirectoryRecord.
|
|
7512
|
-
endOfdirectoryRecord.
|
|
7513
|
-
endOfdirectoryRecord.
|
|
7514
|
-
endOfdirectoryRecord.
|
|
7515
|
-
endOfdirectoryRecord.
|
|
7516
|
-
endOfdirectoryRecord.
|
|
7517
|
-
endOfdirectoryRecord.
|
|
7736
|
+
endOfdirectoryRecord.writeUint32(END_OF_CENTRAL_DIR_SIGNATURE);
|
|
7737
|
+
endOfdirectoryRecord.writeUint16(lastDiskNumber);
|
|
7738
|
+
endOfdirectoryRecord.writeUint16(diskNumber);
|
|
7739
|
+
endOfdirectoryRecord.writeUint16(fileEntriesLength);
|
|
7740
|
+
endOfdirectoryRecord.writeUint16(fileEntriesLength);
|
|
7741
|
+
endOfdirectoryRecord.writeUint32(directoryDataLength);
|
|
7742
|
+
endOfdirectoryRecord.writeUint32(directoryOffset);
|
|
7743
|
+
endOfdirectoryRecord.writeUint16(commentLength);
|
|
7518
7744
|
await writeData(writer, endOfdirectoryRecord.array);
|
|
7519
7745
|
if (commentLength) {
|
|
7520
7746
|
await writeData(writer, comment);
|
|
@@ -7527,11 +7753,11 @@
|
|
|
7527
7753
|
let offset = 0;
|
|
7528
7754
|
return {
|
|
7529
7755
|
array,
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7756
|
+
writeUint8: value => { setUint8(view, offset, value); offset += 1; },
|
|
7757
|
+
writeUint16: value => { setUint16(view, offset, value); offset += 2; },
|
|
7758
|
+
writeUint32: value => { setUint32(view, offset, value); offset += 4; },
|
|
7759
|
+
writeUint64: value => { setBigUint64(view, offset, BigInt(value)); offset += 8; },
|
|
7760
|
+
writeBytes: value => { arraySet(array, value, offset); offset += getLength(value); },
|
|
7535
7761
|
skip: count => offset += count
|
|
7536
7762
|
};
|
|
7537
7763
|
}
|
|
@@ -7555,6 +7781,71 @@
|
|
|
7555
7781
|
return zipWriter.offset - diskOffset - (diskNumber ? zipWriter.initialOffset : 0);
|
|
7556
7782
|
}
|
|
7557
7783
|
|
|
7784
|
+
async function startsWithSplitZipSignature(reader) {
|
|
7785
|
+
const signatureArray = await readUint8Array(reader, 0, SPLIT_ZIP_FILE_SIGNATURE_LENGTH);
|
|
7786
|
+
return getUint32(getDataView(signatureArray), 0) == SPLIT_ZIP_FILE_SIGNATURE;
|
|
7787
|
+
}
|
|
7788
|
+
|
|
7789
|
+
async function copyZipData(zipWriter, reader, entries, directoryOffset, splitZipSignatureLength) {
|
|
7790
|
+
const { writer } = zipWriter;
|
|
7791
|
+
const entryPositions = new Map();
|
|
7792
|
+
if (writer.closeDisk) {
|
|
7793
|
+
const sortedEntries = Array.from(entries).sort((firstEntry, secondEntry) =>
|
|
7794
|
+
getSourceOffset(reader, firstEntry) - getSourceOffset(reader, secondEntry));
|
|
7795
|
+
let copiedLength = 0;
|
|
7796
|
+
for (const entry of sortedEntries) {
|
|
7797
|
+
const sourceOffset = getSourceOffset(reader, entry);
|
|
7798
|
+
await copyData(zipWriter, reader, copiedLength, sourceOffset - copiedLength);
|
|
7799
|
+
if (exceedsAvailableSize(writer, await getLocalHeaderLength(reader, sourceOffset))) {
|
|
7800
|
+
await writer.closeDisk();
|
|
7801
|
+
}
|
|
7802
|
+
entryPositions.set(entry, {
|
|
7803
|
+
offset: getSegmentOffset(zipWriter, writer),
|
|
7804
|
+
diskNumberStart: getDiskNumber(writer)
|
|
7805
|
+
});
|
|
7806
|
+
copiedLength = sourceOffset;
|
|
7807
|
+
}
|
|
7808
|
+
await copyData(zipWriter, reader, copiedLength, directoryOffset - copiedLength);
|
|
7809
|
+
} else {
|
|
7810
|
+
await copyData(zipWriter, reader, 0, directoryOffset);
|
|
7811
|
+
entries.forEach(entry => entryPositions.set(entry, {
|
|
7812
|
+
offset: splitZipSignatureLength + getSourceOffset(reader, entry),
|
|
7813
|
+
diskNumberStart: 0
|
|
7814
|
+
}));
|
|
7815
|
+
}
|
|
7816
|
+
return entryPositions;
|
|
7817
|
+
}
|
|
7818
|
+
|
|
7819
|
+
async function copyData(zipWriter, reader, offset, size) {
|
|
7820
|
+
if (size > 0) {
|
|
7821
|
+
const { writer } = zipWriter;
|
|
7822
|
+
await createReadable(reader, { offset, size }).pipeTo(writer.writable, { preventClose: true, preventAbort: true });
|
|
7823
|
+
writer.size += size;
|
|
7824
|
+
zipWriter.offset += size;
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
|
|
7828
|
+
async function getLocalHeaderLength(reader, offset) {
|
|
7829
|
+
const headerArray = await readUint8Array(reader, offset, HEADER_SIZE);
|
|
7830
|
+
if (getLength(headerArray) < HEADER_SIZE) {
|
|
7831
|
+
return HEADER_SIZE;
|
|
7832
|
+
}
|
|
7833
|
+
const headerView = getDataView(headerArray);
|
|
7834
|
+
return HEADER_SIZE +
|
|
7835
|
+
getUint16(headerView, HEADER_OFFSET_FILENAME_LENGTH + LOCAL_HEADER_COMMON_OFFSET) +
|
|
7836
|
+
getUint16(headerView, HEADER_OFFSET_EXTRAFIELD_LENGTH + LOCAL_HEADER_COMMON_OFFSET);
|
|
7837
|
+
}
|
|
7838
|
+
|
|
7839
|
+
function getSourceOffset(reader, { offset, diskNumberStart }) {
|
|
7840
|
+
return offset + (reader.getDiskOffset ? reader.getDiskOffset(diskNumberStart) : 0);
|
|
7841
|
+
}
|
|
7842
|
+
|
|
7843
|
+
function getSplitZipSignatureArray() {
|
|
7844
|
+
const signatureArray = new Uint8Array(SPLIT_ZIP_FILE_SIGNATURE_LENGTH);
|
|
7845
|
+
setUint32(getDataView(signatureArray), 0, SPLIT_ZIP_FILE_SIGNATURE);
|
|
7846
|
+
return signatureArray;
|
|
7847
|
+
}
|
|
7848
|
+
|
|
7558
7849
|
async function writeData(writer, array) {
|
|
7559
7850
|
const { writable } = writer;
|
|
7560
7851
|
const streamWriter = writable.getWriter();
|
|
@@ -7606,6 +7897,21 @@
|
|
|
7606
7897
|
return result === UNDEFINED_VALUE ? defaultValue : result;
|
|
7607
7898
|
}
|
|
7608
7899
|
|
|
7900
|
+
function getDateOptionValue(zipWriter, options, name, defaultValue) {
|
|
7901
|
+
const date = getOptionValue(zipWriter, options, name, defaultValue);
|
|
7902
|
+
if (date === null) {
|
|
7903
|
+
return defaultValue;
|
|
7904
|
+
}
|
|
7905
|
+
if (date !== UNDEFINED_VALUE && (typeof date.getTime != FUNCTION_TYPE || Number.isNaN(date.getTime()))) {
|
|
7906
|
+
throw new Error(ERR_INVALID_DATE);
|
|
7907
|
+
}
|
|
7908
|
+
return date;
|
|
7909
|
+
}
|
|
7910
|
+
|
|
7911
|
+
function getFunctionOptionValue(zipWriter, options, name) {
|
|
7912
|
+
return checkFunctionOption(getOptionValue(zipWriter, options, name));
|
|
7913
|
+
}
|
|
7914
|
+
|
|
7609
7915
|
function getAliasedOptionValue(zipWriter, options, name, deprecatedName, defaultValue) {
|
|
7610
7916
|
const value = getAliasedValue(options, name, deprecatedName);
|
|
7611
7917
|
const result = value === UNDEFINED_VALUE ? getAliasedValue(zipWriter.options, name, deprecatedName) : value;
|
|
@@ -7620,9 +7926,6 @@
|
|
|
7620
7926
|
return toNumber(getOptionValue(zipWriter, options, name, defaultValue));
|
|
7621
7927
|
}
|
|
7622
7928
|
|
|
7623
|
-
function toNumber(value) {
|
|
7624
|
-
return typeof value == STRING_TYPE && value.trim() ? Number(value) : value;
|
|
7625
|
-
}
|
|
7626
7929
|
|
|
7627
7930
|
function getMaximumCompressedSize(uncompressedSize) {
|
|
7628
7931
|
return uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1));
|
|
@@ -7634,6 +7937,14 @@
|
|
|
7634
7937
|
: compressionMethod !== COMPRESSION_METHOD_STORE;
|
|
7635
7938
|
}
|
|
7636
7939
|
|
|
7940
|
+
function getUint16(view, offset) {
|
|
7941
|
+
return view.getUint16(offset, true);
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
function getUint32(view, offset) {
|
|
7945
|
+
return view.getUint32(offset, true);
|
|
7946
|
+
}
|
|
7947
|
+
|
|
7637
7948
|
function setUint8(view, offset, value) {
|
|
7638
7949
|
view.setUint8(offset, value);
|
|
7639
7950
|
}
|
|
@@ -7677,9 +7988,9 @@
|
|
|
7677
7988
|
const headerRecord = createRecordWriter(HEADER_SIZE - 4);
|
|
7678
7989
|
const headerArray = headerRecord.array;
|
|
7679
7990
|
const headerView = getDataView(headerArray);
|
|
7680
|
-
headerRecord.
|
|
7681
|
-
headerRecord.
|
|
7682
|
-
headerRecord.
|
|
7991
|
+
headerRecord.writeUint16(version);
|
|
7992
|
+
headerRecord.writeUint16(bitFlag);
|
|
7993
|
+
headerRecord.writeUint16(compressionMethod);
|
|
7683
7994
|
if (rawLastModDate === UNDEFINED_VALUE) {
|
|
7684
7995
|
const dateArray = new Uint32Array(1);
|
|
7685
7996
|
const dateView = getDataView(dateArray);
|
|
@@ -7687,20 +7998,20 @@
|
|
|
7687
7998
|
setUint16(dateView, 2, ((((lastModDate.getFullYear() - 1980) << 4) | (lastModDate.getMonth() + 1)) << 5) | lastModDate.getDate());
|
|
7688
7999
|
rawLastModDate = dateArray[0];
|
|
7689
8000
|
}
|
|
7690
|
-
headerRecord.
|
|
8001
|
+
headerRecord.writeUint32(rawLastModDate);
|
|
7691
8002
|
headerRecord.skip(4);
|
|
7692
8003
|
if (zip64CompressedSize || compressedSize !== UNDEFINED_VALUE) {
|
|
7693
|
-
headerRecord.
|
|
8004
|
+
headerRecord.writeUint32(zip64CompressedSize ? MAX_32_BITS : compressedSize);
|
|
7694
8005
|
} else {
|
|
7695
8006
|
headerRecord.skip(4);
|
|
7696
8007
|
}
|
|
7697
8008
|
if (zip64UncompressedSize || uncompressedSize !== UNDEFINED_VALUE) {
|
|
7698
|
-
headerRecord.
|
|
8009
|
+
headerRecord.writeUint32(zip64UncompressedSize ? MAX_32_BITS : uncompressedSize);
|
|
7699
8010
|
} else {
|
|
7700
8011
|
headerRecord.skip(4);
|
|
7701
8012
|
}
|
|
7702
|
-
headerRecord.
|
|
7703
|
-
headerRecord.
|
|
8013
|
+
headerRecord.writeUint16(getLength(rawFilename));
|
|
8014
|
+
headerRecord.writeUint16(extraFieldLength);
|
|
7704
8015
|
return {
|
|
7705
8016
|
headerArray,
|
|
7706
8017
|
headerView,
|
|
@@ -8657,6 +8968,7 @@
|
|
|
8657
8968
|
exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
|
|
8658
8969
|
exports.ERR_ENCRYPTED = ERR_ENCRYPTED;
|
|
8659
8970
|
exports.ERR_ENCRYPTED_CENTRAL_DIRECTORY = ERR_ENCRYPTED_CENTRAL_DIRECTORY;
|
|
8971
|
+
exports.ERR_ENTRY_DATA_OUT_OF_BOUNDS = ERR_ENTRY_DATA_OUT_OF_BOUNDS;
|
|
8660
8972
|
exports.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND;
|
|
8661
8973
|
exports.ERR_EOCDR_NOT_FOUND = ERR_EOCDR_NOT_FOUND;
|
|
8662
8974
|
exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
|
|
@@ -8666,21 +8978,29 @@
|
|
|
8666
8978
|
exports.ERR_INVALID_CODEC_DEFINITION = ERR_INVALID_CODEC_DEFINITION;
|
|
8667
8979
|
exports.ERR_INVALID_CODEC_MODULE = ERR_INVALID_CODEC_MODULE;
|
|
8668
8980
|
exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
|
|
8981
|
+
exports.ERR_INVALID_COMMENT_TYPE = ERR_INVALID_COMMENT_TYPE;
|
|
8669
8982
|
exports.ERR_INVALID_COMPRESSED_DATA = ERR_INVALID_COMPRESSED_DATA;
|
|
8670
8983
|
exports.ERR_INVALID_CRC32 = ERR_INVALID_CRC32;
|
|
8984
|
+
exports.ERR_INVALID_DATE = ERR_INVALID_DATE;
|
|
8671
8985
|
exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
|
|
8672
8986
|
exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
|
|
8987
|
+
exports.ERR_INVALID_ENTRY_COMMENT_TYPE = ERR_INVALID_ENTRY_COMMENT_TYPE;
|
|
8673
8988
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|
|
8989
|
+
exports.ERR_INVALID_EXTRAFIELD = ERR_INVALID_EXTRAFIELD;
|
|
8674
8990
|
exports.ERR_INVALID_EXTRAFIELD_DATA = ERR_INVALID_EXTRAFIELD_DATA;
|
|
8991
|
+
exports.ERR_INVALID_EXTRAFIELD_DATA_TYPE = ERR_INVALID_EXTRAFIELD_DATA_TYPE;
|
|
8675
8992
|
exports.ERR_INVALID_EXTRAFIELD_TYPE = ERR_INVALID_EXTRAFIELD_TYPE;
|
|
8676
8993
|
exports.ERR_INVALID_FILENAME_VALIDATION = ERR_INVALID_FILENAME_VALIDATION;
|
|
8994
|
+
exports.ERR_INVALID_FUNCTION_OPTION = ERR_INVALID_FUNCTION_OPTION;
|
|
8677
8995
|
exports.ERR_INVALID_GID = ERR_INVALID_GID;
|
|
8678
8996
|
exports.ERR_INVALID_LEVEL = ERR_INVALID_LEVEL;
|
|
8679
8997
|
exports.ERR_INVALID_MAX_APPENDED_DATA_SIZE = ERR_INVALID_MAX_APPENDED_DATA_SIZE;
|
|
8998
|
+
exports.ERR_INVALID_MAX_WORKERS = ERR_INVALID_MAX_WORKERS;
|
|
8680
8999
|
exports.ERR_INVALID_MSDOS_ATTRIBUTES = ERR_INVALID_MSDOS_ATTRIBUTES;
|
|
8681
9000
|
exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
8682
9001
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
8683
9002
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
9003
|
+
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
8684
9004
|
exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
|
|
8685
9005
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
8686
9006
|
exports.ERR_INVALID_STRICTNESS = ERR_INVALID_STRICTNESS;
|