@zip.js/zip.js 2.7.55 → 2.7.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/zip-fs-full.js +121 -69
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +121 -61
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +113 -64
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +113 -56
- package/dist/zip.min.js +1 -1
- package/index.cjs +121 -69
- package/index.d.ts +7 -1
- package/index.min.js +1 -1
- package/lib/core/constants.js +2 -0
- package/lib/core/zip-entry.js +5 -1
- package/lib/core/zip-writer.js +38 -17
- package/package.json +1 -1
package/deno.json
CHANGED
package/dist/zip-fs-full.js
CHANGED
|
@@ -1246,7 +1246,6 @@
|
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
1248
|
// Copy as much as possible from input to output:
|
|
1249
|
-
// eslint-disable-next-line no-constant-condition
|
|
1250
1249
|
while (true) {
|
|
1251
1250
|
// Fill the win as much as possible:
|
|
1252
1251
|
if (lookahead <= 1) {
|
|
@@ -1341,7 +1340,6 @@
|
|
|
1341
1340
|
|
|
1342
1341
|
// We check for insufficient lookahead only every 8th comparison;
|
|
1343
1342
|
// the 256th check will be made at strstart+258.
|
|
1344
|
-
// eslint-disable-next-line no-empty
|
|
1345
1343
|
do {
|
|
1346
1344
|
// empty block
|
|
1347
1345
|
} while (win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match]
|
|
@@ -1377,7 +1375,6 @@
|
|
|
1377
1375
|
let hash_head = 0; // head of the hash chain
|
|
1378
1376
|
let bflush; // set if current block must be flushed
|
|
1379
1377
|
|
|
1380
|
-
// eslint-disable-next-line no-constant-condition
|
|
1381
1378
|
while (true) {
|
|
1382
1379
|
// Make sure that we always have enough lookahead, except
|
|
1383
1380
|
// at the end of the input file. We need MAX_MATCH bytes
|
|
@@ -1484,7 +1481,6 @@
|
|
|
1484
1481
|
let max_insert;
|
|
1485
1482
|
|
|
1486
1483
|
// Process the input block.
|
|
1487
|
-
// eslint-disable-next-line no-constant-condition
|
|
1488
1484
|
while (true) {
|
|
1489
1485
|
// Make sure that we always have enough lookahead, except
|
|
1490
1486
|
// at the end of the input file. We need MAX_MATCH bytes
|
|
@@ -2834,7 +2830,6 @@
|
|
|
2834
2830
|
m = q < s.read ? s.read - q - 1 : s.end - q;
|
|
2835
2831
|
|
|
2836
2832
|
// process input and output based on current state
|
|
2837
|
-
// eslint-disable-next-line no-constant-condition
|
|
2838
2833
|
while (true) {
|
|
2839
2834
|
switch (mode) {
|
|
2840
2835
|
// waiting for "i:"=input, "o:"=output, "x:"=nothing
|
|
@@ -3325,7 +3320,6 @@
|
|
|
3325
3320
|
|
|
3326
3321
|
// process input based on current state
|
|
3327
3322
|
// DEBUG dtree
|
|
3328
|
-
// eslint-disable-next-line no-constant-condition
|
|
3329
3323
|
while (true) {
|
|
3330
3324
|
let bl, bd, tl, td, bl_, bd_, tl_, td_;
|
|
3331
3325
|
switch (mode) {
|
|
@@ -3602,7 +3596,6 @@
|
|
|
3602
3596
|
mode = DTREE;
|
|
3603
3597
|
/* falls through */
|
|
3604
3598
|
case DTREE:
|
|
3605
|
-
// eslint-disable-next-line no-constant-condition
|
|
3606
3599
|
while (true) {
|
|
3607
3600
|
t = table;
|
|
3608
3601
|
if (index >= 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) {
|
|
@@ -3910,7 +3903,6 @@
|
|
|
3910
3903
|
const istate = z.istate;
|
|
3911
3904
|
f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
|
|
3912
3905
|
r = Z_BUF_ERROR;
|
|
3913
|
-
// eslint-disable-next-line no-constant-condition
|
|
3914
3906
|
while (true) {
|
|
3915
3907
|
switch (istate.mode) {
|
|
3916
3908
|
case METHOD:
|
|
@@ -4290,6 +4282,9 @@
|
|
|
4290
4282
|
const BITFLAG_DATA_DESCRIPTOR = 0x0008;
|
|
4291
4283
|
const BITFLAG_LANG_ENCODING_FLAG = 0x0800;
|
|
4292
4284
|
const FILE_ATTR_MSDOS_DIR_MASK = 0x10;
|
|
4285
|
+
const FILE_ATTR_UNIX_DIR_MASK = 0x4000;
|
|
4286
|
+
const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;
|
|
4287
|
+
const FILE_ATTR_UNIX_DEFAULT_MASK = 0o644;
|
|
4293
4288
|
|
|
4294
4289
|
const VERSION_DEFLATE = 0x14;
|
|
4295
4290
|
const VERSION_ZIP64 = 0x2D;
|
|
@@ -4390,7 +4385,8 @@
|
|
|
4390
4385
|
if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
|
|
4391
4386
|
maxWorkers = navigator.hardwareConcurrency;
|
|
4392
4387
|
}
|
|
4393
|
-
|
|
4388
|
+
// eslint-disable-next-line no-unused-vars
|
|
4389
|
+
} catch (_) {
|
|
4394
4390
|
// ignored
|
|
4395
4391
|
}
|
|
4396
4392
|
const DEFAULT_CONFIGURATION = {
|
|
@@ -7396,7 +7392,8 @@
|
|
|
7396
7392
|
if (IMPORT_KEY_SUPPORTED) {
|
|
7397
7393
|
try {
|
|
7398
7394
|
return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
|
|
7399
|
-
|
|
7395
|
+
// eslint-disable-next-line no-unused-vars
|
|
7396
|
+
} catch (_) {
|
|
7400
7397
|
IMPORT_KEY_SUPPORTED = false;
|
|
7401
7398
|
return misc.importKey(password);
|
|
7402
7399
|
}
|
|
@@ -7409,7 +7406,8 @@
|
|
|
7409
7406
|
if (DERIVE_BITS_SUPPORTED) {
|
|
7410
7407
|
try {
|
|
7411
7408
|
return await subtle.deriveBits(algorithm, baseKey, length);
|
|
7412
|
-
|
|
7409
|
+
// eslint-disable-next-line no-unused-vars
|
|
7410
|
+
} catch (_) {
|
|
7413
7411
|
DERIVE_BITS_SUPPORTED = false;
|
|
7414
7412
|
return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
|
|
7415
7413
|
}
|
|
@@ -7727,11 +7725,13 @@
|
|
|
7727
7725
|
try {
|
|
7728
7726
|
const CompressionStream = useCompressionStream && CodecStreamNative ? CodecStreamNative : CodecStream;
|
|
7729
7727
|
readable = pipeThrough(readable, new CompressionStream(COMPRESSION_FORMAT, options));
|
|
7730
|
-
|
|
7728
|
+
// eslint-disable-next-line no-unused-vars
|
|
7729
|
+
} catch (_) {
|
|
7731
7730
|
if (useCompressionStream) {
|
|
7732
7731
|
try {
|
|
7733
7732
|
readable = pipeThrough(readable, new CodecStream(COMPRESSION_FORMAT, options));
|
|
7734
|
-
|
|
7733
|
+
// eslint-disable-next-line no-unused-vars
|
|
7734
|
+
} catch (_) {
|
|
7735
7735
|
return readable;
|
|
7736
7736
|
}
|
|
7737
7737
|
} else {
|
|
@@ -7974,7 +7974,8 @@
|
|
|
7974
7974
|
async function callHandler(handler, ...parameters) {
|
|
7975
7975
|
try {
|
|
7976
7976
|
await handler(...parameters);
|
|
7977
|
-
|
|
7977
|
+
// eslint-disable-next-line no-unused-vars
|
|
7978
|
+
} catch (_) {
|
|
7978
7979
|
// ignored
|
|
7979
7980
|
}
|
|
7980
7981
|
}
|
|
@@ -7991,7 +7992,8 @@
|
|
|
7991
7992
|
let worker;
|
|
7992
7993
|
try {
|
|
7993
7994
|
worker = getWebWorker(workerData.scripts[0], baseURL, workerData);
|
|
7994
|
-
|
|
7995
|
+
// eslint-disable-next-line no-unused-vars
|
|
7996
|
+
} catch (_) {
|
|
7995
7997
|
WEB_WORKERS_SUPPORTED = false;
|
|
7996
7998
|
return createWorkerInterface(workerData, config);
|
|
7997
7999
|
}
|
|
@@ -8094,13 +8096,15 @@
|
|
|
8094
8096
|
}
|
|
8095
8097
|
try {
|
|
8096
8098
|
scriptUrl = new URL(url, baseURL);
|
|
8097
|
-
|
|
8099
|
+
// eslint-disable-next-line no-unused-vars
|
|
8100
|
+
} catch (_) {
|
|
8098
8101
|
scriptUrl = url;
|
|
8099
8102
|
}
|
|
8100
8103
|
if (classicWorkersSupported) {
|
|
8101
8104
|
try {
|
|
8102
8105
|
worker = new Worker(scriptUrl);
|
|
8103
|
-
|
|
8106
|
+
// eslint-disable-next-line no-unused-vars
|
|
8107
|
+
} catch (_) {
|
|
8104
8108
|
classicWorkersSupported = false;
|
|
8105
8109
|
worker = new Worker(scriptUrl, workerOptions);
|
|
8106
8110
|
}
|
|
@@ -8138,7 +8142,8 @@
|
|
|
8138
8142
|
try {
|
|
8139
8143
|
worker.postMessage(message, transferables);
|
|
8140
8144
|
return true;
|
|
8141
|
-
|
|
8145
|
+
// eslint-disable-next-line no-unused-vars
|
|
8146
|
+
} catch (_) {
|
|
8142
8147
|
transferStreamsSupported = false;
|
|
8143
8148
|
message.readable = message.writable = null;
|
|
8144
8149
|
worker.postMessage(message);
|
|
@@ -8281,7 +8286,8 @@
|
|
|
8281
8286
|
pool = pool.filter(data => data != workerData);
|
|
8282
8287
|
try {
|
|
8283
8288
|
await workerData.terminate();
|
|
8284
|
-
|
|
8289
|
+
// eslint-disable-next-line no-unused-vars
|
|
8290
|
+
} catch (_) {
|
|
8285
8291
|
// ignored
|
|
8286
8292
|
}
|
|
8287
8293
|
}, terminateWorkerTimeout);
|
|
@@ -8686,7 +8692,7 @@
|
|
|
8686
8692
|
combineSizeEocd
|
|
8687
8693
|
} = httpReader;
|
|
8688
8694
|
if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRequest)) {
|
|
8689
|
-
const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -
|
|
8695
|
+
const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -22 : undefined));
|
|
8690
8696
|
if (!forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {
|
|
8691
8697
|
throw new Error(ERR_HTTP_RANGE);
|
|
8692
8698
|
} else {
|
|
@@ -9209,22 +9215,23 @@
|
|
|
9209
9215
|
const PROPERTY_NAME_CREATION_DATE = "creationDate";
|
|
9210
9216
|
const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
|
|
9211
9217
|
const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE = "internalFileAttribute";
|
|
9218
|
+
const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
|
|
9212
9219
|
const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE = "externalFileAttribute";
|
|
9220
|
+
const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
|
|
9213
9221
|
const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
|
|
9214
9222
|
const PROPERTY_NAME_ZIP64 = "zip64";
|
|
9215
9223
|
const PROPERTY_NAME_ENCRYPTED = "encrypted";
|
|
9216
9224
|
const PROPERTY_NAME_VERSION = "version";
|
|
9217
9225
|
const PROPERTY_NAME_VERSION_MADE_BY = "versionMadeBy";
|
|
9218
9226
|
const PROPERTY_NAME_ZIPCRYPTO = "zipCrypto";
|
|
9227
|
+
const PROPERTY_NAME_DIRECTORY = "directory";
|
|
9228
|
+
const PROPERTY_NAME_EXECUTABLE = "executable";
|
|
9219
9229
|
|
|
9220
9230
|
const PROPERTY_NAMES = [
|
|
9221
9231
|
PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, PROPERTY_NAME_COMPPRESSED_SIZE, PROPERTY_NAME_UNCOMPPRESSED_SIZE,
|
|
9222
9232
|
PROPERTY_NAME_LAST_MODIFICATION_DATE, PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT,
|
|
9223
9233
|
PROPERTY_NAME_LAST_ACCESS_DATE, PROPERTY_NAME_CREATION_DATE, PROPERTY_NAME_OFFSET, PROPERTY_NAME_DISK_NUMBER_START,
|
|
9224
|
-
PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
|
|
9225
|
-
PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY,
|
|
9226
|
-
PROPERTY_NAME_ZIPCRYPTO, "directory", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField",
|
|
9227
|
-
"extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
|
|
9234
|
+
PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY, PROPERTY_NAME_ZIPCRYPTO, PROPERTY_NAME_DIRECTORY, PROPERTY_NAME_EXECUTABLE, "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField", "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
|
|
9228
9235
|
|
|
9229
9236
|
class Entry {
|
|
9230
9237
|
|
|
@@ -9415,14 +9422,20 @@
|
|
|
9415
9422
|
const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
|
|
9416
9423
|
const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
|
|
9417
9424
|
const versionMadeBy = getUint16(directoryView, offset + 4);
|
|
9418
|
-
const msDosCompatible =
|
|
9425
|
+
const msDosCompatible = versionMadeBy >> 8 == 0;
|
|
9426
|
+
const unixCompatible = versionMadeBy >> 8 == 3;
|
|
9419
9427
|
const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
|
|
9420
9428
|
const commentLength = getUint16(directoryView, offset + 32);
|
|
9421
9429
|
const endOffset = commentOffset + commentLength;
|
|
9422
9430
|
const rawComment = directoryArray.subarray(commentOffset, endOffset);
|
|
9423
9431
|
const filenameUTF8 = languageEncodingFlag;
|
|
9424
9432
|
const commentUTF8 = languageEncodingFlag;
|
|
9425
|
-
const
|
|
9433
|
+
const externalFileAttributes = getUint32(directoryView, offset + 38);
|
|
9434
|
+
const directory =
|
|
9435
|
+
(msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK)) ||
|
|
9436
|
+
(unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_DIR_MASK) == FILE_ATTR_UNIX_DIR_MASK)) ||
|
|
9437
|
+
(rawFilename.length && rawFilename[rawFilename.length - 1] == DIRECTORY_SIGNATURE.charCodeAt(0));
|
|
9438
|
+
const executable = (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_EXECUTABLE_MASK) == FILE_ATTR_UNIX_EXECUTABLE_MASK));
|
|
9426
9439
|
const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
|
|
9427
9440
|
Object.assign(fileEntry, {
|
|
9428
9441
|
versionMadeBy,
|
|
@@ -9433,13 +9446,16 @@
|
|
|
9433
9446
|
directory,
|
|
9434
9447
|
offset: offsetFileEntry,
|
|
9435
9448
|
diskNumberStart: getUint16(directoryView, offset + 34),
|
|
9436
|
-
|
|
9437
|
-
|
|
9449
|
+
internalFileAttributes: getUint16(directoryView, offset + 36),
|
|
9450
|
+
externalFileAttributes,
|
|
9438
9451
|
rawFilename,
|
|
9439
9452
|
filenameUTF8,
|
|
9440
9453
|
commentUTF8,
|
|
9441
|
-
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
|
|
9454
|
+
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
|
|
9455
|
+
executable
|
|
9442
9456
|
});
|
|
9457
|
+
fileEntry.internalFileAttribute = fileEntry.internalFileAttributes;
|
|
9458
|
+
fileEntry.externalFileAttribute = fileEntry.externalFileAttributes;
|
|
9443
9459
|
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
|
|
9444
9460
|
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
|
|
9445
9461
|
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
|
|
@@ -9467,7 +9483,8 @@
|
|
|
9467
9483
|
if (onprogress) {
|
|
9468
9484
|
try {
|
|
9469
9485
|
await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
|
|
9470
|
-
|
|
9486
|
+
// eslint-disable-next-line no-unused-vars
|
|
9487
|
+
} catch (_) {
|
|
9471
9488
|
// ignored
|
|
9472
9489
|
}
|
|
9473
9490
|
}
|
|
@@ -9679,7 +9696,8 @@
|
|
|
9679
9696
|
});
|
|
9680
9697
|
offsetExtraField += 4 + size;
|
|
9681
9698
|
}
|
|
9682
|
-
|
|
9699
|
+
// eslint-disable-next-line no-unused-vars
|
|
9700
|
+
} catch (_) {
|
|
9683
9701
|
// ignored
|
|
9684
9702
|
}
|
|
9685
9703
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
@@ -9786,7 +9804,8 @@
|
|
|
9786
9804
|
}
|
|
9787
9805
|
offsetExtraField += 4 + attributeSize;
|
|
9788
9806
|
}
|
|
9789
|
-
|
|
9807
|
+
// eslint-disable-next-line no-unused-vars
|
|
9808
|
+
} catch (_) {
|
|
9790
9809
|
// ignored
|
|
9791
9810
|
}
|
|
9792
9811
|
try {
|
|
@@ -9807,7 +9826,8 @@
|
|
|
9807
9826
|
Object.assign(extraFieldNTFS, extraFieldData);
|
|
9808
9827
|
Object.assign(directory, extraFieldData);
|
|
9809
9828
|
}
|
|
9810
|
-
|
|
9829
|
+
// eslint-disable-next-line no-unused-vars
|
|
9830
|
+
} catch (_) {
|
|
9811
9831
|
// ignored
|
|
9812
9832
|
}
|
|
9813
9833
|
}
|
|
@@ -9876,7 +9896,8 @@
|
|
|
9876
9896
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
|
|
9877
9897
|
try {
|
|
9878
9898
|
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
9879
|
-
|
|
9899
|
+
// eslint-disable-next-line no-unused-vars
|
|
9900
|
+
} catch (_) {
|
|
9880
9901
|
// ignored
|
|
9881
9902
|
}
|
|
9882
9903
|
}
|
|
@@ -10055,10 +10076,37 @@
|
|
|
10055
10076
|
|
|
10056
10077
|
async function addFile(zipWriter, name, reader, options) {
|
|
10057
10078
|
name = name.trim();
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10079
|
+
const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
|
|
10080
|
+
const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768);
|
|
10081
|
+
const executable = getOptionValue(zipWriter, options, PROPERTY_NAME_EXECUTABLE);
|
|
10082
|
+
if (versionMadeBy > MAX_16_BITS) {
|
|
10083
|
+
throw new Error(ERR_INVALID_VERSION);
|
|
10084
|
+
}
|
|
10085
|
+
let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
|
|
10086
|
+
if (externalFileAttributes === 0) {
|
|
10087
|
+
externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
|
|
10088
|
+
}
|
|
10089
|
+
if (!options.directory && name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
10090
|
+
options.directory = true;
|
|
10091
|
+
}
|
|
10092
|
+
const directory = getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
|
|
10093
|
+
if (directory) {
|
|
10094
|
+
if (!name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
10095
|
+
name += DIRECTORY_SIGNATURE;
|
|
10096
|
+
}
|
|
10097
|
+
if (externalFileAttributes === 0) {
|
|
10098
|
+
if (msDosCompatible) {
|
|
10099
|
+
externalFileAttributes = FILE_ATTR_MSDOS_DIR_MASK;
|
|
10100
|
+
} else {
|
|
10101
|
+
externalFileAttributes = FILE_ATTR_UNIX_DIR_MASK << 16;
|
|
10102
|
+
}
|
|
10103
|
+
}
|
|
10104
|
+
} else if (!msDosCompatible && externalFileAttributes === 0) {
|
|
10105
|
+
if (executable) {
|
|
10106
|
+
externalFileAttributes = (FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
|
|
10107
|
+
} else {
|
|
10108
|
+
externalFileAttributes = FILE_ATTR_UNIX_DEFAULT_MASK << 16;
|
|
10109
|
+
}
|
|
10062
10110
|
}
|
|
10063
10111
|
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
|
|
10064
10112
|
let rawFilename = encode(name);
|
|
@@ -10080,16 +10128,13 @@
|
|
|
10080
10128
|
if (version > MAX_16_BITS) {
|
|
10081
10129
|
throw new Error(ERR_INVALID_VERSION);
|
|
10082
10130
|
}
|
|
10083
|
-
const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, 20);
|
|
10084
|
-
if (versionMadeBy > MAX_16_BITS) {
|
|
10085
|
-
throw new Error(ERR_INVALID_VERSION);
|
|
10086
|
-
}
|
|
10087
10131
|
const lastModDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
|
|
10088
10132
|
const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
10089
10133
|
const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10134
|
+
let internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
|
|
10135
|
+
if (internalFileAttributes === 0) {
|
|
10136
|
+
internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
|
|
10137
|
+
}
|
|
10093
10138
|
const passThrough = getOptionValue(zipWriter, options, "passThrough");
|
|
10094
10139
|
let password, rawPassword;
|
|
10095
10140
|
if (!passThrough) {
|
|
@@ -10205,8 +10250,10 @@
|
|
|
10205
10250
|
dataDescriptorSignature,
|
|
10206
10251
|
signal,
|
|
10207
10252
|
msDosCompatible,
|
|
10208
|
-
internalFileAttribute,
|
|
10209
|
-
|
|
10253
|
+
internalFileAttribute: internalFileAttributes,
|
|
10254
|
+
internalFileAttributes,
|
|
10255
|
+
externalFileAttribute: externalFileAttributes,
|
|
10256
|
+
externalFileAttributes,
|
|
10210
10257
|
useCompressionStream,
|
|
10211
10258
|
passThrough,
|
|
10212
10259
|
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
|
|
@@ -10327,7 +10374,8 @@
|
|
|
10327
10374
|
if (error) {
|
|
10328
10375
|
try {
|
|
10329
10376
|
error.corruptedEntry = true;
|
|
10330
|
-
|
|
10377
|
+
// eslint-disable-next-line no-unused-vars
|
|
10378
|
+
} catch (_) {
|
|
10331
10379
|
// ignored
|
|
10332
10380
|
}
|
|
10333
10381
|
}
|
|
@@ -10409,6 +10457,7 @@
|
|
|
10409
10457
|
zipCrypto,
|
|
10410
10458
|
dataDescriptor,
|
|
10411
10459
|
directory,
|
|
10460
|
+
executable,
|
|
10412
10461
|
versionMadeBy,
|
|
10413
10462
|
rawComment,
|
|
10414
10463
|
rawExtraField,
|
|
@@ -10420,8 +10469,8 @@
|
|
|
10420
10469
|
encryptionStrength,
|
|
10421
10470
|
extendedTimestamp,
|
|
10422
10471
|
msDosCompatible,
|
|
10423
|
-
|
|
10424
|
-
|
|
10472
|
+
internalFileAttributes,
|
|
10473
|
+
externalFileAttributes,
|
|
10425
10474
|
useCompressionStream,
|
|
10426
10475
|
passThrough
|
|
10427
10476
|
} = options;
|
|
@@ -10430,6 +10479,7 @@
|
|
|
10430
10479
|
versionMadeBy,
|
|
10431
10480
|
zip64,
|
|
10432
10481
|
directory: Boolean(directory),
|
|
10482
|
+
executable: Boolean(executable),
|
|
10433
10483
|
filenameUTF8: true,
|
|
10434
10484
|
rawFilename,
|
|
10435
10485
|
commentUTF8: true,
|
|
@@ -10440,8 +10490,8 @@
|
|
|
10440
10490
|
rawExtraField,
|
|
10441
10491
|
extendedTimestamp,
|
|
10442
10492
|
msDosCompatible,
|
|
10443
|
-
|
|
10444
|
-
|
|
10493
|
+
internalFileAttributes,
|
|
10494
|
+
externalFileAttributes,
|
|
10445
10495
|
diskNumberStart
|
|
10446
10496
|
};
|
|
10447
10497
|
let {
|
|
@@ -10601,7 +10651,8 @@
|
|
|
10601
10651
|
setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
|
|
10602
10652
|
setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
|
|
10603
10653
|
setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
|
|
10604
|
-
|
|
10654
|
+
// eslint-disable-next-line no-unused-vars
|
|
10655
|
+
} catch (_) {
|
|
10605
10656
|
rawExtraFieldNTFS = new Uint8Array();
|
|
10606
10657
|
}
|
|
10607
10658
|
} else {
|
|
@@ -10889,15 +10940,13 @@
|
|
|
10889
10940
|
rawComment,
|
|
10890
10941
|
versionMadeBy,
|
|
10891
10942
|
headerArray,
|
|
10892
|
-
directory,
|
|
10893
10943
|
zip64,
|
|
10894
10944
|
zip64UncompressedSize,
|
|
10895
10945
|
zip64CompressedSize,
|
|
10896
10946
|
zip64DiskNumberStart,
|
|
10897
10947
|
zip64Offset,
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
externalFileAttribute,
|
|
10948
|
+
internalFileAttributes,
|
|
10949
|
+
externalFileAttributes,
|
|
10901
10950
|
diskNumberStart,
|
|
10902
10951
|
uncompressedSize,
|
|
10903
10952
|
compressedSize
|
|
@@ -10916,11 +10965,9 @@
|
|
|
10916
10965
|
setUint16(directoryView, offset + 30, extraFieldLength);
|
|
10917
10966
|
setUint16(directoryView, offset + 32, getLength(rawComment));
|
|
10918
10967
|
setUint16(directoryView, offset + 34, zip64 && zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
|
|
10919
|
-
setUint16(directoryView, offset + 36,
|
|
10920
|
-
if (
|
|
10921
|
-
setUint32(directoryView, offset + 38,
|
|
10922
|
-
} else if (directory && msDosCompatible) {
|
|
10923
|
-
setUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);
|
|
10968
|
+
setUint16(directoryView, offset + 36, internalFileAttributes);
|
|
10969
|
+
if (externalFileAttributes) {
|
|
10970
|
+
setUint32(directoryView, offset + 38, externalFileAttributes);
|
|
10924
10971
|
}
|
|
10925
10972
|
setUint32(directoryView, offset + 42, zip64 && zip64Offset ? MAX_32_BITS : fileEntryOffset);
|
|
10926
10973
|
arraySet(directoryArray, rawFilename, offset + 46);
|
|
@@ -10940,7 +10987,8 @@
|
|
|
10940
10987
|
if (options.onprogress) {
|
|
10941
10988
|
try {
|
|
10942
10989
|
await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
|
|
10943
|
-
|
|
10990
|
+
// eslint-disable-next-line no-unused-vars
|
|
10991
|
+
} catch (_) {
|
|
10944
10992
|
// ignored
|
|
10945
10993
|
}
|
|
10946
10994
|
}
|
|
@@ -11463,7 +11511,8 @@
|
|
|
11463
11511
|
error.cause = {
|
|
11464
11512
|
entry
|
|
11465
11513
|
};
|
|
11466
|
-
|
|
11514
|
+
// eslint-disable-next-line no-unused-vars
|
|
11515
|
+
} catch (_) {
|
|
11467
11516
|
// ignored
|
|
11468
11517
|
}
|
|
11469
11518
|
throw error;
|
|
@@ -11720,7 +11769,8 @@
|
|
|
11720
11769
|
error.cause = {
|
|
11721
11770
|
entry: child
|
|
11722
11771
|
};
|
|
11723
|
-
|
|
11772
|
+
// eslint-disable-next-line no-unused-vars
|
|
11773
|
+
} catch (_) {
|
|
11724
11774
|
// ignored
|
|
11725
11775
|
}
|
|
11726
11776
|
throw error;
|
|
@@ -11766,7 +11816,7 @@
|
|
|
11766
11816
|
let zipEntryOptions = {};
|
|
11767
11817
|
if (child.data instanceof Entry) {
|
|
11768
11818
|
const {
|
|
11769
|
-
|
|
11819
|
+
externalFileAttributes,
|
|
11770
11820
|
versionMadeBy,
|
|
11771
11821
|
comment,
|
|
11772
11822
|
lastModDate,
|
|
@@ -11780,7 +11830,7 @@
|
|
|
11780
11830
|
extraFieldAES
|
|
11781
11831
|
} = child.data;
|
|
11782
11832
|
zipEntryOptions = {
|
|
11783
|
-
|
|
11833
|
+
externalFileAttributes,
|
|
11784
11834
|
versionMadeBy,
|
|
11785
11835
|
comment,
|
|
11786
11836
|
lastModDate,
|
|
@@ -11815,7 +11865,8 @@
|
|
|
11815
11865
|
entryOffsets.set(name, indexProgress);
|
|
11816
11866
|
try {
|
|
11817
11867
|
await options.onprogress(Array.from(entryOffsets.values()).reduce((previousValue, currentValue) => previousValue + currentValue), totalSize);
|
|
11818
|
-
|
|
11868
|
+
// eslint-disable-next-line no-unused-vars
|
|
11869
|
+
} catch (_) {
|
|
11819
11870
|
// ignored
|
|
11820
11871
|
}
|
|
11821
11872
|
}
|
|
@@ -11960,7 +12011,8 @@
|
|
|
11960
12011
|
let baseURL;
|
|
11961
12012
|
try {
|
|
11962
12013
|
baseURL = (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('zip-fs-full.js', document.baseURI).href));
|
|
11963
|
-
|
|
12014
|
+
// eslint-disable-next-line no-unused-vars
|
|
12015
|
+
} catch (_) {
|
|
11964
12016
|
// ignored
|
|
11965
12017
|
}
|
|
11966
12018
|
configure({ baseURL });
|