@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-fs-core.js
CHANGED
|
@@ -2315,6 +2315,7 @@
|
|
|
2315
2315
|
|
|
2316
2316
|
const ERR_INVALID_PASSWORD = "Invalid password";
|
|
2317
2317
|
const ERR_INVALID_SIGNATURE = "Invalid signature";
|
|
2318
|
+
const ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_SIGNATURE;
|
|
2318
2319
|
const ERR_ABORT_CHECK_PASSWORD = "zipjs-abort-check-password";
|
|
2319
2320
|
const ERR_UNSUPPORTED_CRYPTO_API = "Crypto API not supported";
|
|
2320
2321
|
|
|
@@ -2381,7 +2382,7 @@
|
|
|
2381
2382
|
|
|
2382
2383
|
class AESDecryptionStream extends TransformStream {
|
|
2383
2384
|
|
|
2384
|
-
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly }) {
|
|
2385
|
+
constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
|
|
2385
2386
|
super({
|
|
2386
2387
|
start() {
|
|
2387
2388
|
initAesCrypto(this, password, rawPassword, encryptionStrength);
|
|
@@ -2431,8 +2432,8 @@
|
|
|
2431
2432
|
for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
|
|
2432
2433
|
invalidSignature |= signature[indexSignature] ^ originalSignature[indexSignature];
|
|
2433
2434
|
}
|
|
2434
|
-
if (invalidSignature) {
|
|
2435
|
-
throw new Error(
|
|
2435
|
+
if (invalidSignature && checkAuthenticationCode) {
|
|
2436
|
+
throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
|
|
2436
2437
|
}
|
|
2437
2438
|
controller.enqueue(decryptedChunkArray);
|
|
2438
2439
|
}
|
|
@@ -2803,6 +2804,7 @@
|
|
|
2803
2804
|
|
|
2804
2805
|
const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
|
|
2805
2806
|
const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
|
|
2807
|
+
const ERR_INVALID_CRC32 = ERR_INVALID_SIGNATURE;
|
|
2806
2808
|
const ERR_UNSUPPORTED_COMPRESSION$2 = "Compression method not supported";
|
|
2807
2809
|
const FORMAT_DEFLATE_RAW = "deflate-raw";
|
|
2808
2810
|
const FORMAT_DEFLATE64_RAW = "deflate64-raw";
|
|
@@ -2816,14 +2818,14 @@
|
|
|
2816
2818
|
|
|
2817
2819
|
constructor(options, { chunkSize, CompressionStreamZlib, CompressionStream }) {
|
|
2818
2820
|
super({});
|
|
2819
|
-
const { compressed, encrypted, useCompressionStream, zipCrypto,
|
|
2821
|
+
const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
|
|
2820
2822
|
const stream = this;
|
|
2821
2823
|
let crc32Stream, encryptionStream, gzipCrc32Stream;
|
|
2822
2824
|
let readable = super.readable;
|
|
2823
2825
|
const codecStreams = format && getCodecStreams(format);
|
|
2824
|
-
const useGzipCrc32 =
|
|
2826
|
+
const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams && (!encrypted || zipCrypto) &&
|
|
2825
2827
|
Boolean(useCompressionStream && CompressionStream);
|
|
2826
|
-
if ((!encrypted || zipCrypto) &&
|
|
2828
|
+
if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
|
|
2827
2829
|
crc32Stream = new Crc32Stream();
|
|
2828
2830
|
readable = pipeThrough(readable, crc32Stream);
|
|
2829
2831
|
}
|
|
@@ -2862,7 +2864,7 @@
|
|
|
2862
2864
|
if (encrypted && !zipCrypto) {
|
|
2863
2865
|
signature = encryptionStream.signature;
|
|
2864
2866
|
}
|
|
2865
|
-
if ((!encrypted || zipCrypto) &&
|
|
2867
|
+
if ((!encrypted || zipCrypto) && computeCrc32) {
|
|
2866
2868
|
signature = useGzipCrc32 ? gzipCrc32Stream.signature : new DataView(crc32Stream.value.buffer).getUint32(0);
|
|
2867
2869
|
}
|
|
2868
2870
|
stream.signature = signature;
|
|
@@ -2985,7 +2987,7 @@
|
|
|
2985
2987
|
|
|
2986
2988
|
constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
|
|
2987
2989
|
super({});
|
|
2988
|
-
const { zipCrypto, encrypted,
|
|
2990
|
+
const { zipCrypto, encrypted, checkCrc32, signature, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
|
|
2989
2991
|
let crc32Stream, decryptionStream;
|
|
2990
2992
|
let readable = super.readable;
|
|
2991
2993
|
if (encrypted) {
|
|
@@ -3018,15 +3020,15 @@
|
|
|
3018
3020
|
}
|
|
3019
3021
|
readable = mapInflateStreamError(readable);
|
|
3020
3022
|
}
|
|
3021
|
-
if (
|
|
3023
|
+
if (checkCrc32) {
|
|
3022
3024
|
crc32Stream = new Crc32Stream();
|
|
3023
3025
|
readable = pipeThrough(readable, crc32Stream);
|
|
3024
3026
|
}
|
|
3025
3027
|
setReadable(this, readable, () => {
|
|
3026
|
-
if (
|
|
3028
|
+
if (checkCrc32) {
|
|
3027
3029
|
const dataViewSignature = new DataView(crc32Stream.value.buffer);
|
|
3028
3030
|
if (signature != dataViewSignature.getUint32(0, false)) {
|
|
3029
|
-
throw new Error(
|
|
3031
|
+
throw new Error(ERR_INVALID_CRC32);
|
|
3030
3032
|
}
|
|
3031
3033
|
}
|
|
3032
3034
|
});
|
|
@@ -3913,7 +3915,7 @@
|
|
|
3913
3915
|
|
|
3914
3916
|
async function runWorker(stream, workerOptions) {
|
|
3915
3917
|
const { options, config } = workerOptions;
|
|
3916
|
-
const { transferStreams, useWebWorkers, useCompressionStream, compressed,
|
|
3918
|
+
const { transferStreams, useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3917
3919
|
const { workerURI, maxWorkers } = config;
|
|
3918
3920
|
if (format) {
|
|
3919
3921
|
if (codecURI) {
|
|
@@ -3922,7 +3924,7 @@
|
|
|
3922
3924
|
await ensureCodecStreams(format, options.codecURI);
|
|
3923
3925
|
}
|
|
3924
3926
|
workerOptions.transferStreams = transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams);
|
|
3925
|
-
const streamCopy = !compressed && !
|
|
3927
|
+
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3926
3928
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3927
3929
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
3928
3930
|
workerOptions.workerURI = workerOptions.useWebWorkers && workerURI ? workerURI : UNDEFINED_VALUE;
|
|
@@ -4165,6 +4167,7 @@
|
|
|
4165
4167
|
const PROPERTY_NAME_EXECUTABLE = "executable";
|
|
4166
4168
|
const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
|
|
4167
4169
|
const PROPERTY_NAME_SIGNATURE = "signature";
|
|
4170
|
+
const PROPERTY_NAME_CRC32 = "crc32";
|
|
4168
4171
|
const PROPERTY_NAME_EXTRA_FIELD = "extraField";
|
|
4169
4172
|
const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
|
|
4170
4173
|
const PROPERTY_NAME_EXTRA_FIELD_UNIX = "extraFieldUnix";
|
|
@@ -4213,6 +4216,7 @@
|
|
|
4213
4216
|
PROPERTY_NAME_EXECUTABLE,
|
|
4214
4217
|
PROPERTY_NAME_COMPRESSION_METHOD,
|
|
4215
4218
|
PROPERTY_NAME_SIGNATURE,
|
|
4219
|
+
PROPERTY_NAME_CRC32,
|
|
4216
4220
|
PROPERTY_NAME_EXTRA_FIELD,
|
|
4217
4221
|
PROPERTY_NAME_EXTRA_FIELD_UNIX,
|
|
4218
4222
|
PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
|
|
@@ -4284,6 +4288,8 @@
|
|
|
4284
4288
|
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
4285
4289
|
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
4286
4290
|
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
4291
|
+
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
4292
|
+
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
4287
4293
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
4288
4294
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
4289
4295
|
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
@@ -4355,6 +4361,7 @@
|
|
|
4355
4361
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
4356
4362
|
const CHARSET_CP437 = "cp437";
|
|
4357
4363
|
const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
|
|
4364
|
+
const VENDOR_VERSION_AE_1 = 1;
|
|
4358
4365
|
const ZIP64_PROPERTIES = [
|
|
4359
4366
|
[PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
|
|
4360
4367
|
[PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
|
|
@@ -4794,6 +4801,11 @@
|
|
|
4794
4801
|
if (deflate64) {
|
|
4795
4802
|
useCompressionStream = false;
|
|
4796
4803
|
}
|
|
4804
|
+
const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
|
|
4805
|
+
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
4806
|
+
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
4807
|
+
checkCrc32Option) && !passThrough &&
|
|
4808
|
+
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1));
|
|
4797
4809
|
const workerOptions = {
|
|
4798
4810
|
options: {
|
|
4799
4811
|
codecType: CODEC_INFLATE,
|
|
@@ -4801,7 +4813,8 @@
|
|
|
4801
4813
|
rawPassword,
|
|
4802
4814
|
zipCrypto,
|
|
4803
4815
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
4804
|
-
|
|
4816
|
+
checkCrc32,
|
|
4817
|
+
checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
|
|
4805
4818
|
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((signature >>> 24) & MAX_8_BITS)),
|
|
4806
4819
|
outputSize: passThrough ? compressedSize : uncompressedSize,
|
|
4807
4820
|
signature,
|
|
@@ -4917,6 +4930,7 @@
|
|
|
4917
4930
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
4918
4931
|
Object.assign(directory, {
|
|
4919
4932
|
signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
4933
|
+
crc32: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
|
|
4920
4934
|
compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
|
|
4921
4935
|
uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
|
|
4922
4936
|
});
|
|
@@ -5018,6 +5032,9 @@
|
|
|
5018
5032
|
compressionMethod: getUint16(extraFieldView, 5)
|
|
5019
5033
|
});
|
|
5020
5034
|
directory.compressionMethod = extraFieldAES.compressionMethod;
|
|
5035
|
+
if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1) {
|
|
5036
|
+
directory.crc32 = UNDEFINED_VALUE;
|
|
5037
|
+
}
|
|
5021
5038
|
}
|
|
5022
5039
|
|
|
5023
5040
|
function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
@@ -5036,26 +5053,22 @@
|
|
|
5036
5053
|
} catch {
|
|
5037
5054
|
// ignored
|
|
5038
5055
|
}
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
Object.assign(directory, extraFieldData);
|
|
5056
|
-
}
|
|
5057
|
-
} catch {
|
|
5058
|
-
// ignored
|
|
5056
|
+
if (tag1Data && tag1Data.length == 24) {
|
|
5057
|
+
const tag1View = getDataView(tag1Data);
|
|
5058
|
+
const rawLastModDate = tag1View.getBigUint64(0, true);
|
|
5059
|
+
const rawLastAccessDate = tag1View.getBigUint64(8, true);
|
|
5060
|
+
const rawCreationDate = tag1View.getBigUint64(16, true);
|
|
5061
|
+
Object.assign(extraFieldNTFS, {
|
|
5062
|
+
rawLastModDate,
|
|
5063
|
+
rawLastAccessDate,
|
|
5064
|
+
rawCreationDate
|
|
5065
|
+
});
|
|
5066
|
+
const lastModDate = getDateNTFS(rawLastModDate);
|
|
5067
|
+
const lastAccessDate = getDateNTFS(rawLastAccessDate);
|
|
5068
|
+
const creationDate = getDateNTFS(rawCreationDate);
|
|
5069
|
+
const extraFieldData = { lastModDate, lastAccessDate, creationDate };
|
|
5070
|
+
Object.assign(extraFieldNTFS, extraFieldData);
|
|
5071
|
+
Object.assign(directory, extraFieldData);
|
|
5059
5072
|
}
|
|
5060
5073
|
}
|
|
5061
5074
|
|
|
@@ -5358,11 +5371,7 @@
|
|
|
5358
5371
|
|
|
5359
5372
|
function getDate(timeRaw) {
|
|
5360
5373
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
|
|
5361
|
-
|
|
5362
|
-
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5363
|
-
} catch {
|
|
5364
|
-
// ignored
|
|
5365
|
-
}
|
|
5374
|
+
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
5366
5375
|
}
|
|
5367
5376
|
|
|
5368
5377
|
function getDateNTFS(timeRaw) {
|
|
@@ -5395,7 +5404,9 @@
|
|
|
5395
5404
|
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
5396
5405
|
ERR_EOCDR_NOT_FOUND: ERR_EOCDR_NOT_FOUND,
|
|
5397
5406
|
ERR_EXTRAFIELD_ZIP64_NOT_FOUND: ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
5407
|
+
ERR_INVALID_AUTHENTICATION_CODE: ERR_INVALID_AUTHENTICATION_CODE,
|
|
5398
5408
|
ERR_INVALID_COMPRESSED_DATA: ERR_INVALID_COMPRESSED_DATA,
|
|
5409
|
+
ERR_INVALID_CRC32: ERR_INVALID_CRC32,
|
|
5399
5410
|
ERR_INVALID_PASSWORD: ERR_INVALID_PASSWORD,
|
|
5400
5411
|
ERR_INVALID_SIGNATURE: ERR_INVALID_SIGNATURE,
|
|
5401
5412
|
ERR_INVALID_UNCOMPRESSED_SIZE: ERR_INVALID_UNCOMPRESSED_SIZE,
|
|
@@ -5448,6 +5459,8 @@
|
|
|
5448
5459
|
const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
|
|
5449
5460
|
const MIN_UNIX_TIME = -2147483648;
|
|
5450
5461
|
const MAX_UNIX_TIME = 2147483647;
|
|
5462
|
+
const MIN_NTFS_TIME = BigInt(0);
|
|
5463
|
+
const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
|
|
5451
5464
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
|
|
5452
5465
|
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
5453
5466
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
@@ -6279,9 +6292,12 @@
|
|
|
6279
6292
|
msdosAttributes
|
|
6280
6293
|
};
|
|
6281
6294
|
let {
|
|
6282
|
-
signature,
|
|
6295
|
+
crc32: signature,
|
|
6283
6296
|
uncompressedSize
|
|
6284
6297
|
} = options;
|
|
6298
|
+
if (signature === UNDEFINED_VALUE) {
|
|
6299
|
+
({ signature } = options);
|
|
6300
|
+
}
|
|
6285
6301
|
let compressedSize = 0;
|
|
6286
6302
|
if (!passThrough) {
|
|
6287
6303
|
uncompressedSize = 0;
|
|
@@ -6299,7 +6315,7 @@
|
|
|
6299
6315
|
encryptionStrength,
|
|
6300
6316
|
zipCrypto: encrypted && zipCrypto,
|
|
6301
6317
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
|
|
6302
|
-
|
|
6318
|
+
computeCrc32: !passThrough,
|
|
6303
6319
|
compressed: compressed && !passThrough,
|
|
6304
6320
|
encrypted: encrypted && !passThrough,
|
|
6305
6321
|
useWebWorkers,
|
|
@@ -6318,7 +6334,9 @@
|
|
|
6318
6334
|
writer.size += compressedSize;
|
|
6319
6335
|
if (!passThrough) {
|
|
6320
6336
|
uncompressedSize = result.inputSize;
|
|
6321
|
-
|
|
6337
|
+
if (!encrypted || zipCrypto) {
|
|
6338
|
+
signature = result.signature;
|
|
6339
|
+
}
|
|
6322
6340
|
}
|
|
6323
6341
|
if ((!zip64CompressedSize && compressedSize >= MAX_32_BITS) ||
|
|
6324
6342
|
(!zip64UncompressedSize && uncompressedSize >= MAX_32_BITS)) {
|
|
@@ -6357,6 +6375,7 @@
|
|
|
6357
6375
|
headerArray,
|
|
6358
6376
|
headerView,
|
|
6359
6377
|
signature,
|
|
6378
|
+
crc32: encrypted && !zipCrypto ? UNDEFINED_VALUE : signature,
|
|
6360
6379
|
extraFieldExtendedTimestampFlag,
|
|
6361
6380
|
zip64UncompressedSize,
|
|
6362
6381
|
zip64CompressedSize
|
|
@@ -6457,8 +6476,8 @@
|
|
|
6457
6476
|
extraFieldNTFS.uint16(EXTRAFIELD_TYPE_NTFS_TAG1);
|
|
6458
6477
|
extraFieldNTFS.uint16(24);
|
|
6459
6478
|
extraFieldNTFS.uint64(lastModTimeNTFS);
|
|
6460
|
-
extraFieldNTFS.uint64(getTimeNTFS(lastAccessDate)
|
|
6461
|
-
extraFieldNTFS.uint64(getTimeNTFS(creationDate)
|
|
6479
|
+
extraFieldNTFS.uint64(lastAccessDate ? getTimeNTFS(lastAccessDate) : lastModTimeNTFS);
|
|
6480
|
+
extraFieldNTFS.uint64(creationDate ? getTimeNTFS(creationDate) : lastModTimeNTFS);
|
|
6462
6481
|
rawExtraFieldNTFS = extraFieldNTFS.array;
|
|
6463
6482
|
} catch {
|
|
6464
6483
|
rawExtraFieldNTFS = EMPTY_UINT8_ARRAY;
|
|
@@ -6518,7 +6537,7 @@
|
|
|
6518
6537
|
if (extraFieldLength > MAX_16_BITS) {
|
|
6519
6538
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
6520
6539
|
}
|
|
6521
|
-
const dosLastModDate = new Date(Math.ceil(lastModDate.getTime() /
|
|
6540
|
+
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
6522
6541
|
const {
|
|
6523
6542
|
headerArray,
|
|
6524
6543
|
headerView,
|
|
@@ -7027,7 +7046,8 @@
|
|
|
7027
7046
|
|
|
7028
7047
|
function getTimeNTFS(date) {
|
|
7029
7048
|
if (date) {
|
|
7030
|
-
|
|
7049
|
+
const timeNTFS = ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
|
|
7050
|
+
return timeNTFS < MIN_NTFS_TIME ? MIN_NTFS_TIME : timeNTFS > MAX_NTFS_TIME ? MAX_NTFS_TIME : timeNTFS;
|
|
7031
7051
|
}
|
|
7032
7052
|
}
|
|
7033
7053
|
|