@zip.js/zip.js 2.8.43 → 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/README.md +0 -37
- package/deno.json +21 -1
- package/dist/zip-core-external.js +194 -159
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +194 -131
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +246 -167
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +244 -139
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +267 -1761
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +269 -1735
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +268 -1734
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +196 -133
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +196 -133
- 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 +195 -132
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +31 -2
- package/index-native.cjs +269 -1735
- package/index-native.min.js +1 -1
- package/index.cjs +268 -1734
- package/index.d.cts +129 -8
- package/index.d.ts +129 -8
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +6 -2
- package/lib/core/codec-worker.js +2 -2
- package/lib/core/constants.js +4 -0
- package/lib/core/options.js +6 -0
- package/lib/core/streams/aes-crypto-stream.js +18 -21
- package/lib/core/streams/codec-stream.js +6 -2
- package/lib/core/streams/common-crypto.js +2 -0
- package/lib/core/streams/zip-entry-stream.js +16 -17
- 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/web-worker-wasm.js +4 -8
- package/lib/core/zip-entry.js +11 -1
- package/lib/core/zip-fs.js +62 -5
- package/lib/core/zip-reader.js +80 -43
- package/lib/core/zip-writer.js +68 -45
- package/lib/zip-core-external.js +2 -0
- package/lib/zip-core-reader.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
|
@@ -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;
|
|
@@ -1396,6 +1398,7 @@ const GET_RANDOM_VALUES_SUPPORTED = typeof crypto != UNDEFINED_TYPE && typeof cr
|
|
|
1396
1398
|
|
|
1397
1399
|
const ERR_INVALID_PASSWORD = "Invalid password";
|
|
1398
1400
|
const ERR_INVALID_SIGNATURE = "Invalid signature";
|
|
1401
|
+
const ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_SIGNATURE;
|
|
1399
1402
|
const ERR_ABORT_CHECK_PASSWORD = "zipjs-abort-check-password";
|
|
1400
1403
|
const ERR_UNSUPPORTED_CRYPTO_API = "Crypto API not supported";
|
|
1401
1404
|
|
|
@@ -1446,7 +1449,7 @@ const DERIVED_BITS_ALGORITHM = Object.assign({ iterations: 1000, hash: { name: H
|
|
|
1446
1449
|
const DERIVED_BITS_USAGE = ["deriveBits"];
|
|
1447
1450
|
const SALT_LENGTH = [8, 12, 16];
|
|
1448
1451
|
const KEY_LENGTH = [16, 24, 32];
|
|
1449
|
-
const
|
|
1452
|
+
const AUTHENTICATION_CODE_LENGTH = 10;
|
|
1450
1453
|
const COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
|
|
1451
1454
|
// deno-lint-ignore valid-typeof
|
|
1452
1455
|
const CRYPTO_API_SUPPORTED = typeof crypto != UNDEFINED_TYPE;
|
|
@@ -1462,7 +1465,7 @@ let DERIVE_BITS_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && type
|
|
|
1462
1465
|
|
|
1463
1466
|
class AESDecryptionStream extends TransformStream {
|
|
1464
1467
|
|
|
1465
|
-
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly }) {
|
|
1468
|
+
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
|
|
1466
1469
|
super({
|
|
1467
1470
|
start() {
|
|
1468
1471
|
initAesCrypto(this, password, rawPassword, encryptionStrength);
|
|
@@ -1486,8 +1489,8 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1486
1489
|
} else {
|
|
1487
1490
|
await ready;
|
|
1488
1491
|
}
|
|
1489
|
-
const output = new Uint8Array(chunk.length -
|
|
1490
|
-
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));
|
|
1491
1494
|
},
|
|
1492
1495
|
async flush(controller) {
|
|
1493
1496
|
const {
|
|
@@ -1498,8 +1501,8 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1498
1501
|
} = this;
|
|
1499
1502
|
if (hmac && ctr) {
|
|
1500
1503
|
await ready;
|
|
1501
|
-
const chunkToDecrypt = subarray(pending, 0, pending.length -
|
|
1502
|
-
const
|
|
1504
|
+
const chunkToDecrypt = subarray(pending, 0, pending.length - AUTHENTICATION_CODE_LENGTH);
|
|
1505
|
+
const originalAuthenticationCode = subarray(pending, pending.length - AUTHENTICATION_CODE_LENGTH);
|
|
1503
1506
|
let decryptedChunkArray = EMPTY_UINT8_ARRAY;
|
|
1504
1507
|
if (chunkToDecrypt.length) {
|
|
1505
1508
|
const encryptedChunk = toBits(codecBytes, chunkToDecrypt);
|
|
@@ -1507,13 +1510,13 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1507
1510
|
const decryptedChunk = ctr.update(encryptedChunk);
|
|
1508
1511
|
decryptedChunkArray = fromBits(codecBytes, decryptedChunk);
|
|
1509
1512
|
}
|
|
1510
|
-
const
|
|
1511
|
-
let
|
|
1512
|
-
for (let
|
|
1513
|
-
|
|
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];
|
|
1514
1517
|
}
|
|
1515
|
-
if (
|
|
1516
|
-
throw new Error(
|
|
1518
|
+
if (invalidAuthenticationCode && checkAuthenticationCode) {
|
|
1519
|
+
throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
|
|
1517
1520
|
}
|
|
1518
1521
|
controller.enqueue(decryptedChunkArray);
|
|
1519
1522
|
}
|
|
@@ -1525,8 +1528,6 @@ class AESDecryptionStream extends TransformStream {
|
|
|
1525
1528
|
class AESEncryptionStream extends TransformStream {
|
|
1526
1529
|
|
|
1527
1530
|
constructor({ password, rawPassword, encryptionStrength }) {
|
|
1528
|
-
// deno-lint-ignore prefer-const
|
|
1529
|
-
let stream;
|
|
1530
1531
|
super({
|
|
1531
1532
|
start() {
|
|
1532
1533
|
initAesCrypto(this, password, rawPassword, encryptionStrength);
|
|
@@ -1565,12 +1566,11 @@ class AESEncryptionStream extends TransformStream {
|
|
|
1565
1566
|
hmac.update(encryptedChunk);
|
|
1566
1567
|
encryptedChunkArray = fromBits(codecBytes, encryptedChunk);
|
|
1567
1568
|
}
|
|
1568
|
-
|
|
1569
|
-
controller.enqueue(concat(encryptedChunkArray,
|
|
1569
|
+
const authenticationCode = fromBits(codecBytes, hmac.digest()).slice(0, AUTHENTICATION_CODE_LENGTH);
|
|
1570
|
+
controller.enqueue(concat(encryptedChunkArray, authenticationCode));
|
|
1570
1571
|
}
|
|
1571
1572
|
}
|
|
1572
1573
|
});
|
|
1573
|
-
stream = this;
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
@@ -1583,7 +1583,7 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
|
|
|
1583
1583
|
});
|
|
1584
1584
|
}
|
|
1585
1585
|
|
|
1586
|
-
function append(aesCrypto, input, output, paddingStart, paddingEnd,
|
|
1586
|
+
function append(aesCrypto, input, output, paddingStart, paddingEnd, verifyAuthenticationCode) {
|
|
1587
1587
|
const {
|
|
1588
1588
|
ctr,
|
|
1589
1589
|
hmac,
|
|
@@ -1597,11 +1597,11 @@ function append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignat
|
|
|
1597
1597
|
let offset;
|
|
1598
1598
|
for (offset = 0; offset <= inputLength - BLOCK_LENGTH; offset += BLOCK_LENGTH) {
|
|
1599
1599
|
const inputChunk = toBits(codecBytes, subarray(input, offset, offset + BLOCK_LENGTH));
|
|
1600
|
-
if (
|
|
1600
|
+
if (verifyAuthenticationCode) {
|
|
1601
1601
|
hmac.update(inputChunk);
|
|
1602
1602
|
}
|
|
1603
1603
|
const outputChunk = ctr.update(inputChunk);
|
|
1604
|
-
if (!
|
|
1604
|
+
if (!verifyAuthenticationCode) {
|
|
1605
1605
|
hmac.update(outputChunk);
|
|
1606
1606
|
}
|
|
1607
1607
|
output.set(fromBits(codecBytes, outputChunk), offset + paddingStart);
|
|
@@ -1951,6 +1951,7 @@ function toCompatibleWritable(writable) {
|
|
|
1951
1951
|
|
|
1952
1952
|
const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
|
|
1953
1953
|
const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
|
|
1954
|
+
const ERR_INVALID_CRC32 = ERR_INVALID_SIGNATURE;
|
|
1954
1955
|
const ERR_UNSUPPORTED_COMPRESSION$2 = "Compression method not supported";
|
|
1955
1956
|
const FORMAT_DEFLATE_RAW = "deflate-raw";
|
|
1956
1957
|
const FORMAT_DEFLATE64_RAW = "deflate64-raw";
|
|
@@ -1964,14 +1965,14 @@ class DeflateStream extends TransformStream {
|
|
|
1964
1965
|
|
|
1965
1966
|
constructor(options, { chunkSize, CompressionStreamZlib, CompressionStream }) {
|
|
1966
1967
|
super({});
|
|
1967
|
-
const { compressed, encrypted, useCompressionStream, zipCrypto,
|
|
1968
|
+
const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
|
|
1968
1969
|
const stream = this;
|
|
1969
1970
|
let crc32Stream, encryptionStream, gzipCrc32Stream;
|
|
1970
1971
|
let readable = super.readable;
|
|
1971
1972
|
const codecStreams = format && getCodecStreams(format);
|
|
1972
|
-
const useGzipCrc32 =
|
|
1973
|
+
const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams && (!encrypted || zipCrypto) &&
|
|
1973
1974
|
Boolean(useCompressionStream && CompressionStream);
|
|
1974
|
-
if ((!encrypted || zipCrypto) &&
|
|
1975
|
+
if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
|
|
1975
1976
|
crc32Stream = new Crc32Stream();
|
|
1976
1977
|
readable = pipeThrough(readable, crc32Stream);
|
|
1977
1978
|
}
|
|
@@ -2006,14 +2007,9 @@ class DeflateStream extends TransformStream {
|
|
|
2006
2007
|
}
|
|
2007
2008
|
}
|
|
2008
2009
|
setReadable(stream, readable, () => {
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
signature = encryptionStream.signature;
|
|
2010
|
+
if ((!encrypted || zipCrypto) && computeCrc32) {
|
|
2011
|
+
stream.crc32 = useGzipCrc32 ? gzipCrc32Stream.crc32 : new DataView(crc32Stream.value.buffer).getUint32(0);
|
|
2012
2012
|
}
|
|
2013
|
-
if ((!encrypted || zipCrypto) && signed) {
|
|
2014
|
-
signature = useGzipCrc32 ? gzipCrc32Stream.signature : new DataView(crc32Stream.value.buffer).getUint32(0);
|
|
2015
|
-
}
|
|
2016
|
-
stream.signature = signature;
|
|
2017
2013
|
});
|
|
2018
2014
|
}
|
|
2019
2015
|
}
|
|
@@ -2051,7 +2047,7 @@ class GzipToRawDeflateStream extends TransformStream {
|
|
|
2051
2047
|
},
|
|
2052
2048
|
flush() {
|
|
2053
2049
|
const dataView = getDataView(trailerCandidate);
|
|
2054
|
-
stream.
|
|
2050
|
+
stream.crc32 = dataView.getUint32(0, true);
|
|
2055
2051
|
stream.uncompressedSize = dataView.getUint32(4, true);
|
|
2056
2052
|
}
|
|
2057
2053
|
});
|
|
@@ -2133,7 +2129,7 @@ class InflateStream extends TransformStream {
|
|
|
2133
2129
|
|
|
2134
2130
|
constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
|
|
2135
2131
|
super({});
|
|
2136
|
-
const { zipCrypto, encrypted,
|
|
2132
|
+
const { zipCrypto, encrypted, checkCrc32, crc32, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
|
|
2137
2133
|
let crc32Stream, decryptionStream;
|
|
2138
2134
|
let readable = super.readable;
|
|
2139
2135
|
if (encrypted) {
|
|
@@ -2166,15 +2162,15 @@ class InflateStream extends TransformStream {
|
|
|
2166
2162
|
}
|
|
2167
2163
|
readable = mapInflateStreamError(readable);
|
|
2168
2164
|
}
|
|
2169
|
-
if (
|
|
2165
|
+
if (checkCrc32) {
|
|
2170
2166
|
crc32Stream = new Crc32Stream();
|
|
2171
2167
|
readable = pipeThrough(readable, crc32Stream);
|
|
2172
2168
|
}
|
|
2173
2169
|
setReadable(this, readable, () => {
|
|
2174
|
-
if (
|
|
2175
|
-
const
|
|
2176
|
-
if (
|
|
2177
|
-
throw new Error(
|
|
2170
|
+
if (checkCrc32) {
|
|
2171
|
+
const computedCrc32View = new DataView(crc32Stream.value.buffer);
|
|
2172
|
+
if (crc32 != computedCrc32View.getUint32(0, false)) {
|
|
2173
|
+
throw new Error(ERR_INVALID_CRC32);
|
|
2178
2174
|
}
|
|
2179
2175
|
}
|
|
2180
2176
|
});
|
|
@@ -2398,9 +2394,9 @@ class CodecStream extends TransformStream {
|
|
|
2398
2394
|
}
|
|
2399
2395
|
},
|
|
2400
2396
|
flush() {
|
|
2401
|
-
const {
|
|
2397
|
+
const { crc32 } = stream;
|
|
2402
2398
|
Object.assign(codec, {
|
|
2403
|
-
|
|
2399
|
+
crc32,
|
|
2404
2400
|
inputSize
|
|
2405
2401
|
});
|
|
2406
2402
|
}
|
|
@@ -2703,12 +2699,12 @@ async function runWorker$1({ options, readable, writable, onTaskFinished }, conf
|
|
|
2703
2699
|
.pipeThrough(new ChunkStream(getChunkSize(config)))
|
|
2704
2700
|
.pipeTo(writable, { preventClose: true, preventAbort: true });
|
|
2705
2701
|
const {
|
|
2706
|
-
|
|
2702
|
+
crc32,
|
|
2707
2703
|
inputSize,
|
|
2708
2704
|
outputSize
|
|
2709
2705
|
} = codecStream;
|
|
2710
2706
|
return {
|
|
2711
|
-
|
|
2707
|
+
crc32,
|
|
2712
2708
|
inputSize,
|
|
2713
2709
|
outputSize
|
|
2714
2710
|
};
|
|
@@ -3069,7 +3065,7 @@ let indexWorker = 0;
|
|
|
3069
3065
|
|
|
3070
3066
|
async function runWorker(stream, workerOptions) {
|
|
3071
3067
|
const { options, config } = workerOptions;
|
|
3072
|
-
const { transferStreams, useWebWorkers, useCompressionStream, compressed,
|
|
3068
|
+
const { transferStreams, useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3073
3069
|
const { workerURI, maxWorkers } = config;
|
|
3074
3070
|
if (format) {
|
|
3075
3071
|
if (codecURI) {
|
|
@@ -3078,7 +3074,7 @@ async function runWorker(stream, workerOptions) {
|
|
|
3078
3074
|
await ensureCodecStreams(format, options.codecURI);
|
|
3079
3075
|
}
|
|
3080
3076
|
workerOptions.transferStreams = transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams);
|
|
3081
|
-
const streamCopy = !compressed && !
|
|
3077
|
+
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3082
3078
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3083
3079
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
3084
3080
|
workerOptions.workerURI = workerOptions.useWebWorkers && workerURI ? workerURI : UNDEFINED_VALUE;
|
|
@@ -4302,9 +4298,12 @@ const PROPERTY_NAME_DIRECTORY = "directory";
|
|
|
4302
4298
|
const PROPERTY_NAME_EXECUTABLE = "executable";
|
|
4303
4299
|
const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
|
|
4304
4300
|
const PROPERTY_NAME_SIGNATURE = "signature";
|
|
4301
|
+
const PROPERTY_NAME_CRC32 = "crc32";
|
|
4305
4302
|
const PROPERTY_NAME_EXTRA_FIELD = "extraField";
|
|
4306
4303
|
const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
|
|
4307
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";
|
|
4308
4307
|
const PROPERTY_NAME_UID = "uid";
|
|
4309
4308
|
const PROPERTY_NAME_GID = "gid";
|
|
4310
4309
|
const PROPERTY_NAME_UNIX_MODE = "unixMode";
|
|
@@ -4321,6 +4320,7 @@ const PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT = "extraFieldUnicodeComment";
|
|
|
4321
4320
|
const PROPERTY_NAME_EXTRA_FIELD_AES = "extraFieldAES";
|
|
4322
4321
|
const PROPERTY_NAME_EXTRA_FIELD_NTFS = "extraFieldNTFS";
|
|
4323
4322
|
const PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP = "extraFieldExtendedTimestamp";
|
|
4323
|
+
const PROPERTY_NAME_EXTRA_FIELD_USDZ = "extraFieldUSDZ";
|
|
4324
4324
|
|
|
4325
4325
|
const PROPERTY_NAMES = [
|
|
4326
4326
|
PROPERTY_NAME_FILENAME,
|
|
@@ -4332,6 +4332,7 @@ const PROPERTY_NAMES = [
|
|
|
4332
4332
|
PROPERTY_NAME_COMMENT,
|
|
4333
4333
|
PROPERTY_NAME_RAW_COMMENT,
|
|
4334
4334
|
PROPERTY_NAME_LAST_ACCESS_DATE,
|
|
4335
|
+
PROPERTY_NAME_RAW_LAST_ACCESS_DATE,
|
|
4335
4336
|
PROPERTY_NAME_CREATION_DATE,
|
|
4336
4337
|
PROPERTY_NAME_RAW_CREATION_DATE,
|
|
4337
4338
|
PROPERTY_NAME_OFFSET,
|
|
@@ -4350,9 +4351,12 @@ const PROPERTY_NAMES = [
|
|
|
4350
4351
|
PROPERTY_NAME_EXECUTABLE,
|
|
4351
4352
|
PROPERTY_NAME_COMPRESSION_METHOD,
|
|
4352
4353
|
PROPERTY_NAME_SIGNATURE,
|
|
4354
|
+
PROPERTY_NAME_CRC32,
|
|
4353
4355
|
PROPERTY_NAME_EXTRA_FIELD,
|
|
4354
4356
|
PROPERTY_NAME_EXTRA_FIELD_UNIX,
|
|
4355
4357
|
PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
|
|
4358
|
+
PROPERTY_NAME_EXTRA_FIELD_UNIX_TYPE1,
|
|
4359
|
+
PROPERTY_NAME_EXTRA_FIELD_PKWARE_UNIX,
|
|
4356
4360
|
PROPERTY_NAME_UID,
|
|
4357
4361
|
PROPERTY_NAME_GID,
|
|
4358
4362
|
PROPERTY_NAME_UNIX_MODE,
|
|
@@ -4368,7 +4372,8 @@ const PROPERTY_NAMES = [
|
|
|
4368
4372
|
PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT,
|
|
4369
4373
|
PROPERTY_NAME_EXTRA_FIELD_AES,
|
|
4370
4374
|
PROPERTY_NAME_EXTRA_FIELD_NTFS,
|
|
4371
|
-
PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP
|
|
4375
|
+
PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP,
|
|
4376
|
+
PROPERTY_NAME_EXTRA_FIELD_USDZ
|
|
4372
4377
|
];
|
|
4373
4378
|
|
|
4374
4379
|
class Entry {
|
|
@@ -4421,6 +4426,8 @@ const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
|
|
|
4421
4426
|
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
4422
4427
|
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
4423
4428
|
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
4429
|
+
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
4430
|
+
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
4424
4431
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
4425
4432
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
4426
4433
|
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
@@ -4440,6 +4447,7 @@ const OPTION_ENCODE_TEXT = "encodeText";
|
|
|
4440
4447
|
const OPTION_OFFSET = "offset";
|
|
4441
4448
|
const OPTION_USDZ = "usdz";
|
|
4442
4449
|
const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
|
|
4450
|
+
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
4443
4451
|
const OPTION_STRICTNESS = "strictness";
|
|
4444
4452
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
4445
4453
|
const STRICTNESS_STRICT = "strict";
|
|
@@ -4492,6 +4500,7 @@ const CHARSET_UTF8 = "utf-8";
|
|
|
4492
4500
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4493
4501
|
const CHARSET_CP437 = "cp437";
|
|
4494
4502
|
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4503
|
+
const VENDOR_VERSION_AE_1$1 = 1;
|
|
4495
4504
|
const ZIP64_PROPERTIES = [
|
|
4496
4505
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
4497
4506
|
[PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -4884,7 +4893,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
4884
4893
|
config,
|
|
4885
4894
|
bitFlag,
|
|
4886
4895
|
rawBitFlag,
|
|
4887
|
-
|
|
4896
|
+
crc32,
|
|
4888
4897
|
rawLastModDate,
|
|
4889
4898
|
uncompressedSize,
|
|
4890
4899
|
compressedSize
|
|
@@ -4971,6 +4980,11 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
4971
4980
|
if (deflate64) {
|
|
4972
4981
|
useCompressionStream = false;
|
|
4973
4982
|
}
|
|
4983
|
+
const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
|
|
4984
|
+
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
4985
|
+
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
4986
|
+
checkCrc32Option) && !passThrough &&
|
|
4987
|
+
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1$1));
|
|
4974
4988
|
const workerOptions = {
|
|
4975
4989
|
options: {
|
|
4976
4990
|
codecType: CODEC_INFLATE,
|
|
@@ -4978,10 +4992,11 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
4978
4992
|
rawPassword,
|
|
4979
4993
|
zipCrypto,
|
|
4980
4994
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
4981
|
-
|
|
4982
|
-
|
|
4995
|
+
checkCrc32,
|
|
4996
|
+
checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
|
|
4997
|
+
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((crc32 >>> 24) & MAX_8_BITS)),
|
|
4983
4998
|
outputSize: passThrough ? compressedSize : uncompressedSize,
|
|
4984
|
-
|
|
4999
|
+
crc32,
|
|
4985
5000
|
compressed: compressionMethod != 0 && !passThrough,
|
|
4986
5001
|
encrypted,
|
|
4987
5002
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
@@ -5003,7 +5018,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5003
5018
|
fileEntry,
|
|
5004
5019
|
index,
|
|
5005
5020
|
offset: localHeaderOffset,
|
|
5006
|
-
|
|
5021
|
+
crc32,
|
|
5007
5022
|
compressedSize,
|
|
5008
5023
|
uncompressedSize,
|
|
5009
5024
|
dataOffset,
|
|
@@ -5094,6 +5109,7 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5094
5109
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
5095
5110
|
Object.assign(directory, {
|
|
5096
5111
|
signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5112
|
+
crc32: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5097
5113
|
compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
|
|
5098
5114
|
uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
|
|
5099
5115
|
});
|
|
@@ -5119,6 +5135,16 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5119
5135
|
} else {
|
|
5120
5136
|
directory.compressionMethod = compressionMethod;
|
|
5121
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
|
+
}
|
|
5122
5148
|
const extraFieldNTFS = extraField.get(EXTRAFIELD_TYPE_NTFS);
|
|
5123
5149
|
if (extraFieldNTFS) {
|
|
5124
5150
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
@@ -5168,15 +5194,15 @@ function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName,
|
|
|
5168
5194
|
return;
|
|
5169
5195
|
}
|
|
5170
5196
|
const extraFieldView = getDataView(extraFieldUnicode.data);
|
|
5171
|
-
const
|
|
5172
|
-
|
|
5173
|
-
const
|
|
5174
|
-
|
|
5175
|
-
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);
|
|
5176
5202
|
Object.assign(extraFieldUnicode, {
|
|
5177
5203
|
version: getUint8(extraFieldView, 0),
|
|
5178
5204
|
[propertyName]: decodeText(extraFieldUnicode.data.subarray(5)),
|
|
5179
|
-
valid: !fileEntry.bitFlag.languageEncodingFlag &&
|
|
5205
|
+
valid: !fileEntry.bitFlag.languageEncodingFlag && nameCrc32 == getUint32(computedCrc32View, 0)
|
|
5180
5206
|
});
|
|
5181
5207
|
if (extraFieldUnicode.valid) {
|
|
5182
5208
|
directory[propertyName] = extraFieldUnicode[propertyName];
|
|
@@ -5195,6 +5221,9 @@ function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
|
|
|
5195
5221
|
compressionMethod: getUint16(extraFieldView, 5)
|
|
5196
5222
|
});
|
|
5197
5223
|
directory.compressionMethod = extraFieldAES.compressionMethod;
|
|
5224
|
+
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1$1) {
|
|
5225
|
+
directory.crc32 = UNDEFINED_VALUE;
|
|
5226
|
+
}
|
|
5198
5227
|
}
|
|
5199
5228
|
|
|
5200
5229
|
function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
@@ -5213,29 +5242,41 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
5213
5242
|
} catch {
|
|
5214
5243
|
// ignored
|
|
5215
5244
|
}
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
Object.assign(directory, extraFieldData);
|
|
5233
|
-
}
|
|
5234
|
-
} catch {
|
|
5235
|
-
// ignored
|
|
5245
|
+
if (tag1Data && tag1Data.length == 24) {
|
|
5246
|
+
const tag1View = getDataView(tag1Data);
|
|
5247
|
+
const rawLastModDate = tag1View.getBigUint64(0, true);
|
|
5248
|
+
const rawLastAccessDate = tag1View.getBigUint64(8, true);
|
|
5249
|
+
const rawCreationDate = tag1View.getBigUint64(16, true);
|
|
5250
|
+
Object.assign(extraFieldNTFS, {
|
|
5251
|
+
rawLastModDate,
|
|
5252
|
+
rawLastAccessDate,
|
|
5253
|
+
rawCreationDate
|
|
5254
|
+
});
|
|
5255
|
+
const lastModDate = getDateNTFS(rawLastModDate);
|
|
5256
|
+
const lastAccessDate = getDateNTFS(rawLastAccessDate);
|
|
5257
|
+
const creationDate = getDateNTFS(rawCreationDate);
|
|
5258
|
+
const extraFieldData = { lastModDate, lastAccessDate, creationDate };
|
|
5259
|
+
Object.assign(extraFieldNTFS, extraFieldData);
|
|
5260
|
+
Object.assign(directory, extraFieldData);
|
|
5236
5261
|
}
|
|
5237
5262
|
}
|
|
5238
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
|
+
|
|
5239
5280
|
function readExtraFieldUnix(extraField, directory, isInfoZip) {
|
|
5240
5281
|
try {
|
|
5241
5282
|
const view = getDataView(extraField.data);
|
|
@@ -5314,7 +5355,7 @@ async function detectOverlappingEntry({
|
|
|
5314
5355
|
fileEntry,
|
|
5315
5356
|
index,
|
|
5316
5357
|
offset,
|
|
5317
|
-
|
|
5358
|
+
crc32,
|
|
5318
5359
|
compressedSize,
|
|
5319
5360
|
uncompressedSize,
|
|
5320
5361
|
dataOffset,
|
|
@@ -5335,7 +5376,7 @@ async function detectOverlappingEntry({
|
|
|
5335
5376
|
const dataDescriptorSignature = dataDescriptorArray.length == dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH &&
|
|
5336
5377
|
getUint32(getDataView(dataDescriptorArray), 0) == DATA_DESCRIPTOR_RECORD_SIGNATURE;
|
|
5337
5378
|
if (dataDescriptorSignature) {
|
|
5338
|
-
const
|
|
5379
|
+
const readCrc32 = getUint32(getDataView(dataDescriptorArray), 4);
|
|
5339
5380
|
let readCompressedSize;
|
|
5340
5381
|
let readUncompressedSize;
|
|
5341
5382
|
if (extraFieldZip64) {
|
|
@@ -5345,8 +5386,8 @@ async function detectOverlappingEntry({
|
|
|
5345
5386
|
readCompressedSize = getUint32(getDataView(dataDescriptorArray), 8);
|
|
5346
5387
|
readUncompressedSize = getUint32(getDataView(dataDescriptorArray), 12);
|
|
5347
5388
|
}
|
|
5348
|
-
const
|
|
5349
|
-
if (
|
|
5389
|
+
const matchCrc32 = (fileEntry.encrypted && !fileEntry.zipCrypto) || readCrc32 == crc32;
|
|
5390
|
+
if (matchCrc32 &&
|
|
5350
5391
|
readCompressedSize == compressedSize &&
|
|
5351
5392
|
readUncompressedSize == uncompressedSize) {
|
|
5352
5393
|
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
@@ -5515,11 +5556,11 @@ function checkLocalDirectory(zipEntry, localDirectory, rawLocalFilename) {
|
|
|
5515
5556
|
throwAmbiguousArchive("mismatched local file header (compression method)");
|
|
5516
5557
|
}
|
|
5517
5558
|
if (!localDirectory.bitFlag.dataDescriptor &&
|
|
5518
|
-
(localDirectory.
|
|
5519
|
-
(localDirectory.
|
|
5559
|
+
(localDirectory.crc32 || localDirectory.compressedSize || localDirectory.uncompressedSize) &&
|
|
5560
|
+
(localDirectory.crc32 != zipEntry.crc32 ||
|
|
5520
5561
|
localDirectory.compressedSize != zipEntry.compressedSize ||
|
|
5521
5562
|
localDirectory.uncompressedSize != zipEntry.uncompressedSize)) {
|
|
5522
|
-
throwAmbiguousArchive("mismatched local file header (
|
|
5563
|
+
throwAmbiguousArchive("mismatched local file header (crc32 or sizes)");
|
|
5523
5564
|
}
|
|
5524
5565
|
}
|
|
5525
5566
|
|
|
@@ -5535,11 +5576,7 @@ function getOptionValue$1(zipReader, options, name) {
|
|
|
5535
5576
|
|
|
5536
5577
|
function getDate(timeRaw) {
|
|
5537
5578
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
|
|
5538
|
-
|
|
5539
|
-
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5540
|
-
} catch {
|
|
5541
|
-
// ignored
|
|
5542
|
-
}
|
|
5579
|
+
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5543
5580
|
}
|
|
5544
5581
|
|
|
5545
5582
|
function getDateNTFS(timeRaw) {
|
|
@@ -5572,7 +5609,9 @@ var zipReader = /*#__PURE__*/Object.freeze({
|
|
|
5572
5609
|
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
5573
5610
|
ERR_EOCDR_NOT_FOUND: ERR_EOCDR_NOT_FOUND,
|
|
5574
5611
|
ERR_EXTRAFIELD_ZIP64_NOT_FOUND: ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
5612
|
+
ERR_INVALID_AUTHENTICATION_CODE: ERR_INVALID_AUTHENTICATION_CODE,
|
|
5575
5613
|
ERR_INVALID_COMPRESSED_DATA: ERR_INVALID_COMPRESSED_DATA,
|
|
5614
|
+
ERR_INVALID_CRC32: ERR_INVALID_CRC32,
|
|
5576
5615
|
ERR_INVALID_PASSWORD: ERR_INVALID_PASSWORD,
|
|
5577
5616
|
ERR_INVALID_SIGNATURE: ERR_INVALID_SIGNATURE,
|
|
5578
5617
|
ERR_INVALID_UNCOMPRESSED_SIZE: ERR_INVALID_UNCOMPRESSED_SIZE,
|
|
@@ -5626,6 +5665,8 @@ const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
|
|
|
5626
5665
|
const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
|
|
5627
5666
|
const MIN_UNIX_TIME = -2147483648;
|
|
5628
5667
|
const MAX_UNIX_TIME = 2147483647;
|
|
5668
|
+
const MIN_NTFS_TIME = BigInt(0);
|
|
5669
|
+
const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
|
|
5629
5670
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
|
|
5630
5671
|
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
5631
5672
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
@@ -5639,7 +5680,9 @@ const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be intege
|
|
|
5639
5680
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
5640
5681
|
|
|
5641
5682
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
5642
|
-
const
|
|
5683
|
+
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
5684
|
+
const VENDOR_VERSION_AE_1 = 1;
|
|
5685
|
+
const INFOZIP_EXTRA_FIELD_TYPE$1 = "infozip";
|
|
5643
5686
|
const UNIX_EXTRA_FIELD_TYPE = "unix";
|
|
5644
5687
|
|
|
5645
5688
|
let workers = 0;
|
|
@@ -5733,9 +5776,9 @@ class ZipWriter {
|
|
|
5733
5776
|
zip64UncompressedSize,
|
|
5734
5777
|
extraFieldLength
|
|
5735
5778
|
});
|
|
5736
|
-
const {
|
|
5737
|
-
if (
|
|
5738
|
-
setUint32(headerView, HEADER_OFFSET_SIGNATURE,
|
|
5779
|
+
const { crc32 } = entry;
|
|
5780
|
+
if (crc32 !== UNDEFINED_VALUE) {
|
|
5781
|
+
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
5739
5782
|
}
|
|
5740
5783
|
Object.assign(entry, {
|
|
5741
5784
|
zip64UncompressedSize,
|
|
@@ -5920,6 +5963,7 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
5920
5963
|
internalFileAttribute: metadataInfo.resolvedOptions.internalFileAttributes,
|
|
5921
5964
|
externalFileAttribute: attributesInfo.resolvedOptions.externalFileAttributes,
|
|
5922
5965
|
signature: options[PROPERTY_NAME_SIGNATURE],
|
|
5966
|
+
crc32: options.crc32 === UNDEFINED_VALUE ? options[PROPERTY_NAME_SIGNATURE] : options.crc32,
|
|
5923
5967
|
offset: zipWriter.offset - diskOffset,
|
|
5924
5968
|
diskNumberStart: diskNumber
|
|
5925
5969
|
});
|
|
@@ -5956,7 +6000,7 @@ function resolveAttributes(zipWriter, name, options) {
|
|
|
5956
6000
|
if (unixMode !== UNDEFINED_VALUE && (unixMode < 0 || unixMode > MAX_16_BITS)) {
|
|
5957
6001
|
throw new Error(ERR_INVALID_UNIX_MODE);
|
|
5958
6002
|
}
|
|
5959
|
-
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE && unixExtraFieldType !== UNIX_EXTRA_FIELD_TYPE) {
|
|
6003
|
+
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE$1 && unixExtraFieldType !== UNIX_EXTRA_FIELD_TYPE) {
|
|
5960
6004
|
throw new Error(ERR_INVALID_UNIX_EXTRA_FIELD_TYPE);
|
|
5961
6005
|
}
|
|
5962
6006
|
if (unixExtraFieldType === UNIX_EXTRA_FIELD_TYPE &&
|
|
@@ -5964,7 +6008,7 @@ function resolveAttributes(zipWriter, name, options) {
|
|
|
5964
6008
|
throw new Error(ERR_INVALID_UNIX_ID_SIZE);
|
|
5965
6009
|
}
|
|
5966
6010
|
if (unixExtraFieldType === UNDEFINED_VALUE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
5967
|
-
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE;
|
|
6011
|
+
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE$1;
|
|
5968
6012
|
}
|
|
5969
6013
|
let msdosAttributesRaw = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW);
|
|
5970
6014
|
let msdosAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES);
|
|
@@ -6136,27 +6180,8 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6136
6180
|
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
6137
6181
|
throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
|
|
6138
6182
|
}
|
|
6139
|
-
|
|
6140
|
-
const
|
|
6141
|
-
if (extraField) {
|
|
6142
|
-
let extraFieldSize = 0;
|
|
6143
|
-
let offset = 0;
|
|
6144
|
-
extraField.forEach(data => extraFieldSize += 4 + getLength(data));
|
|
6145
|
-
rawExtraField = new Uint8Array(extraFieldSize);
|
|
6146
|
-
const rawExtraFieldView = getDataView(rawExtraField);
|
|
6147
|
-
extraField.forEach((data, type) => {
|
|
6148
|
-
if (type > MAX_16_BITS) {
|
|
6149
|
-
throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
|
|
6150
|
-
}
|
|
6151
|
-
if (getLength(data) > MAX_16_BITS) {
|
|
6152
|
-
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6153
|
-
}
|
|
6154
|
-
setUint16(rawExtraFieldView, offset, type);
|
|
6155
|
-
setUint16(rawExtraFieldView, offset + 2, getLength(data));
|
|
6156
|
-
arraySet(rawExtraField, data, offset + 4);
|
|
6157
|
-
offset += 4 + getLength(data);
|
|
6158
|
-
});
|
|
6159
|
-
}
|
|
6183
|
+
const rawExtraField = serializeExtraField(options[PROPERTY_NAME_EXTRA_FIELD]);
|
|
6184
|
+
const rawLocalExtraField = serializeExtraField(options[OPTION_LOCAL_EXTRA_FIELD]);
|
|
6160
6185
|
return {
|
|
6161
6186
|
comment,
|
|
6162
6187
|
resolvedOptions: {
|
|
@@ -6190,11 +6215,36 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6190
6215
|
useCompressionStream,
|
|
6191
6216
|
dataDescriptor,
|
|
6192
6217
|
zip64,
|
|
6193
|
-
rawExtraField
|
|
6218
|
+
rawExtraField,
|
|
6219
|
+
rawLocalExtraField
|
|
6194
6220
|
}
|
|
6195
6221
|
};
|
|
6196
6222
|
}
|
|
6197
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
|
+
|
|
6198
6248
|
async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, options) {
|
|
6199
6249
|
const { passThrough, zipCrypto, password, rawPassword, encryptionStrength } = metadata;
|
|
6200
6250
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
@@ -6519,7 +6569,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6519
6569
|
msdosAttributes
|
|
6520
6570
|
};
|
|
6521
6571
|
let {
|
|
6522
|
-
|
|
6572
|
+
crc32,
|
|
6523
6573
|
uncompressedSize
|
|
6524
6574
|
} = options;
|
|
6525
6575
|
let compressedSize = 0;
|
|
@@ -6539,7 +6589,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6539
6589
|
encryptionStrength,
|
|
6540
6590
|
zipCrypto: encrypted && zipCrypto,
|
|
6541
6591
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
|
|
6542
|
-
|
|
6592
|
+
computeCrc32: !passThrough,
|
|
6543
6593
|
compressed: compressed && !passThrough,
|
|
6544
6594
|
encrypted: encrypted && !passThrough,
|
|
6545
6595
|
useWebWorkers,
|
|
@@ -6558,7 +6608,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6558
6608
|
writer.size += compressedSize;
|
|
6559
6609
|
if (!passThrough) {
|
|
6560
6610
|
uncompressedSize = result.inputSize;
|
|
6561
|
-
|
|
6611
|
+
if (!encrypted || zipCrypto) {
|
|
6612
|
+
crc32 = result.crc32;
|
|
6613
|
+
}
|
|
6562
6614
|
}
|
|
6563
6615
|
if ((!zip64CompressedSize && compressedSize >= MAX_32_BITS) ||
|
|
6564
6616
|
(!zip64UncompressedSize && uncompressedSize >= MAX_32_BITS)) {
|
|
@@ -6573,7 +6625,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6573
6625
|
|
|
6574
6626
|
}
|
|
6575
6627
|
setEntryInfo({
|
|
6576
|
-
|
|
6628
|
+
crc32,
|
|
6577
6629
|
compressedSize,
|
|
6578
6630
|
uncompressedSize,
|
|
6579
6631
|
headerInfo,
|
|
@@ -6596,7 +6648,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
6596
6648
|
version,
|
|
6597
6649
|
headerArray,
|
|
6598
6650
|
headerView,
|
|
6599
|
-
signature,
|
|
6651
|
+
signature: crc32,
|
|
6652
|
+
crc32: encrypted && !zipCrypto && !passThrough ? UNDEFINED_VALUE : crc32,
|
|
6600
6653
|
extraFieldExtendedTimestampFlag,
|
|
6601
6654
|
zip64UncompressedSize,
|
|
6602
6655
|
zip64CompressedSize
|
|
@@ -6617,6 +6670,7 @@ function getHeaderInfo(options) {
|
|
|
6617
6670
|
dataDescriptor,
|
|
6618
6671
|
directory,
|
|
6619
6672
|
rawExtraField,
|
|
6673
|
+
rawLocalExtraField,
|
|
6620
6674
|
encryptionStrength,
|
|
6621
6675
|
extendedTimestamp,
|
|
6622
6676
|
ntfsTimestamp,
|
|
@@ -6624,7 +6678,8 @@ function getHeaderInfo(options) {
|
|
|
6624
6678
|
encrypted,
|
|
6625
6679
|
zip64UncompressedSize,
|
|
6626
6680
|
zip64CompressedSize,
|
|
6627
|
-
uncompressedSize
|
|
6681
|
+
uncompressedSize,
|
|
6682
|
+
crc32
|
|
6628
6683
|
} = options;
|
|
6629
6684
|
let { version, compressionMethod } = options;
|
|
6630
6685
|
const compressed = !directory && (compressionMethod === UNDEFINED_VALUE
|
|
@@ -6697,8 +6752,8 @@ function getHeaderInfo(options) {
|
|
|
6697
6752
|
extraFieldNTFS.uint16(EXTRAFIELD_TYPE_NTFS_TAG1);
|
|
6698
6753
|
extraFieldNTFS.uint16(24);
|
|
6699
6754
|
extraFieldNTFS.uint64(lastModTimeNTFS);
|
|
6700
|
-
extraFieldNTFS.uint64(getTimeNTFS(lastAccessDate)
|
|
6701
|
-
extraFieldNTFS.uint64(getTimeNTFS(creationDate)
|
|
6755
|
+
extraFieldNTFS.uint64(lastAccessDate ? getTimeNTFS(lastAccessDate) : lastModTimeNTFS);
|
|
6756
|
+
extraFieldNTFS.uint64(creationDate ? getTimeNTFS(creationDate) : lastModTimeNTFS);
|
|
6702
6757
|
rawExtraFieldNTFS = extraFieldNTFS.array;
|
|
6703
6758
|
} catch {
|
|
6704
6759
|
rawExtraFieldNTFS = EMPTY_UINT8_ARRAY;
|
|
@@ -6712,7 +6767,7 @@ function getHeaderInfo(options) {
|
|
|
6712
6767
|
let rawExtraFieldUnix;
|
|
6713
6768
|
try {
|
|
6714
6769
|
const { uid, gid, unixExtraFieldType } = options;
|
|
6715
|
-
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
6770
|
+
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE$1 && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
6716
6771
|
const uidBytes = packUnixId(uid);
|
|
6717
6772
|
const gidBytes = packUnixId(gid);
|
|
6718
6773
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
@@ -6750,15 +6805,18 @@ function getHeaderInfo(options) {
|
|
|
6750
6805
|
}
|
|
6751
6806
|
if (encrypted && !zipCrypto) {
|
|
6752
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
|
+
}
|
|
6753
6811
|
rawExtraFieldAES[9] = compressionMethod;
|
|
6754
6812
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
6755
6813
|
}
|
|
6756
6814
|
const localExtraFieldZip64Length = writeLocalExtraFieldZip64 ? getLength(rawLocalExtraFieldZip64) : 0;
|
|
6757
|
-
const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
|
|
6815
|
+
const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField, rawLocalExtraField);
|
|
6758
6816
|
if (extraFieldLength > MAX_16_BITS) {
|
|
6759
6817
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6760
6818
|
}
|
|
6761
|
-
const dosLastModDate = new Date(Math.ceil(lastModDate.getTime() /
|
|
6819
|
+
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
6762
6820
|
const {
|
|
6763
6821
|
headerArray,
|
|
6764
6822
|
headerView,
|
|
@@ -6788,6 +6846,7 @@ function getHeaderInfo(options) {
|
|
|
6788
6846
|
localHeader.bytes(rawExtraFieldNTFS);
|
|
6789
6847
|
localHeader.bytes(rawExtraFieldUnix);
|
|
6790
6848
|
localHeader.bytes(rawExtraField);
|
|
6849
|
+
localHeader.bytes(rawLocalExtraField);
|
|
6791
6850
|
if (dataDescriptor) {
|
|
6792
6851
|
if (!zip64CompressedSize) {
|
|
6793
6852
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + LOCAL_HEADER_COMMON_OFFSET, 0);
|
|
@@ -6906,7 +6965,7 @@ function getDataDescriptorInfo({
|
|
|
6906
6965
|
}
|
|
6907
6966
|
|
|
6908
6967
|
function setEntryInfo({
|
|
6909
|
-
|
|
6968
|
+
crc32,
|
|
6910
6969
|
compressedSize,
|
|
6911
6970
|
uncompressedSize,
|
|
6912
6971
|
headerInfo,
|
|
@@ -6914,6 +6973,7 @@ function setEntryInfo({
|
|
|
6914
6973
|
}, {
|
|
6915
6974
|
zip64,
|
|
6916
6975
|
zipCrypto,
|
|
6976
|
+
passThrough,
|
|
6917
6977
|
dataDescriptor
|
|
6918
6978
|
}) {
|
|
6919
6979
|
const {
|
|
@@ -6924,10 +6984,10 @@ function setEntryInfo({
|
|
|
6924
6984
|
dataDescriptorView,
|
|
6925
6985
|
dataDescriptorOffset
|
|
6926
6986
|
} = dataDescriptorInfo;
|
|
6927
|
-
if ((!encrypted || zipCrypto) &&
|
|
6928
|
-
setUint32(headerView, HEADER_OFFSET_SIGNATURE,
|
|
6987
|
+
if ((!encrypted || zipCrypto || passThrough) && crc32 !== UNDEFINED_VALUE) {
|
|
6988
|
+
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
6929
6989
|
if (dataDescriptor) {
|
|
6930
|
-
setUint32(dataDescriptorView, dataDescriptorOffset,
|
|
6990
|
+
setUint32(dataDescriptorView, dataDescriptorOffset, crc32);
|
|
6931
6991
|
}
|
|
6932
6992
|
}
|
|
6933
6993
|
if (zip64) {
|
|
@@ -6950,15 +7010,15 @@ function updateLocalHeader({
|
|
|
6950
7010
|
encrypted,
|
|
6951
7011
|
zip64,
|
|
6952
7012
|
localExtraFieldZip64Length,
|
|
6953
|
-
|
|
7013
|
+
crc32,
|
|
6954
7014
|
compressedSize,
|
|
6955
7015
|
uncompressedSize,
|
|
6956
7016
|
zip64UncompressedSize,
|
|
6957
7017
|
zip64CompressedSize
|
|
6958
|
-
}, localHeaderView, { dataDescriptor }) {
|
|
7018
|
+
}, localHeaderView, { dataDescriptor, passThrough }) {
|
|
6959
7019
|
if (!dataDescriptor) {
|
|
6960
|
-
if (!encrypted) {
|
|
6961
|
-
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);
|
|
6962
7022
|
}
|
|
6963
7023
|
if (!zip64CompressedSize) {
|
|
6964
7024
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + LOCAL_HEADER_COMMON_OFFSET, compressedSize);
|
|
@@ -7267,7 +7327,8 @@ async function flushBufferedData(readable, writer, signal, onChunkWritten) {
|
|
|
7267
7327
|
|
|
7268
7328
|
function getTimeNTFS(date) {
|
|
7269
7329
|
if (date) {
|
|
7270
|
-
|
|
7330
|
+
const timeNTFS = ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
|
|
7331
|
+
return timeNTFS < MIN_NTFS_TIME ? MIN_NTFS_TIME : timeNTFS > MAX_NTFS_TIME ? MAX_NTFS_TIME : timeNTFS;
|
|
7271
7332
|
}
|
|
7272
7333
|
}
|
|
7273
7334
|
|
|
@@ -8227,33 +8288,7 @@ function terminateWorkersAndModule() {
|
|
|
8227
8288
|
resetWasmModule();
|
|
8228
8289
|
}
|
|
8229
8290
|
|
|
8230
|
-
|
|
8231
|
-
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
8232
|
-
|
|
8233
|
-
Redistribution and use in source and binary forms, with or without
|
|
8234
|
-
modification, are permitted provided that the following conditions are met:
|
|
8235
|
-
|
|
8236
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
8237
|
-
this list of conditions and the following disclaimer.
|
|
8238
|
-
|
|
8239
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
8240
|
-
notice, this list of conditions and the following disclaimer in
|
|
8241
|
-
the documentation and/or other materials provided with the distribution.
|
|
8242
|
-
|
|
8243
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
8244
|
-
derived from this software without specific prior written permission.
|
|
8245
|
-
|
|
8246
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
8247
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
8248
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
8249
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
8250
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
8251
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
8252
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
8253
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
8254
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
8255
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8256
|
-
*/
|
|
8291
|
+
/// <reference types="../index.d.ts" />
|
|
8257
8292
|
|
|
8258
8293
|
|
|
8259
8294
|
configureExternalAssets();
|
|
@@ -8289,6 +8324,20 @@ configureExternalAssets();
|
|
|
8289
8324
|
|
|
8290
8325
|
const ERR_ENTRY_EXISTS = "Entry filename already exists";
|
|
8291
8326
|
const ERR_READABLE_CONSUMED = "Readable stream already consumed";
|
|
8327
|
+
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
8328
|
+
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
8329
|
+
EXTRAFIELD_TYPE_ZIP64,
|
|
8330
|
+
EXTRAFIELD_TYPE_AES,
|
|
8331
|
+
EXTRAFIELD_TYPE_NTFS,
|
|
8332
|
+
EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,
|
|
8333
|
+
EXTRAFIELD_TYPE_UNICODE_PATH,
|
|
8334
|
+
EXTRAFIELD_TYPE_UNICODE_COMMENT,
|
|
8335
|
+
EXTRAFIELD_TYPE_USDZ,
|
|
8336
|
+
EXTRAFIELD_TYPE_INFOZIP,
|
|
8337
|
+
EXTRAFIELD_TYPE_UNIX,
|
|
8338
|
+
EXTRAFIELD_TYPE_UNIX_TYPE1,
|
|
8339
|
+
EXTRAFIELD_TYPE_PKWARE_UNIX
|
|
8340
|
+
]);
|
|
8292
8341
|
|
|
8293
8342
|
class ZipEntry {
|
|
8294
8343
|
|
|
@@ -9026,6 +9075,20 @@ function detach(entry) {
|
|
|
9026
9075
|
}
|
|
9027
9076
|
}
|
|
9028
9077
|
|
|
9078
|
+
function getUserExtraField(extraField) {
|
|
9079
|
+
if (extraField) {
|
|
9080
|
+
const userExtraField = new Map();
|
|
9081
|
+
extraField.forEach((field, type) => {
|
|
9082
|
+
if (!INTERPRETED_EXTRA_FIELD_TYPES.has(type)) {
|
|
9083
|
+
userExtraField.set(type, field.data);
|
|
9084
|
+
}
|
|
9085
|
+
});
|
|
9086
|
+
if (userExtraField.size) {
|
|
9087
|
+
return userExtraField;
|
|
9088
|
+
}
|
|
9089
|
+
}
|
|
9090
|
+
}
|
|
9091
|
+
|
|
9029
9092
|
async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
9030
9093
|
const selectedEntry = entry;
|
|
9031
9094
|
const entryOffsets = new Map();
|
|
@@ -9063,9 +9126,13 @@ async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
|
9063
9126
|
uncompressedSize,
|
|
9064
9127
|
encrypted,
|
|
9065
9128
|
zipCrypto,
|
|
9066
|
-
|
|
9129
|
+
crc32,
|
|
9067
9130
|
compressionMethod,
|
|
9068
|
-
extraFieldAES
|
|
9131
|
+
extraFieldAES,
|
|
9132
|
+
internalFileAttributes,
|
|
9133
|
+
extraField,
|
|
9134
|
+
uid,
|
|
9135
|
+
gid
|
|
9069
9136
|
} = child.data;
|
|
9070
9137
|
zipEntryOptions = {
|
|
9071
9138
|
externalFileAttributes,
|
|
@@ -9073,8 +9140,20 @@ async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
|
9073
9140
|
comment,
|
|
9074
9141
|
lastModDate,
|
|
9075
9142
|
creationDate,
|
|
9076
|
-
lastAccessDate
|
|
9143
|
+
lastAccessDate,
|
|
9144
|
+
internalFileAttributes
|
|
9077
9145
|
};
|
|
9146
|
+
const userExtraField = getUserExtraField(extraField);
|
|
9147
|
+
if (userExtraField) {
|
|
9148
|
+
zipEntryOptions.extraField = userExtraField;
|
|
9149
|
+
}
|
|
9150
|
+
if (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE) {
|
|
9151
|
+
Object.assign(zipEntryOptions, {
|
|
9152
|
+
uid,
|
|
9153
|
+
gid,
|
|
9154
|
+
unixExtraFieldType: options.unixExtraFieldType || INFOZIP_EXTRA_FIELD_TYPE
|
|
9155
|
+
});
|
|
9156
|
+
}
|
|
9078
9157
|
if (child.passThrough) {
|
|
9079
9158
|
let level, encryptionStrength;
|
|
9080
9159
|
if (compressionMethod === 0) {
|
|
@@ -9087,7 +9166,7 @@ async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
|
9087
9166
|
passThrough: true,
|
|
9088
9167
|
encrypted,
|
|
9089
9168
|
zipCrypto,
|
|
9090
|
-
|
|
9169
|
+
crc32,
|
|
9091
9170
|
uncompressedSize,
|
|
9092
9171
|
level,
|
|
9093
9172
|
encryptionStrength,
|
|
@@ -9274,4 +9353,4 @@ function addChild(parent, name, params, directory) {
|
|
|
9274
9353
|
}
|
|
9275
9354
|
}
|
|
9276
9355
|
|
|
9277
|
-
export { BlobReader, BlobWriter, Data64URIReader, Data64URIWriter, ERR_AMBIGUOUS_ARCHIVE, ERR_BAD_FORMAT, ERR_CENTRAL_DIRECTORY_NOT_FOUND, ERR_DUPLICATED_NAME, ERR_ENCRYPTED, ERR_ENCRYPTED_CENTRAL_DIRECTORY, ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND, ERR_EOCDR_NOT_FOUND, ERR_EXTRAFIELD_ZIP64_NOT_FOUND, ERR_HTTP_RANGE, ERR_HTTP_RESOURCE_CHANGED, ERR_INVALID_CODEC_DEFINITION, ERR_INVALID_CODEC_MODULE, ERR_INVALID_COMMENT, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_ENCRYPTION_STRENGTH, ERR_INVALID_ENTRY_COMMENT, ERR_INVALID_ENTRY_NAME, ERR_INVALID_EXTRAFIELD_DATA, ERR_INVALID_EXTRAFIELD_TYPE, ERR_INVALID_PASSWORD, ERR_INVALID_SIGNATURE, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_VERSION, ERR_ITERATOR_COMPLETED_TOO_SOON, ERR_LOCAL_FILE_HEADER_NOT_FOUND, ERR_OVERLAPPING_ENTRY, ERR_RESERVED_COMPRESSION_METHOD, ERR_SPLIT_ZIP_FILE, ERR_UNDEFINED_READER, ERR_UNDEFINED_UNCOMPRESSED_SIZE, ERR_UNSUPPORTED_COMPRESSION$1 as ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_WRITER_NOT_INITIALIZED, ERR_ZIP_NOT_EMPTY, HttpRangeReader, HttpReader, Reader, SplitDataReader, SplitDataWriter, TextReader, TextWriter, Uint8ArrayReader, Uint8ArrayWriter, Writer, ZipReader, ZipReaderStream, ZipWriter, ZipWriterStream, configure, createBlobTempStream, createOPFSTempStream, createSyncAccessHandleTempStream, fs, getMimeType, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };
|
|
9356
|
+
export { BlobReader, BlobWriter, Data64URIReader, Data64URIWriter, ERR_AMBIGUOUS_ARCHIVE, ERR_BAD_FORMAT, ERR_CENTRAL_DIRECTORY_NOT_FOUND, ERR_DUPLICATED_NAME, ERR_ENCRYPTED, ERR_ENCRYPTED_CENTRAL_DIRECTORY, ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND, ERR_EOCDR_NOT_FOUND, ERR_EXTRAFIELD_ZIP64_NOT_FOUND, ERR_HTTP_RANGE, ERR_HTTP_RESOURCE_CHANGED, ERR_INVALID_AUTHENTICATION_CODE, ERR_INVALID_CODEC_DEFINITION, ERR_INVALID_CODEC_MODULE, ERR_INVALID_COMMENT, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, ERR_INVALID_ENCRYPTION_STRENGTH, ERR_INVALID_ENTRY_COMMENT, ERR_INVALID_ENTRY_NAME, ERR_INVALID_EXTRAFIELD_DATA, ERR_INVALID_EXTRAFIELD_TYPE, ERR_INVALID_PASSWORD, ERR_INVALID_SIGNATURE, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_VERSION, ERR_ITERATOR_COMPLETED_TOO_SOON, ERR_LOCAL_FILE_HEADER_NOT_FOUND, ERR_OVERLAPPING_ENTRY, ERR_RESERVED_COMPRESSION_METHOD, ERR_SPLIT_ZIP_FILE, ERR_UNDEFINED_READER, ERR_UNDEFINED_UNCOMPRESSED_SIZE, ERR_UNSUPPORTED_COMPRESSION$1 as ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_WRITER_NOT_INITIALIZED, ERR_ZIP_NOT_EMPTY, HttpRangeReader, HttpReader, Reader, SplitDataReader, SplitDataWriter, TextReader, TextWriter, Uint8ArrayReader, Uint8ArrayWriter, Writer, ZipReader, ZipReaderStream, ZipWriter, ZipWriterStream, configure, createBlobTempStream, createOPFSTempStream, createSyncAccessHandleTempStream, fs, getMimeType, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };
|