@zip.js/zip.js 2.8.44 → 2.8.45
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 +21 -1
- package/dist/zip-core-external.js +138 -123
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +137 -96
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +190 -131
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +189 -104
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +211 -1725
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +212 -1700
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +211 -1699
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +139 -98
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +139 -98
- 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 +138 -97
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +31 -2
- package/index-native.cjs +212 -1700
- package/index-native.min.js +1 -1
- package/index.cjs +211 -1699
- package/index.d.cts +49 -1
- package/index.d.ts +49 -1
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +2 -2
- package/lib/core/constants.js +4 -0
- package/lib/core/options.js +2 -0
- package/lib/core/streams/aes-crypto-stream.js +15 -18
- package/lib/core/streams/codec-stream.js +2 -2
- package/lib/core/streams/zip-entry-stream.js +5 -10
- package/lib/core/util/mime-type-data.js +3 -0
- package/lib/core/util/mime-type.js +23 -1596
- package/lib/core/web-worker-base.js +2 -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 -1
- package/lib/core/zip-fs.js +62 -5
- package/lib/core/zip-reader.js +45 -17
- package/lib/core/zip-writer.js +58 -44
- package/lib/zip-core-external.js +2 -0
- package/lib/zip-fs-core-external.js +2 -0
- package/lib/zip-fs-external.js +2 -0
- package/lib/zip-mime-types.js +2 -0
- package/package.json +9 -3
- package/worker-message-property-names.js +1 -1
package/deno.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zip-js/zip-js",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.45",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./index.js",
|
|
6
6
|
"./external": "./lib/zip-fs-external.js",
|
|
@@ -8,6 +8,24 @@
|
|
|
8
8
|
"./lib/zip-core-external.js": "./lib/zip-core-external.js",
|
|
9
9
|
"./lib/zip-fs-core-external.js": "./lib/zip-fs-core-external.js"
|
|
10
10
|
},
|
|
11
|
+
"publish": {
|
|
12
|
+
"exclude": [
|
|
13
|
+
"tests/",
|
|
14
|
+
"dist/",
|
|
15
|
+
"!dist/zip-web-worker.js",
|
|
16
|
+
"!dist/zip-module.wasm",
|
|
17
|
+
"*.cjs",
|
|
18
|
+
"index.d.cts",
|
|
19
|
+
"index.min.js",
|
|
20
|
+
"index-native.js",
|
|
21
|
+
"index-native.min.js",
|
|
22
|
+
"package.json",
|
|
23
|
+
"package-lock.json",
|
|
24
|
+
".npmignore",
|
|
25
|
+
"eslint.config.mjs",
|
|
26
|
+
"worker-message-property-names.js"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
11
29
|
"lint": {
|
|
12
30
|
"exclude": [
|
|
13
31
|
"dist/*.js",
|
|
@@ -22,6 +40,8 @@
|
|
|
22
40
|
"rollup*",
|
|
23
41
|
"reserved-property-names.js",
|
|
24
42
|
"mangled-property-names.js",
|
|
43
|
+
"mime-types.json",
|
|
44
|
+
"generate-mime-type-data.js",
|
|
25
45
|
"tsconfig.json",
|
|
26
46
|
".vscode",
|
|
27
47
|
".eslintrc.json",
|
|
@@ -62,6 +62,8 @@ const EXTRAFIELD_TYPE_UNICODE_COMMENT = 0x6375;
|
|
|
62
62
|
const EXTRAFIELD_TYPE_USDZ = 0x1986;
|
|
63
63
|
const EXTRAFIELD_TYPE_INFOZIP = 0x7875;
|
|
64
64
|
const EXTRAFIELD_TYPE_UNIX = 0x7855;
|
|
65
|
+
const EXTRAFIELD_TYPE_UNIX_TYPE1 = 0x5855;
|
|
66
|
+
const EXTRAFIELD_TYPE_PKWARE_UNIX = 0x000d;
|
|
65
67
|
|
|
66
68
|
const BITFLAG_ENCRYPTED = 0b1;
|
|
67
69
|
const BITFLAG_LEVEL = 0b0110;
|
|
@@ -1447,7 +1449,7 @@ const DERIVED_BITS_ALGORITHM = Object.assign({ iterations: 1000, hash: { name: H
|
|
|
1447
1449
|
const DERIVED_BITS_USAGE = ["deriveBits"];
|
|
1448
1450
|
const SALT_LENGTH = [8, 12, 16];
|
|
1449
1451
|
const KEY_LENGTH = [16, 24, 32];
|
|
1450
|
-
const
|
|
1452
|
+
const AUTHENTICATION_CODE_LENGTH = 10;
|
|
1451
1453
|
const COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
|
|
1452
1454
|
// deno-lint-ignore valid-typeof
|
|
1453
1455
|
const CRYPTO_API_SUPPORTED = typeof crypto != UNDEFINED_TYPE;
|
|
@@ -1487,8 +1489,8 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1487
1489
|
} else {
|
|
1488
1490
|
await ready;
|
|
1489
1491
|
}
|
|
1490
|
-
const output = new Uint8Array(chunk.length -
|
|
1491
|
-
controller.enqueue(append(aesCrypto, chunk, output, 0,
|
|
1492
|
+
const output = new Uint8Array(chunk.length - AUTHENTICATION_CODE_LENGTH - ((chunk.length - AUTHENTICATION_CODE_LENGTH) % BLOCK_LENGTH));
|
|
1493
|
+
controller.enqueue(append(aesCrypto, chunk, output, 0, AUTHENTICATION_CODE_LENGTH, true));
|
|
1492
1494
|
},
|
|
1493
1495
|
async flush(controller) {
|
|
1494
1496
|
const {
|
|
@@ -1499,8 +1501,8 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1499
1501
|
} = this;
|
|
1500
1502
|
if (hmac && ctr) {
|
|
1501
1503
|
await ready;
|
|
1502
|
-
const chunkToDecrypt = subarray(pending, 0, pending.length -
|
|
1503
|
-
const
|
|
1504
|
+
const chunkToDecrypt = subarray(pending, 0, pending.length - AUTHENTICATION_CODE_LENGTH);
|
|
1505
|
+
const originalAuthenticationCode = subarray(pending, pending.length - AUTHENTICATION_CODE_LENGTH);
|
|
1504
1506
|
let decryptedChunkArray = EMPTY_UINT8_ARRAY;
|
|
1505
1507
|
if (chunkToDecrypt.length) {
|
|
1506
1508
|
const encryptedChunk = toBits(codecBytes, chunkToDecrypt);
|
|
@@ -1508,12 +1510,12 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1508
1510
|
const decryptedChunk = ctr.update(encryptedChunk);
|
|
1509
1511
|
decryptedChunkArray = fromBits(codecBytes, decryptedChunk);
|
|
1510
1512
|
}
|
|
1511
|
-
const
|
|
1512
|
-
let
|
|
1513
|
-
for (let
|
|
1514
|
-
|
|
1513
|
+
const authenticationCode = subarray(fromBits(codecBytes, hmac.digest()), 0, AUTHENTICATION_CODE_LENGTH);
|
|
1514
|
+
let invalidAuthenticationCode = pending.length < AUTHENTICATION_CODE_LENGTH ? 1 : 0;
|
|
1515
|
+
for (let indexByte = 0; indexByte < AUTHENTICATION_CODE_LENGTH; indexByte++) {
|
|
1516
|
+
invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
|
|
1515
1517
|
}
|
|
1516
|
-
if (
|
|
1518
|
+
if (invalidAuthenticationCode && checkAuthenticationCode) {
|
|
1517
1519
|
throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
|
|
1518
1520
|
}
|
|
1519
1521
|
controller.enqueue(decryptedChunkArray);
|
|
@@ -1526,8 +1528,6 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1526
1528
|
class AESEncryptionStream extends TransformStream {
|
|
1527
1529
|
|
|
1528
1530
|
constructor({ password, rawPassword, encryptionStrength }) {
|
|
1529
|
-
// deno-lint-ignore prefer-const
|
|
1530
|
-
let stream;
|
|
1531
1531
|
super({
|
|
1532
1532
|
start() {
|
|
1533
1533
|
initAesCrypto(this, password, rawPassword, encryptionStrength);
|
|
@@ -1566,12 +1566,11 @@ class AESEncryptionStream extends TransformStream {
|
|
|
1566
1566
|
hmac.update(encryptedChunk);
|
|
1567
1567
|
encryptedChunkArray = fromBits(codecBytes, encryptedChunk);
|
|
1568
1568
|
}
|
|
1569
|
-
|
|
1570
|
-
controller.enqueue(concat(encryptedChunkArray,
|
|
1569
|
+
const authenticationCode = fromBits(codecBytes, hmac.digest()).slice(0, AUTHENTICATION_CODE_LENGTH);
|
|
1570
|
+
controller.enqueue(concat(encryptedChunkArray, authenticationCode));
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
1573
|
});
|
|
1574
|
-
stream = this;
|
|
1575
1574
|
}
|
|
1576
1575
|
}
|
|
1577
1576
|
|
|
@@ -1584,7 +1583,7 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
|
|
|
1584
1583
|
});
|
|
1585
1584
|
}
|
|
1586
1585
|
|
|
1587
|
-
function append(aesCrypto, input, output, paddingStart, paddingEnd,
|
|
1586
|
+
function append(aesCrypto, input, output, paddingStart, paddingEnd, verifyAuthenticationCode) {
|
|
1588
1587
|
const {
|
|
1589
1588
|
ctr,
|
|
1590
1589
|
hmac,
|
|
@@ -1598,11 +1597,11 @@ function append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignat
|
|
|
1598
1597
|
let offset;
|
|
1599
1598
|
for (offset = 0; offset <= inputLength - BLOCK_LENGTH; offset += BLOCK_LENGTH) {
|
|
1600
1599
|
const inputChunk = toBits(codecBytes, subarray(input, offset, offset + BLOCK_LENGTH));
|
|
1601
|
-
if (
|
|
1600
|
+
if (verifyAuthenticationCode) {
|
|
1602
1601
|
hmac.update(inputChunk);
|
|
1603
1602
|
}
|
|
1604
1603
|
const outputChunk = ctr.update(inputChunk);
|
|
1605
|
-
if (!
|
|
1604
|
+
if (!verifyAuthenticationCode) {
|
|
1606
1605
|
hmac.update(outputChunk);
|
|
1607
1606
|
}
|
|
1608
1607
|
output.set(fromBits(codecBytes, outputChunk), offset + paddingStart);
|
|
@@ -2008,14 +2007,9 @@ class DeflateStream extends TransformStream {
|
|
|
2008
2007
|
}
|
|
2009
2008
|
}
|
|
2010
2009
|
setReadable(stream, readable, () => {
|
|
2011
|
-
let signature;
|
|
2012
|
-
if (encrypted && !zipCrypto) {
|
|
2013
|
-
signature = encryptionStream.signature;
|
|
2014
|
-
}
|
|
2015
2010
|
if ((!encrypted || zipCrypto) && computeCrc32) {
|
|
2016
|
-
|
|
2011
|
+
stream.crc32 = useGzipCrc32 ? gzipCrc32Stream.crc32 : new DataView(crc32Stream.value.buffer).getUint32(0);
|
|
2017
2012
|
}
|
|
2018
|
-
stream.signature = signature;
|
|
2019
2013
|
});
|
|
2020
2014
|
}
|
|
2021
2015
|
}
|
|
@@ -2053,7 +2047,7 @@ class GzipToRawDeflateStream extends TransformStream {
|
|
|
2053
2047
|
},
|
|
2054
2048
|
flush() {
|
|
2055
2049
|
const dataView = getDataView(trailerCandidate);
|
|
2056
|
-
stream.
|
|
2050
|
+
stream.crc32 = dataView.getUint32(0, true);
|
|
2057
2051
|
stream.uncompressedSize = dataView.getUint32(4, true);
|
|
2058
2052
|
}
|
|
2059
2053
|
});
|
|
@@ -2135,7 +2129,7 @@ class InflateStream extends TransformStream {
|
|
|
2135
2129
|
|
|
2136
2130
|
constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
|
|
2137
2131
|
super({});
|
|
2138
|
-
const { zipCrypto, encrypted, checkCrc32,
|
|
2132
|
+
const { zipCrypto, encrypted, checkCrc32, crc32, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
|
|
2139
2133
|
let crc32Stream, decryptionStream;
|
|
2140
2134
|
let readable = super.readable;
|
|
2141
2135
|
if (encrypted) {
|
|
@@ -2174,8 +2168,8 @@ class InflateStream extends TransformStream {
|
|
|
2174
2168
|
}
|
|
2175
2169
|
setReadable(this, readable, () => {
|
|
2176
2170
|
if (checkCrc32) {
|
|
2177
|
-
const
|
|
2178
|
-
if (
|
|
2171
|
+
const computedCrc32View = new DataView(crc32Stream.value.buffer);
|
|
2172
|
+
if (crc32 != computedCrc32View.getUint32(0, false)) {
|
|
2179
2173
|
throw new Error(ERR_INVALID_CRC32);
|
|
2180
2174
|
}
|
|
2181
2175
|
}
|
|
@@ -2400,9 +2394,9 @@ class CodecStream extends TransformStream {
|
|
|
2400
2394
|
}
|
|
2401
2395
|
},
|
|
2402
2396
|
flush() {
|
|
2403
|
-
const {
|
|
2397
|
+
const { crc32 } = stream;
|
|
2404
2398
|
Object.assign(codec, {
|
|
2405
|
-
|
|
2399
|
+
crc32,
|
|
2406
2400
|
inputSize
|
|
2407
2401
|
});
|
|
2408
2402
|
}
|
|
@@ -2705,12 +2699,12 @@ async function runWorker$1({ options, readable, writable, onTaskFinished }, conf
|
|
|
2705
2699
|
.pipeThrough(new ChunkStream(getChunkSize(config)))
|
|
2706
2700
|
.pipeTo(writable, { preventClose: true, preventAbort: true });
|
|
2707
2701
|
const {
|
|
2708
|
-
|
|
2702
|
+
crc32,
|
|
2709
2703
|
inputSize,
|
|
2710
2704
|
outputSize
|
|
2711
2705
|
} = codecStream;
|
|
2712
2706
|
return {
|
|
2713
|
-
|
|
2707
|
+
crc32,
|
|
2714
2708
|
inputSize,
|
|
2715
2709
|
outputSize
|
|
2716
2710
|
};
|
|
@@ -4308,6 +4302,8 @@ const PROPERTY_NAME_CRC32 = "crc32";
|
|
|
4308
4302
|
const PROPERTY_NAME_EXTRA_FIELD = "extraField";
|
|
4309
4303
|
const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
|
|
4310
4304
|
const PROPERTY_NAME_EXTRA_FIELD_UNIX = "extraFieldUnix";
|
|
4305
|
+
const PROPERTY_NAME_EXTRA_FIELD_UNIX_TYPE1 = "extraFieldUnixType1";
|
|
4306
|
+
const PROPERTY_NAME_EXTRA_FIELD_PKWARE_UNIX = "extraFieldPkwareUnix";
|
|
4311
4307
|
const PROPERTY_NAME_UID = "uid";
|
|
4312
4308
|
const PROPERTY_NAME_GID = "gid";
|
|
4313
4309
|
const PROPERTY_NAME_UNIX_MODE = "unixMode";
|
|
@@ -4324,6 +4320,7 @@ const PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT = "extraFieldUnicodeComment";
|
|
|
4324
4320
|
const PROPERTY_NAME_EXTRA_FIELD_AES = "extraFieldAES";
|
|
4325
4321
|
const PROPERTY_NAME_EXTRA_FIELD_NTFS = "extraFieldNTFS";
|
|
4326
4322
|
const PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP = "extraFieldExtendedTimestamp";
|
|
4323
|
+
const PROPERTY_NAME_EXTRA_FIELD_USDZ = "extraFieldUSDZ";
|
|
4327
4324
|
|
|
4328
4325
|
const PROPERTY_NAMES = [
|
|
4329
4326
|
PROPERTY_NAME_FILENAME,
|
|
@@ -4335,6 +4332,7 @@ const PROPERTY_NAMES = [
|
|
|
4335
4332
|
PROPERTY_NAME_COMMENT,
|
|
4336
4333
|
PROPERTY_NAME_RAW_COMMENT,
|
|
4337
4334
|
PROPERTY_NAME_LAST_ACCESS_DATE,
|
|
4335
|
+
PROPERTY_NAME_RAW_LAST_ACCESS_DATE,
|
|
4338
4336
|
PROPERTY_NAME_CREATION_DATE,
|
|
4339
4337
|
PROPERTY_NAME_RAW_CREATION_DATE,
|
|
4340
4338
|
PROPERTY_NAME_OFFSET,
|
|
@@ -4357,6 +4355,8 @@ const PROPERTY_NAMES = [
|
|
|
4357
4355
|
PROPERTY_NAME_EXTRA_FIELD,
|
|
4358
4356
|
PROPERTY_NAME_EXTRA_FIELD_UNIX,
|
|
4359
4357
|
PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
|
|
4358
|
+
PROPERTY_NAME_EXTRA_FIELD_UNIX_TYPE1,
|
|
4359
|
+
PROPERTY_NAME_EXTRA_FIELD_PKWARE_UNIX,
|
|
4360
4360
|
PROPERTY_NAME_UID,
|
|
4361
4361
|
PROPERTY_NAME_GID,
|
|
4362
4362
|
PROPERTY_NAME_UNIX_MODE,
|
|
@@ -4372,7 +4372,8 @@ const PROPERTY_NAMES = [
|
|
|
4372
4372
|
PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT,
|
|
4373
4373
|
PROPERTY_NAME_EXTRA_FIELD_AES,
|
|
4374
4374
|
PROPERTY_NAME_EXTRA_FIELD_NTFS,
|
|
4375
|
-
PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP
|
|
4375
|
+
PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP,
|
|
4376
|
+
PROPERTY_NAME_EXTRA_FIELD_USDZ
|
|
4376
4377
|
];
|
|
4377
4378
|
|
|
4378
4379
|
class Entry {
|
|
@@ -4446,6 +4447,7 @@ const OPTION_ENCODE_TEXT = "encodeText";
|
|
|
4446
4447
|
const OPTION_OFFSET = "offset";
|
|
4447
4448
|
const OPTION_USDZ = "usdz";
|
|
4448
4449
|
const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
|
|
4450
|
+
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
4449
4451
|
const OPTION_STRICTNESS = "strictness";
|
|
4450
4452
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
4451
4453
|
const STRICTNESS_STRICT = "strict";
|
|
@@ -4498,7 +4500,7 @@ const CHARSET_UTF8 = "utf-8";
|
|
|
4498
4500
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4499
4501
|
const CHARSET_CP437 = "cp437";
|
|
4500
4502
|
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4501
|
-
const VENDOR_VERSION_AE_1 = 1;
|
|
4503
|
+
const VENDOR_VERSION_AE_1$1 = 1;
|
|
4502
4504
|
const ZIP64_PROPERTIES = [
|
|
4503
4505
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
4504
4506
|
[PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -4891,7 +4893,7 @@ class ZipEntry {
|
|
|
4891
4893
|
config,
|
|
4892
4894
|
bitFlag,
|
|
4893
4895
|
rawBitFlag,
|
|
4894
|
-
|
|
4896
|
+
crc32,
|
|
4895
4897
|
rawLastModDate,
|
|
4896
4898
|
uncompressedSize,
|
|
4897
4899
|
compressedSize
|
|
@@ -4982,7 +4984,7 @@ class ZipEntry {
|
|
|
4982
4984
|
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
4983
4985
|
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
4984
4986
|
checkCrc32Option) && !passThrough &&
|
|
4985
|
-
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1));
|
|
4987
|
+
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1$1));
|
|
4986
4988
|
const workerOptions = {
|
|
4987
4989
|
options: {
|
|
4988
4990
|
codecType: CODEC_INFLATE,
|
|
@@ -4992,9 +4994,9 @@ class ZipEntry {
|
|
|
4992
4994
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
4993
4995
|
checkCrc32,
|
|
4994
4996
|
checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
|
|
4995
|
-
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((
|
|
4997
|
+
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((crc32 >>> 24) & MAX_8_BITS)),
|
|
4996
4998
|
outputSize: passThrough ? compressedSize : uncompressedSize,
|
|
4997
|
-
|
|
4999
|
+
crc32,
|
|
4998
5000
|
compressed: compressionMethod != 0 && !passThrough,
|
|
4999
5001
|
encrypted,
|
|
5000
5002
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
@@ -5016,7 +5018,7 @@ class ZipEntry {
|
|
|
5016
5018
|
fileEntry,
|
|
5017
5019
|
index,
|
|
5018
5020
|
offset: localHeaderOffset,
|
|
5019
|
-
|
|
5021
|
+
crc32,
|
|
5020
5022
|
compressedSize,
|
|
5021
5023
|
uncompressedSize,
|
|
5022
5024
|
dataOffset,
|
|
@@ -5133,6 +5135,16 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5133
5135
|
} else {
|
|
5134
5136
|
directory.compressionMethod = compressionMethod;
|
|
5135
5137
|
}
|
|
5138
|
+
const extraFieldPkwareUnix = extraField.get(EXTRAFIELD_TYPE_PKWARE_UNIX);
|
|
5139
|
+
if (extraFieldPkwareUnix) {
|
|
5140
|
+
readExtraFieldUnixDates(extraFieldPkwareUnix, directory);
|
|
5141
|
+
directory.extraFieldPkwareUnix = extraFieldPkwareUnix;
|
|
5142
|
+
}
|
|
5143
|
+
const extraFieldUnixType1 = extraField.get(EXTRAFIELD_TYPE_UNIX_TYPE1);
|
|
5144
|
+
if (extraFieldUnixType1) {
|
|
5145
|
+
readExtraFieldUnixDates(extraFieldUnixType1, directory);
|
|
5146
|
+
directory.extraFieldUnixType1 = extraFieldUnixType1;
|
|
5147
|
+
}
|
|
5136
5148
|
const extraFieldNTFS = extraField.get(EXTRAFIELD_TYPE_NTFS);
|
|
5137
5149
|
if (extraFieldNTFS) {
|
|
5138
5150
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
@@ -5182,15 +5194,15 @@ function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName,
|
|
|
5182
5194
|
return;
|
|
5183
5195
|
}
|
|
5184
5196
|
const extraFieldView = getDataView(extraFieldUnicode.data);
|
|
5185
|
-
const
|
|
5186
|
-
|
|
5187
|
-
const
|
|
5188
|
-
|
|
5189
|
-
const
|
|
5197
|
+
const computedCrc32 = new Crc32();
|
|
5198
|
+
computedCrc32.append(fileEntry[rawPropertyName]);
|
|
5199
|
+
const computedCrc32View = getDataView(new Uint8Array(4));
|
|
5200
|
+
computedCrc32View.setUint32(0, computedCrc32.get(), true);
|
|
5201
|
+
const nameCrc32 = getUint32(extraFieldView, 1);
|
|
5190
5202
|
Object.assign(extraFieldUnicode, {
|
|
5191
5203
|
version: getUint8(extraFieldView, 0),
|
|
5192
5204
|
[propertyName]: decodeText(extraFieldUnicode.data.subarray(5)),
|
|
5193
|
-
valid: !fileEntry.bitFlag.languageEncodingFlag &&
|
|
5205
|
+
valid: !fileEntry.bitFlag.languageEncodingFlag && nameCrc32 == getUint32(computedCrc32View, 0)
|
|
5194
5206
|
});
|
|
5195
5207
|
if (extraFieldUnicode.valid) {
|
|
5196
5208
|
directory[propertyName] = extraFieldUnicode[propertyName];
|
|
@@ -5209,7 +5221,7 @@ function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
|
|
|
5209
5221
|
compressionMethod: getUint16(extraFieldView, 5)
|
|
5210
5222
|
});
|
|
5211
5223
|
directory.compressionMethod = extraFieldAES.compressionMethod;
|
|
5212
|
-
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1) {
|
|
5224
|
+
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1$1) {
|
|
5213
5225
|
directory.crc32 = UNDEFINED_VALUE;
|
|
5214
5226
|
}
|
|
5215
5227
|
}
|
|
@@ -5249,6 +5261,22 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
5249
5261
|
}
|
|
5250
5262
|
}
|
|
5251
5263
|
|
|
5264
|
+
function readExtraFieldUnixDates(extraField, directory) {
|
|
5265
|
+
if (extraField.data.length < 8) {
|
|
5266
|
+
return;
|
|
5267
|
+
}
|
|
5268
|
+
const extraFieldView = getDataView(extraField.data);
|
|
5269
|
+
const lastAccessDate = new Date(getUint32(extraFieldView, 0) * 1000);
|
|
5270
|
+
const lastModDate = new Date(getUint32(extraFieldView, 4) * 1000);
|
|
5271
|
+
const extraFieldData = { lastAccessDate, lastModDate };
|
|
5272
|
+
if (extraField.data.length >= 12) {
|
|
5273
|
+
extraFieldData.uid = getUint16(extraFieldView, 8);
|
|
5274
|
+
extraFieldData.gid = getUint16(extraFieldView, 10);
|
|
5275
|
+
}
|
|
5276
|
+
Object.assign(extraField, extraFieldData);
|
|
5277
|
+
Object.assign(directory, extraFieldData);
|
|
5278
|
+
}
|
|
5279
|
+
|
|
5252
5280
|
function readExtraFieldUnix(extraField, directory, isInfoZip) {
|
|
5253
5281
|
try {
|
|
5254
5282
|
const view = getDataView(extraField.data);
|
|
@@ -5327,7 +5355,7 @@ async function detectOverlappingEntry({
|
|
|
5327
5355
|
fileEntry,
|
|
5328
5356
|
index,
|
|
5329
5357
|
offset,
|
|
5330
|
-
|
|
5358
|
+
crc32,
|
|
5331
5359
|
compressedSize,
|
|
5332
5360
|
uncompressedSize,
|
|
5333
5361
|
dataOffset,
|
|
@@ -5348,7 +5376,7 @@ async function detectOverlappingEntry({
|
|
|
5348
5376
|
const dataDescriptorSignature = dataDescriptorArray.length == dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH &&
|
|
5349
5377
|
getUint32(getDataView(dataDescriptorArray), 0) == DATA_DESCRIPTOR_RECORD_SIGNATURE;
|
|
5350
5378
|
if (dataDescriptorSignature) {
|
|
5351
|
-
const
|
|
5379
|
+
const readCrc32 = getUint32(getDataView(dataDescriptorArray), 4);
|
|
5352
5380
|
let readCompressedSize;
|
|
5353
5381
|
let readUncompressedSize;
|
|
5354
5382
|
if (extraFieldZip64) {
|
|
@@ -5358,8 +5386,8 @@ async function detectOverlappingEntry({
|
|
|
5358
5386
|
readCompressedSize = getUint32(getDataView(dataDescriptorArray), 8);
|
|
5359
5387
|
readUncompressedSize = getUint32(getDataView(dataDescriptorArray), 12);
|
|
5360
5388
|
}
|
|
5361
|
-
const
|
|
5362
|
-
if (
|
|
5389
|
+
const matchCrc32 = (fileEntry.encrypted && !fileEntry.zipCrypto) || readCrc32 == crc32;
|
|
5390
|
+
if (matchCrc32 &&
|
|
5363
5391
|
readCompressedSize == compressedSize &&
|
|
5364
5392
|
readUncompressedSize == uncompressedSize) {
|
|
5365
5393
|
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
@@ -5528,11 +5556,11 @@ function checkLocalDirectory(zipEntry, localDirectory, rawLocalFilename) {
|
|
|
5528
5556
|
throwAmbiguousArchive("mismatched local file header (compression method)");
|
|
5529
5557
|
}
|
|
5530
5558
|
if (!localDirectory.bitFlag.dataDescriptor &&
|
|
5531
|
-
(localDirectory.
|
|
5532
|
-
(localDirectory.
|
|
5559
|
+
(localDirectory.crc32 || localDirectory.compressedSize || localDirectory.uncompressedSize) &&
|
|
5560
|
+
(localDirectory.crc32 != zipEntry.crc32 ||
|
|
5533
5561
|
localDirectory.compressedSize != zipEntry.compressedSize ||
|
|
5534
5562
|
localDirectory.uncompressedSize != zipEntry.uncompressedSize)) {
|
|
5535
|
-
throwAmbiguousArchive("mismatched local file header (
|
|
5563
|
+
throwAmbiguousArchive("mismatched local file header (crc32 or sizes)");
|
|
5536
5564
|
}
|
|
5537
5565
|
}
|
|
5538
5566
|
|
|
@@ -5652,6 +5680,8 @@ const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be intege
|
|
|
5652
5680
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
5653
5681
|
|
|
5654
5682
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
5683
|
+
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
5684
|
+
const VENDOR_VERSION_AE_1 = 1;
|
|
5655
5685
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
5656
5686
|
const UNIX_EXTRA_FIELD_TYPE = "unix";
|
|
5657
5687
|
|
|
@@ -5746,9 +5776,9 @@ class ZipWriter {
|
|
|
5746
5776
|
zip64UncompressedSize,
|
|
5747
5777
|
extraFieldLength
|
|
5748
5778
|
});
|
|
5749
|
-
const {
|
|
5750
|
-
if (
|
|
5751
|
-
setUint32(headerView, HEADER_OFFSET_SIGNATURE,
|
|
5779
|
+
const { crc32 } = entry;
|
|
5780
|
+
if (crc32 !== UNDEFINED_VALUE) {
|
|
5781
|
+
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
5752
5782
|
}
|
|
5753
5783
|
Object.assign(entry, {
|
|
5754
5784
|
zip64UncompressedSize,
|
|
@@ -5933,6 +5963,7 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
5933
5963
|
internalFileAttribute: metadataInfo.resolvedOptions.internalFileAttributes,
|
|
5934
5964
|
externalFileAttribute: attributesInfo.resolvedOptions.externalFileAttributes,
|
|
5935
5965
|
signature: options[PROPERTY_NAME_SIGNATURE],
|
|
5966
|
+
crc32: options.crc32 === UNDEFINED_VALUE ? options[PROPERTY_NAME_SIGNATURE] : options.crc32,
|
|
5936
5967
|
offset: zipWriter.offset - diskOffset,
|
|
5937
5968
|
diskNumberStart: diskNumber
|
|
5938
5969
|
});
|
|
@@ -6149,27 +6180,8 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6149
6180
|
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
6150
6181
|
throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
|
|
6151
6182
|
}
|
|
6152
|
-
|
|
6153
|
-
const
|
|
6154
|
-
if (extraField) {
|
|
6155
|
-
let extraFieldSize = 0;
|
|
6156
|
-
let offset = 0;
|
|
6157
|
-
extraField.forEach(data => extraFieldSize += 4 + getLength(data));
|
|
6158
|
-
rawExtraField = new Uint8Array(extraFieldSize);
|
|
6159
|
-
const rawExtraFieldView = getDataView(rawExtraField);
|
|
6160
|
-
extraField.forEach((data, type) => {
|
|
6161
|
-
if (type > MAX_16_BITS) {
|
|
6162
|
-
throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
|
|
6163
|
-
}
|
|
6164
|
-
if (getLength(data) > MAX_16_BITS) {
|
|
6165
|
-
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6166
|
-
}
|
|
6167
|
-
setUint16(rawExtraFieldView, offset, type);
|
|
6168
|
-
setUint16(rawExtraFieldView, offset + 2, getLength(data));
|
|
6169
|
-
arraySet(rawExtraField, data, offset + 4);
|
|
6170
|
-
offset += 4 + getLength(data);
|
|
6171
|
-
});
|
|
6172
|
-
}
|
|
6183
|
+
const rawExtraField = serializeExtraField(options[PROPERTY_NAME_EXTRA_FIELD]);
|
|
6184
|
+
const rawLocalExtraField = serializeExtraField(options[OPTION_LOCAL_EXTRA_FIELD]);
|
|
6173
6185
|
return {
|
|
6174
6186
|
comment,
|
|
6175
6187
|
resolvedOptions: {
|
|
@@ -6203,11 +6215,36 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6203
6215
|
useCompressionStream,
|
|
6204
6216
|
dataDescriptor,
|
|
6205
6217
|
zip64,
|
|
6206
|
-
rawExtraField
|
|
6218
|
+
rawExtraField,
|
|
6219
|
+
rawLocalExtraField
|
|
6207
6220
|
}
|
|
6208
6221
|
};
|
|
6209
6222
|
}
|
|
6210
6223
|
|
|
6224
|
+
function serializeExtraField(extraField) {
|
|
6225
|
+
if (!extraField) {
|
|
6226
|
+
return EMPTY_UINT8_ARRAY;
|
|
6227
|
+
}
|
|
6228
|
+
let extraFieldSize = 0;
|
|
6229
|
+
let offset = 0;
|
|
6230
|
+
extraField.forEach(data => extraFieldSize += 4 + getLength(data));
|
|
6231
|
+
const rawExtraField = new Uint8Array(extraFieldSize);
|
|
6232
|
+
const rawExtraFieldView = getDataView(rawExtraField);
|
|
6233
|
+
extraField.forEach((data, type) => {
|
|
6234
|
+
if (type > MAX_16_BITS) {
|
|
6235
|
+
throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
|
|
6236
|
+
}
|
|
6237
|
+
if (getLength(data) > MAX_16_BITS) {
|
|
6238
|
+
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6239
|
+
}
|
|
6240
|
+
setUint16(rawExtraFieldView, offset, type);
|
|
6241
|
+
setUint16(rawExtraFieldView, offset + 2, getLength(data));
|
|
6242
|
+
arraySet(rawExtraField, data, offset + 4);
|
|
6243
|
+
offset += 4 + getLength(data);
|
|
6244
|
+
});
|
|
6245
|
+
return rawExtraField;
|
|
6246
|
+
}
|
|
6247
|
+
|
|
6211
6248
|
async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, options) {
|
|
6212
6249
|
const { passThrough, zipCrypto, password, rawPassword, encryptionStrength } = metadata;
|
|
6213
6250
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
@@ -6532,12 +6569,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6532
6569
|
msdosAttributes
|
|
6533
6570
|
};
|
|
6534
6571
|
let {
|
|
6535
|
-
crc32
|
|
6572
|
+
crc32,
|
|
6536
6573
|
uncompressedSize
|
|
6537
6574
|
} = options;
|
|
6538
|
-
if (signature === UNDEFINED_VALUE) {
|
|
6539
|
-
({ signature } = options);
|
|
6540
|
-
}
|
|
6541
6575
|
let compressedSize = 0;
|
|
6542
6576
|
if (!passThrough) {
|
|
6543
6577
|
uncompressedSize = 0;
|
|
@@ -6575,7 +6609,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6575
6609
|
if (!passThrough) {
|
|
6576
6610
|
uncompressedSize = result.inputSize;
|
|
6577
6611
|
if (!encrypted || zipCrypto) {
|
|
6578
|
-
|
|
6612
|
+
crc32 = result.crc32;
|
|
6579
6613
|
}
|
|
6580
6614
|
}
|
|
6581
6615
|
if ((!zip64CompressedSize && compressedSize >= MAX_32_BITS) ||
|
|
@@ -6591,7 +6625,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6591
6625
|
|
|
6592
6626
|
}
|
|
6593
6627
|
setEntryInfo({
|
|
6594
|
-
|
|
6628
|
+
crc32,
|
|
6595
6629
|
compressedSize,
|
|
6596
6630
|
uncompressedSize,
|
|
6597
6631
|
headerInfo,
|
|
@@ -6614,8 +6648,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6614
6648
|
version,
|
|
6615
6649
|
headerArray,
|
|
6616
6650
|
headerView,
|
|
6617
|
-
signature,
|
|
6618
|
-
crc32: encrypted && !zipCrypto ? UNDEFINED_VALUE :
|
|
6651
|
+
signature: crc32,
|
|
6652
|
+
crc32: encrypted && !zipCrypto && !passThrough ? UNDEFINED_VALUE : crc32,
|
|
6619
6653
|
extraFieldExtendedTimestampFlag,
|
|
6620
6654
|
zip64UncompressedSize,
|
|
6621
6655
|
zip64CompressedSize
|
|
@@ -6636,6 +6670,7 @@ function getHeaderInfo(options) {
|
|
|
6636
6670
|
dataDescriptor,
|
|
6637
6671
|
directory,
|
|
6638
6672
|
rawExtraField,
|
|
6673
|
+
rawLocalExtraField,
|
|
6639
6674
|
encryptionStrength,
|
|
6640
6675
|
extendedTimestamp,
|
|
6641
6676
|
ntfsTimestamp,
|
|
@@ -6643,7 +6678,8 @@ function getHeaderInfo(options) {
|
|
|
6643
6678
|
encrypted,
|
|
6644
6679
|
zip64UncompressedSize,
|
|
6645
6680
|
zip64CompressedSize,
|
|
6646
|
-
uncompressedSize
|
|
6681
|
+
uncompressedSize,
|
|
6682
|
+
crc32
|
|
6647
6683
|
} = options;
|
|
6648
6684
|
let { version, compressionMethod } = options;
|
|
6649
6685
|
const compressed = !directory && (compressionMethod === UNDEFINED_VALUE
|
|
@@ -6769,11 +6805,14 @@ function getHeaderInfo(options) {
|
|
|
6769
6805
|
}
|
|
6770
6806
|
if (encrypted && !zipCrypto) {
|
|
6771
6807
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
6808
|
+
if (passThrough && crc32 !== UNDEFINED_VALUE) {
|
|
6809
|
+
rawExtraFieldAES[EXTRAFIELD_OFFSET_AES_VENDOR_VERSION] = VENDOR_VERSION_AE_1;
|
|
6810
|
+
}
|
|
6772
6811
|
rawExtraFieldAES[9] = compressionMethod;
|
|
6773
6812
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
6774
6813
|
}
|
|
6775
6814
|
const localExtraFieldZip64Length = writeLocalExtraFieldZip64 ? getLength(rawLocalExtraFieldZip64) : 0;
|
|
6776
|
-
const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
|
|
6815
|
+
const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField, rawLocalExtraField);
|
|
6777
6816
|
if (extraFieldLength > MAX_16_BITS) {
|
|
6778
6817
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6779
6818
|
}
|
|
@@ -6807,6 +6846,7 @@ function getHeaderInfo(options) {
|
|
|
6807
6846
|
localHeader.bytes(rawExtraFieldNTFS);
|
|
6808
6847
|
localHeader.bytes(rawExtraFieldUnix);
|
|
6809
6848
|
localHeader.bytes(rawExtraField);
|
|
6849
|
+
localHeader.bytes(rawLocalExtraField);
|
|
6810
6850
|
if (dataDescriptor) {
|
|
6811
6851
|
if (!zip64CompressedSize) {
|
|
6812
6852
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + LOCAL_HEADER_COMMON_OFFSET, 0);
|
|
@@ -6925,7 +6965,7 @@ function getDataDescriptorInfo({
|
|
|
6925
6965
|
}
|
|
6926
6966
|
|
|
6927
6967
|
function setEntryInfo({
|
|
6928
|
-
|
|
6968
|
+
crc32,
|
|
6929
6969
|
compressedSize,
|
|
6930
6970
|
uncompressedSize,
|
|
6931
6971
|
headerInfo,
|
|
@@ -6933,6 +6973,7 @@ function setEntryInfo({
|
|
|
6933
6973
|
}, {
|
|
6934
6974
|
zip64,
|
|
6935
6975
|
zipCrypto,
|
|
6976
|
+
passThrough,
|
|
6936
6977
|
dataDescriptor
|
|
6937
6978
|
}) {
|
|
6938
6979
|
const {
|
|
@@ -6943,10 +6984,10 @@ function setEntryInfo({
|
|
|
6943
6984
|
dataDescriptorView,
|
|
6944
6985
|
dataDescriptorOffset
|
|
6945
6986
|
} = dataDescriptorInfo;
|
|
6946
|
-
if ((!encrypted || zipCrypto) &&
|
|
6947
|
-
setUint32(headerView, HEADER_OFFSET_SIGNATURE,
|
|
6987
|
+
if ((!encrypted || zipCrypto || passThrough) && crc32 !== UNDEFINED_VALUE) {
|
|
6988
|
+
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
6948
6989
|
if (dataDescriptor) {
|
|
6949
|
-
setUint32(dataDescriptorView, dataDescriptorOffset,
|
|
6990
|
+
setUint32(dataDescriptorView, dataDescriptorOffset, crc32);
|
|
6950
6991
|
}
|
|
6951
6992
|
}
|
|
6952
6993
|
if (zip64) {
|
|
@@ -6969,15 +7010,15 @@ function updateLocalHeader({
|
|
|
6969
7010
|
encrypted,
|
|
6970
7011
|
zip64,
|
|
6971
7012
|
localExtraFieldZip64Length,
|
|
6972
|
-
|
|
7013
|
+
crc32,
|
|
6973
7014
|
compressedSize,
|
|
6974
7015
|
uncompressedSize,
|
|
6975
7016
|
zip64UncompressedSize,
|
|
6976
7017
|
zip64CompressedSize
|
|
6977
|
-
}, localHeaderView, { dataDescriptor }) {
|
|
7018
|
+
}, localHeaderView, { dataDescriptor, passThrough }) {
|
|
6978
7019
|
if (!dataDescriptor) {
|
|
6979
|
-
if (!encrypted) {
|
|
6980
|
-
setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + LOCAL_HEADER_COMMON_OFFSET,
|
|
7020
|
+
if (!encrypted || (passThrough && crc32 !== UNDEFINED_VALUE)) {
|
|
7021
|
+
setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + LOCAL_HEADER_COMMON_OFFSET, crc32);
|
|
6981
7022
|
}
|
|
6982
7023
|
if (!zip64CompressedSize) {
|
|
6983
7024
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + LOCAL_HEADER_COMMON_OFFSET, compressedSize);
|
|
@@ -8247,33 +8288,7 @@ function terminateWorkersAndModule() {
|
|
|
8247
8288
|
resetWasmModule();
|
|
8248
8289
|
}
|
|
8249
8290
|
|
|
8250
|
-
|
|
8251
|
-
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
8252
|
-
|
|
8253
|
-
Redistribution and use in source and binary forms, with or without
|
|
8254
|
-
modification, are permitted provided that the following conditions are met:
|
|
8255
|
-
|
|
8256
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
8257
|
-
this list of conditions and the following disclaimer.
|
|
8258
|
-
|
|
8259
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
8260
|
-
notice, this list of conditions and the following disclaimer in
|
|
8261
|
-
the documentation and/or other materials provided with the distribution.
|
|
8262
|
-
|
|
8263
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
8264
|
-
derived from this software without specific prior written permission.
|
|
8265
|
-
|
|
8266
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
8267
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
8268
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
8269
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
8270
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
8271
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
8272
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
8273
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
8274
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
8275
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8276
|
-
*/
|
|
8291
|
+
/// <reference types="../index.d.ts" />
|
|
8277
8292
|
|
|
8278
8293
|
|
|
8279
8294
|
configureExternalAssets();
|