@zip.js/zip.js 2.8.43 → 2.8.44
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 +1 -1
- package/dist/zip-core-external.js +67 -47
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +68 -46
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +67 -47
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +66 -46
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +67 -47
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +70 -48
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +69 -47
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +70 -48
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +70 -48
- 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 +69 -47
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +70 -48
- package/index-native.min.js +1 -1
- package/index.cjs +69 -47
- package/index.d.cts +80 -7
- package/index.d.ts +80 -7
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +6 -2
- package/lib/core/options.js +4 -0
- package/lib/core/streams/aes-crypto-stream.js +4 -4
- package/lib/core/streams/codec-stream.js +4 -0
- package/lib/core/streams/common-crypto.js +2 -0
- package/lib/core/streams/zip-entry-stream.js +12 -8
- 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 +3 -0
- package/lib/core/zip-reader.js +35 -26
- package/lib/core/zip-writer.js +16 -7
- package/lib/zip-core-reader.js +2 -0
- package/package.json +1 -1
- package/worker-message-property-names.js +1 -1
package/dist/zip-core.js
CHANGED
|
@@ -1369,6 +1369,7 @@
|
|
|
1369
1369
|
|
|
1370
1370
|
const ERR_INVALID_PASSWORD = "Invalid password";
|
|
1371
1371
|
const ERR_INVALID_SIGNATURE = "Invalid signature";
|
|
1372
|
+
const ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_SIGNATURE;
|
|
1372
1373
|
const ERR_ABORT_CHECK_PASSWORD = "zipjs-abort-check-password";
|
|
1373
1374
|
const ERR_UNSUPPORTED_CRYPTO_API = "Crypto API not supported";
|
|
1374
1375
|
|
|
@@ -1435,7 +1436,7 @@
|
|
|
1435
1436
|
|
|
1436
1437
|
class AESDecryptionStream extends TransformStream {
|
|
1437
1438
|
|
|
1438
|
-
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly }) {
|
|
1439
|
+
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
|
|
1439
1440
|
super({
|
|
1440
1441
|
start() {
|
|
1441
1442
|
initAesCrypto(this, password, rawPassword, encryptionStrength);
|
|
@@ -1485,8 +1486,8 @@
|
|
|
1485
1486
|
for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
|
|
1486
1487
|
invalidSignature |= signature[indexSignature] ^ originalSignature[indexSignature];
|
|
1487
1488
|
}
|
|
1488
|
-
if (invalidSignature) {
|
|
1489
|
-
throw new Error(
|
|
1489
|
+
if (invalidSignature && checkAuthenticationCode) {
|
|
1490
|
+
throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
|
|
1490
1491
|
}
|
|
1491
1492
|
controller.enqueue(decryptedChunkArray);
|
|
1492
1493
|
}
|
|
@@ -1924,6 +1925,7 @@
|
|
|
1924
1925
|
|
|
1925
1926
|
const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
|
|
1926
1927
|
const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
|
|
1928
|
+
const ERR_INVALID_CRC32 = ERR_INVALID_SIGNATURE;
|
|
1927
1929
|
const ERR_UNSUPPORTED_COMPRESSION$2 = "Compression method not supported";
|
|
1928
1930
|
const FORMAT_DEFLATE_RAW = "deflate-raw";
|
|
1929
1931
|
const FORMAT_DEFLATE64_RAW = "deflate64-raw";
|
|
@@ -1937,14 +1939,14 @@
|
|
|
1937
1939
|
|
|
1938
1940
|
constructor(options, { chunkSize, CompressionStreamZlib, CompressionStream }) {
|
|
1939
1941
|
super({});
|
|
1940
|
-
const { compressed, encrypted, useCompressionStream, zipCrypto,
|
|
1942
|
+
const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
|
|
1941
1943
|
const stream = this;
|
|
1942
1944
|
let crc32Stream, encryptionStream, gzipCrc32Stream;
|
|
1943
1945
|
let readable = super.readable;
|
|
1944
1946
|
const codecStreams = format && getCodecStreams(format);
|
|
1945
|
-
const useGzipCrc32 =
|
|
1947
|
+
const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams && (!encrypted || zipCrypto) &&
|
|
1946
1948
|
Boolean(useCompressionStream && CompressionStream);
|
|
1947
|
-
if ((!encrypted || zipCrypto) &&
|
|
1949
|
+
if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
|
|
1948
1950
|
crc32Stream = new Crc32Stream();
|
|
1949
1951
|
readable = pipeThrough(readable, crc32Stream);
|
|
1950
1952
|
}
|
|
@@ -1983,7 +1985,7 @@
|
|
|
1983
1985
|
if (encrypted && !zipCrypto) {
|
|
1984
1986
|
signature = encryptionStream.signature;
|
|
1985
1987
|
}
|
|
1986
|
-
if ((!encrypted || zipCrypto) &&
|
|
1988
|
+
if ((!encrypted || zipCrypto) && computeCrc32) {
|
|
1987
1989
|
signature = useGzipCrc32 ? gzipCrc32Stream.signature : new DataView(crc32Stream.value.buffer).getUint32(0);
|
|
1988
1990
|
}
|
|
1989
1991
|
stream.signature = signature;
|
|
@@ -2106,7 +2108,7 @@
|
|
|
2106
2108
|
|
|
2107
2109
|
constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
|
|
2108
2110
|
super({});
|
|
2109
|
-
const { zipCrypto, encrypted,
|
|
2111
|
+
const { zipCrypto, encrypted, checkCrc32, signature, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
|
|
2110
2112
|
let crc32Stream, decryptionStream;
|
|
2111
2113
|
let readable = super.readable;
|
|
2112
2114
|
if (encrypted) {
|
|
@@ -2139,15 +2141,15 @@
|
|
|
2139
2141
|
}
|
|
2140
2142
|
readable = mapInflateStreamError(readable);
|
|
2141
2143
|
}
|
|
2142
|
-
if (
|
|
2144
|
+
if (checkCrc32) {
|
|
2143
2145
|
crc32Stream = new Crc32Stream();
|
|
2144
2146
|
readable = pipeThrough(readable, crc32Stream);
|
|
2145
2147
|
}
|
|
2146
2148
|
setReadable(this, readable, () => {
|
|
2147
|
-
if (
|
|
2149
|
+
if (checkCrc32) {
|
|
2148
2150
|
const dataViewSignature = new DataView(crc32Stream.value.buffer);
|
|
2149
2151
|
if (signature != dataViewSignature.getUint32(0, false)) {
|
|
2150
|
-
throw new Error(
|
|
2152
|
+
throw new Error(ERR_INVALID_CRC32);
|
|
2151
2153
|
}
|
|
2152
2154
|
}
|
|
2153
2155
|
});
|
|
@@ -3038,7 +3040,7 @@
|
|
|
3038
3040
|
|
|
3039
3041
|
async function runWorker(stream, workerOptions) {
|
|
3040
3042
|
const { options, config } = workerOptions;
|
|
3041
|
-
const { transferStreams, useWebWorkers, useCompressionStream, compressed,
|
|
3043
|
+
const { transferStreams, useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3042
3044
|
const { workerURI, maxWorkers } = config;
|
|
3043
3045
|
if (format) {
|
|
3044
3046
|
if (codecURI) {
|
|
@@ -3047,7 +3049,7 @@
|
|
|
3047
3049
|
await ensureCodecStreams(format, options.codecURI);
|
|
3048
3050
|
}
|
|
3049
3051
|
workerOptions.transferStreams = transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams);
|
|
3050
|
-
const streamCopy = !compressed && !
|
|
3052
|
+
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3051
3053
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3052
3054
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
3053
3055
|
workerOptions.workerURI = workerOptions.useWebWorkers && workerURI ? workerURI : UNDEFINED_VALUE;
|
|
@@ -4271,6 +4273,7 @@
|
|
|
4271
4273
|
const PROPERTY_NAME_EXECUTABLE = "executable";
|
|
4272
4274
|
const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
|
|
4273
4275
|
const PROPERTY_NAME_SIGNATURE = "signature";
|
|
4276
|
+
const PROPERTY_NAME_CRC32 = "crc32";
|
|
4274
4277
|
const PROPERTY_NAME_EXTRA_FIELD = "extraField";
|
|
4275
4278
|
const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
|
|
4276
4279
|
const PROPERTY_NAME_EXTRA_FIELD_UNIX = "extraFieldUnix";
|
|
@@ -4319,6 +4322,7 @@
|
|
|
4319
4322
|
PROPERTY_NAME_EXECUTABLE,
|
|
4320
4323
|
PROPERTY_NAME_COMPRESSION_METHOD,
|
|
4321
4324
|
PROPERTY_NAME_SIGNATURE,
|
|
4325
|
+
PROPERTY_NAME_CRC32,
|
|
4322
4326
|
PROPERTY_NAME_EXTRA_FIELD,
|
|
4323
4327
|
PROPERTY_NAME_EXTRA_FIELD_UNIX,
|
|
4324
4328
|
PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
|
|
@@ -4390,6 +4394,8 @@
|
|
|
4390
4394
|
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
4391
4395
|
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
4392
4396
|
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
4397
|
+
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
4398
|
+
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
4393
4399
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
4394
4400
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
4395
4401
|
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
@@ -4461,6 +4467,7 @@
|
|
|
4461
4467
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4462
4468
|
const CHARSET_CP437 = "cp437";
|
|
4463
4469
|
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4470
|
+
const VENDOR_VERSION_AE_1 = 1;
|
|
4464
4471
|
const ZIP64_PROPERTIES = [
|
|
4465
4472
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
4466
4473
|
[PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -4940,6 +4947,11 @@
|
|
|
4940
4947
|
if (deflate64) {
|
|
4941
4948
|
useCompressionStream = false;
|
|
4942
4949
|
}
|
|
4950
|
+
const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
|
|
4951
|
+
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
4952
|
+
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
4953
|
+
checkCrc32Option) && !passThrough &&
|
|
4954
|
+
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1));
|
|
4943
4955
|
const workerOptions = {
|
|
4944
4956
|
options: {
|
|
4945
4957
|
codecType: CODEC_INFLATE,
|
|
@@ -4947,7 +4959,8 @@
|
|
|
4947
4959
|
rawPassword,
|
|
4948
4960
|
zipCrypto,
|
|
4949
4961
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
4950
|
-
|
|
4962
|
+
checkCrc32,
|
|
4963
|
+
checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
|
|
4951
4964
|
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((signature >>> 24) & MAX_8_BITS)),
|
|
4952
4965
|
outputSize: passThrough ? compressedSize : uncompressedSize,
|
|
4953
4966
|
signature,
|
|
@@ -5063,6 +5076,7 @@
|
|
|
5063
5076
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
5064
5077
|
Object.assign(directory, {
|
|
5065
5078
|
signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5079
|
+
crc32: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
5066
5080
|
compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
|
|
5067
5081
|
uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
|
|
5068
5082
|
});
|
|
@@ -5164,6 +5178,9 @@
|
|
|
5164
5178
|
compressionMethod: getUint16(extraFieldView, 5)
|
|
5165
5179
|
});
|
|
5166
5180
|
directory.compressionMethod = extraFieldAES.compressionMethod;
|
|
5181
|
+
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1) {
|
|
5182
|
+
directory.crc32 = UNDEFINED_VALUE;
|
|
5183
|
+
}
|
|
5167
5184
|
}
|
|
5168
5185
|
|
|
5169
5186
|
function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
@@ -5182,26 +5199,22 @@
|
|
|
5182
5199
|
} catch {
|
|
5183
5200
|
// ignored
|
|
5184
5201
|
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
Object.assign(directory, extraFieldData);
|
|
5202
|
-
}
|
|
5203
|
-
} catch {
|
|
5204
|
-
// ignored
|
|
5202
|
+
if (tag1Data && tag1Data.length == 24) {
|
|
5203
|
+
const tag1View = getDataView(tag1Data);
|
|
5204
|
+
const rawLastModDate = tag1View.getBigUint64(0, true);
|
|
5205
|
+
const rawLastAccessDate = tag1View.getBigUint64(8, true);
|
|
5206
|
+
const rawCreationDate = tag1View.getBigUint64(16, true);
|
|
5207
|
+
Object.assign(extraFieldNTFS, {
|
|
5208
|
+
rawLastModDate,
|
|
5209
|
+
rawLastAccessDate,
|
|
5210
|
+
rawCreationDate
|
|
5211
|
+
});
|
|
5212
|
+
const lastModDate = getDateNTFS(rawLastModDate);
|
|
5213
|
+
const lastAccessDate = getDateNTFS(rawLastAccessDate);
|
|
5214
|
+
const creationDate = getDateNTFS(rawCreationDate);
|
|
5215
|
+
const extraFieldData = { lastModDate, lastAccessDate, creationDate };
|
|
5216
|
+
Object.assign(extraFieldNTFS, extraFieldData);
|
|
5217
|
+
Object.assign(directory, extraFieldData);
|
|
5205
5218
|
}
|
|
5206
5219
|
}
|
|
5207
5220
|
|
|
@@ -5504,11 +5517,7 @@
|
|
|
5504
5517
|
|
|
5505
5518
|
function getDate(timeRaw) {
|
|
5506
5519
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
|
|
5507
|
-
|
|
5508
|
-
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5509
|
-
} catch {
|
|
5510
|
-
// ignored
|
|
5511
|
-
}
|
|
5520
|
+
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5512
5521
|
}
|
|
5513
5522
|
|
|
5514
5523
|
function getDateNTFS(timeRaw) {
|
|
@@ -5541,7 +5550,9 @@
|
|
|
5541
5550
|
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
5542
5551
|
ERR_EOCDR_NOT_FOUND: ERR_EOCDR_NOT_FOUND,
|
|
5543
5552
|
ERR_EXTRAFIELD_ZIP64_NOT_FOUND: ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
5553
|
+
ERR_INVALID_AUTHENTICATION_CODE: ERR_INVALID_AUTHENTICATION_CODE,
|
|
5544
5554
|
ERR_INVALID_COMPRESSED_DATA: ERR_INVALID_COMPRESSED_DATA,
|
|
5555
|
+
ERR_INVALID_CRC32: ERR_INVALID_CRC32,
|
|
5545
5556
|
ERR_INVALID_PASSWORD: ERR_INVALID_PASSWORD,
|
|
5546
5557
|
ERR_INVALID_SIGNATURE: ERR_INVALID_SIGNATURE,
|
|
5547
5558
|
ERR_INVALID_UNCOMPRESSED_SIZE: ERR_INVALID_UNCOMPRESSED_SIZE,
|
|
@@ -5595,6 +5606,8 @@
|
|
|
5595
5606
|
const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
|
|
5596
5607
|
const MIN_UNIX_TIME = -2147483648;
|
|
5597
5608
|
const MAX_UNIX_TIME = 2147483647;
|
|
5609
|
+
const MIN_NTFS_TIME = BigInt(0);
|
|
5610
|
+
const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
|
|
5598
5611
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
|
|
5599
5612
|
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
5600
5613
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
@@ -6488,9 +6501,12 @@
|
|
|
6488
6501
|
msdosAttributes
|
|
6489
6502
|
};
|
|
6490
6503
|
let {
|
|
6491
|
-
signature,
|
|
6504
|
+
crc32: signature,
|
|
6492
6505
|
uncompressedSize
|
|
6493
6506
|
} = options;
|
|
6507
|
+
if (signature === UNDEFINED_VALUE) {
|
|
6508
|
+
({ signature } = options);
|
|
6509
|
+
}
|
|
6494
6510
|
let compressedSize = 0;
|
|
6495
6511
|
if (!passThrough) {
|
|
6496
6512
|
uncompressedSize = 0;
|
|
@@ -6508,7 +6524,7 @@
|
|
|
6508
6524
|
encryptionStrength,
|
|
6509
6525
|
zipCrypto: encrypted && zipCrypto,
|
|
6510
6526
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
|
|
6511
|
-
|
|
6527
|
+
computeCrc32: !passThrough,
|
|
6512
6528
|
compressed: compressed && !passThrough,
|
|
6513
6529
|
encrypted: encrypted && !passThrough,
|
|
6514
6530
|
useWebWorkers,
|
|
@@ -6527,7 +6543,9 @@
|
|
|
6527
6543
|
writer.size += compressedSize;
|
|
6528
6544
|
if (!passThrough) {
|
|
6529
6545
|
uncompressedSize = result.inputSize;
|
|
6530
|
-
|
|
6546
|
+
if (!encrypted || zipCrypto) {
|
|
6547
|
+
signature = result.signature;
|
|
6548
|
+
}
|
|
6531
6549
|
}
|
|
6532
6550
|
if ((!zip64CompressedSize && compressedSize >= MAX_32_BITS) ||
|
|
6533
6551
|
(!zip64UncompressedSize && uncompressedSize >= MAX_32_BITS)) {
|
|
@@ -6566,6 +6584,7 @@
|
|
|
6566
6584
|
headerArray,
|
|
6567
6585
|
headerView,
|
|
6568
6586
|
signature,
|
|
6587
|
+
crc32: encrypted && !zipCrypto ? UNDEFINED_VALUE : signature,
|
|
6569
6588
|
extraFieldExtendedTimestampFlag,
|
|
6570
6589
|
zip64UncompressedSize,
|
|
6571
6590
|
zip64CompressedSize
|
|
@@ -6666,8 +6685,8 @@
|
|
|
6666
6685
|
extraFieldNTFS.uint16(EXTRAFIELD_TYPE_NTFS_TAG1);
|
|
6667
6686
|
extraFieldNTFS.uint16(24);
|
|
6668
6687
|
extraFieldNTFS.uint64(lastModTimeNTFS);
|
|
6669
|
-
extraFieldNTFS.uint64(getTimeNTFS(lastAccessDate)
|
|
6670
|
-
extraFieldNTFS.uint64(getTimeNTFS(creationDate)
|
|
6688
|
+
extraFieldNTFS.uint64(lastAccessDate ? getTimeNTFS(lastAccessDate) : lastModTimeNTFS);
|
|
6689
|
+
extraFieldNTFS.uint64(creationDate ? getTimeNTFS(creationDate) : lastModTimeNTFS);
|
|
6671
6690
|
rawExtraFieldNTFS = extraFieldNTFS.array;
|
|
6672
6691
|
} catch {
|
|
6673
6692
|
rawExtraFieldNTFS = EMPTY_UINT8_ARRAY;
|
|
@@ -6727,7 +6746,7 @@
|
|
|
6727
6746
|
if (extraFieldLength > MAX_16_BITS) {
|
|
6728
6747
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6729
6748
|
}
|
|
6730
|
-
const dosLastModDate = new Date(Math.ceil(lastModDate.getTime() /
|
|
6749
|
+
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
6731
6750
|
const {
|
|
6732
6751
|
headerArray,
|
|
6733
6752
|
headerView,
|
|
@@ -7236,7 +7255,8 @@
|
|
|
7236
7255
|
|
|
7237
7256
|
function getTimeNTFS(date) {
|
|
7238
7257
|
if (date) {
|
|
7239
|
-
|
|
7258
|
+
const timeNTFS = ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
|
|
7259
|
+
return timeNTFS < MIN_NTFS_TIME ? MIN_NTFS_TIME : timeNTFS > MAX_NTFS_TIME ? MAX_NTFS_TIME : timeNTFS;
|
|
7240
7260
|
}
|
|
7241
7261
|
}
|
|
7242
7262
|
|
|
@@ -7841,10 +7861,12 @@
|
|
|
7841
7861
|
exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
|
|
7842
7862
|
exports.ERR_HTTP_RANGE = ERR_HTTP_RANGE;
|
|
7843
7863
|
exports.ERR_HTTP_RESOURCE_CHANGED = ERR_HTTP_RESOURCE_CHANGED;
|
|
7864
|
+
exports.ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_AUTHENTICATION_CODE;
|
|
7844
7865
|
exports.ERR_INVALID_CODEC_DEFINITION = ERR_INVALID_CODEC_DEFINITION;
|
|
7845
7866
|
exports.ERR_INVALID_CODEC_MODULE = ERR_INVALID_CODEC_MODULE;
|
|
7846
7867
|
exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
|
|
7847
7868
|
exports.ERR_INVALID_COMPRESSED_DATA = ERR_INVALID_COMPRESSED_DATA;
|
|
7869
|
+
exports.ERR_INVALID_CRC32 = ERR_INVALID_CRC32;
|
|
7848
7870
|
exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
|
|
7849
7871
|
exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
|
|
7850
7872
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|