@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.
Files changed (45) hide show
  1. package/README.md +0 -37
  2. package/deno.json +1 -1
  3. package/dist/zip-core-external.js +67 -47
  4. package/dist/zip-core-external.min.js +1 -1
  5. package/dist/zip-core.js +68 -46
  6. package/dist/zip-core.min.js +1 -1
  7. package/dist/zip-fs-core-external.js +67 -47
  8. package/dist/zip-fs-core-external.min.js +1 -1
  9. package/dist/zip-fs-core.js +66 -46
  10. package/dist/zip-fs-core.min.js +1 -1
  11. package/dist/zip-fs-external.js +67 -47
  12. package/dist/zip-fs-external.min.js +1 -1
  13. package/dist/zip-fs-native.js +70 -48
  14. package/dist/zip-fs-native.min.js +1 -1
  15. package/dist/zip-fs.js +69 -47
  16. package/dist/zip-fs.min.js +1 -1
  17. package/dist/zip-legacy.js +70 -48
  18. package/dist/zip-legacy.min.js +1 -1
  19. package/dist/zip-native.js +70 -48
  20. package/dist/zip-native.min.js +1 -1
  21. package/dist/zip-web-worker-native.js +1 -1
  22. package/dist/zip-web-worker.js +1 -1
  23. package/dist/zip.js +69 -47
  24. package/dist/zip.min.js +1 -1
  25. package/index-native.cjs +70 -48
  26. package/index-native.min.js +1 -1
  27. package/index.cjs +69 -47
  28. package/index.d.cts +80 -7
  29. package/index.d.ts +80 -7
  30. package/index.min.js +1 -1
  31. package/lib/core/codec-pool.js +6 -2
  32. package/lib/core/options.js +4 -0
  33. package/lib/core/streams/aes-crypto-stream.js +4 -4
  34. package/lib/core/streams/codec-stream.js +4 -0
  35. package/lib/core/streams/common-crypto.js +2 -0
  36. package/lib/core/streams/zip-entry-stream.js +12 -8
  37. package/lib/core/web-worker-inline-native.js +1 -1
  38. package/lib/core/web-worker-inline-wasm.js +1 -1
  39. package/lib/core/web-worker-wasm.js +4 -8
  40. package/lib/core/zip-entry.js +3 -0
  41. package/lib/core/zip-reader.js +35 -26
  42. package/lib/core/zip-writer.js +16 -7
  43. package/lib/zip-core-reader.js +2 -0
  44. package/package.json +1 -1
  45. package/worker-message-property-names.js +1 -1
@@ -1396,6 +1396,7 @@ const GET_RANDOM_VALUES_SUPPORTED = typeof crypto != UNDEFINED_TYPE && typeof cr
1396
1396
 
1397
1397
  const ERR_INVALID_PASSWORD = "Invalid password";
1398
1398
  const ERR_INVALID_SIGNATURE = "Invalid signature";
1399
+ const ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_SIGNATURE;
1399
1400
  const ERR_ABORT_CHECK_PASSWORD = "zipjs-abort-check-password";
1400
1401
  const ERR_UNSUPPORTED_CRYPTO_API = "Crypto API not supported";
1401
1402
 
@@ -1462,7 +1463,7 @@ let DERIVE_BITS_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && type
1462
1463
 
1463
1464
  class AESDecryptionStream extends TransformStream {
1464
1465
 
1465
- constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly }) {
1466
+ constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
1466
1467
  super({
1467
1468
  start() {
1468
1469
  initAesCrypto(this, password, rawPassword, encryptionStrength);
@@ -1512,8 +1513,8 @@ class AESDecryptionStream extends TransformStream {
1512
1513
  for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
1513
1514
  invalidSignature |= signature[indexSignature] ^ originalSignature[indexSignature];
1514
1515
  }
1515
- if (invalidSignature) {
1516
- throw new Error(ERR_INVALID_SIGNATURE);
1516
+ if (invalidSignature && checkAuthenticationCode) {
1517
+ throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
1517
1518
  }
1518
1519
  controller.enqueue(decryptedChunkArray);
1519
1520
  }
@@ -1951,6 +1952,7 @@ function toCompatibleWritable(writable) {
1951
1952
 
1952
1953
  const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
1953
1954
  const ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
1955
+ const ERR_INVALID_CRC32 = ERR_INVALID_SIGNATURE;
1954
1956
  const ERR_UNSUPPORTED_COMPRESSION$2 = "Compression method not supported";
1955
1957
  const FORMAT_DEFLATE_RAW = "deflate-raw";
1956
1958
  const FORMAT_DEFLATE64_RAW = "deflate64-raw";
@@ -1964,14 +1966,14 @@ class DeflateStream extends TransformStream {
1964
1966
 
1965
1967
  constructor(options, { chunkSize, CompressionStreamZlib, CompressionStream }) {
1966
1968
  super({});
1967
- const { compressed, encrypted, useCompressionStream, zipCrypto, signed, level, deflate64, format, compressionMethod } = options;
1969
+ const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
1968
1970
  const stream = this;
1969
1971
  let crc32Stream, encryptionStream, gzipCrc32Stream;
1970
1972
  let readable = super.readable;
1971
1973
  const codecStreams = format && getCodecStreams(format);
1972
- const useGzipCrc32 = signed && compressed && !deflate64 && !codecStreams && (!encrypted || zipCrypto) &&
1974
+ const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams && (!encrypted || zipCrypto) &&
1973
1975
  Boolean(useCompressionStream && CompressionStream);
1974
- if ((!encrypted || zipCrypto) && signed && !useGzipCrc32) {
1976
+ if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
1975
1977
  crc32Stream = new Crc32Stream();
1976
1978
  readable = pipeThrough(readable, crc32Stream);
1977
1979
  }
@@ -2010,7 +2012,7 @@ class DeflateStream extends TransformStream {
2010
2012
  if (encrypted && !zipCrypto) {
2011
2013
  signature = encryptionStream.signature;
2012
2014
  }
2013
- if ((!encrypted || zipCrypto) && signed) {
2015
+ if ((!encrypted || zipCrypto) && computeCrc32) {
2014
2016
  signature = useGzipCrc32 ? gzipCrc32Stream.signature : new DataView(crc32Stream.value.buffer).getUint32(0);
2015
2017
  }
2016
2018
  stream.signature = signature;
@@ -2133,7 +2135,7 @@ class InflateStream extends TransformStream {
2133
2135
 
2134
2136
  constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
2135
2137
  super({});
2136
- const { zipCrypto, encrypted, signed, signature, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
2138
+ const { zipCrypto, encrypted, checkCrc32, signature, compressed, useCompressionStream, deflate64, format, compressionMethod, rawBitFlag, outputSize } = options;
2137
2139
  let crc32Stream, decryptionStream;
2138
2140
  let readable = super.readable;
2139
2141
  if (encrypted) {
@@ -2166,15 +2168,15 @@ class InflateStream extends TransformStream {
2166
2168
  }
2167
2169
  readable = mapInflateStreamError(readable);
2168
2170
  }
2169
- if ((!encrypted || zipCrypto) && signed) {
2171
+ if (checkCrc32) {
2170
2172
  crc32Stream = new Crc32Stream();
2171
2173
  readable = pipeThrough(readable, crc32Stream);
2172
2174
  }
2173
2175
  setReadable(this, readable, () => {
2174
- if ((!encrypted || zipCrypto) && signed) {
2176
+ if (checkCrc32) {
2175
2177
  const dataViewSignature = new DataView(crc32Stream.value.buffer);
2176
2178
  if (signature != dataViewSignature.getUint32(0, false)) {
2177
- throw new Error(ERR_INVALID_SIGNATURE);
2179
+ throw new Error(ERR_INVALID_CRC32);
2178
2180
  }
2179
2181
  }
2180
2182
  });
@@ -3069,7 +3071,7 @@ let indexWorker = 0;
3069
3071
 
3070
3072
  async function runWorker(stream, workerOptions) {
3071
3073
  const { options, config } = workerOptions;
3072
- const { transferStreams, useWebWorkers, useCompressionStream, compressed, signed, encrypted, format, codecURI } = options;
3074
+ const { transferStreams, useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
3073
3075
  const { workerURI, maxWorkers } = config;
3074
3076
  if (format) {
3075
3077
  if (codecURI) {
@@ -3078,7 +3080,7 @@ async function runWorker(stream, workerOptions) {
3078
3080
  await ensureCodecStreams(format, options.codecURI);
3079
3081
  }
3080
3082
  workerOptions.transferStreams = transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams);
3081
- const streamCopy = !compressed && !signed && !encrypted;
3083
+ const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
3082
3084
  const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
3083
3085
  workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
3084
3086
  workerOptions.workerURI = workerOptions.useWebWorkers && workerURI ? workerURI : UNDEFINED_VALUE;
@@ -4302,6 +4304,7 @@ const PROPERTY_NAME_DIRECTORY = "directory";
4302
4304
  const PROPERTY_NAME_EXECUTABLE = "executable";
4303
4305
  const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
4304
4306
  const PROPERTY_NAME_SIGNATURE = "signature";
4307
+ const PROPERTY_NAME_CRC32 = "crc32";
4305
4308
  const PROPERTY_NAME_EXTRA_FIELD = "extraField";
4306
4309
  const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
4307
4310
  const PROPERTY_NAME_EXTRA_FIELD_UNIX = "extraFieldUnix";
@@ -4350,6 +4353,7 @@ const PROPERTY_NAMES = [
4350
4353
  PROPERTY_NAME_EXECUTABLE,
4351
4354
  PROPERTY_NAME_COMPRESSION_METHOD,
4352
4355
  PROPERTY_NAME_SIGNATURE,
4356
+ PROPERTY_NAME_CRC32,
4353
4357
  PROPERTY_NAME_EXTRA_FIELD,
4354
4358
  PROPERTY_NAME_EXTRA_FIELD_UNIX,
4355
4359
  PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
@@ -4421,6 +4425,8 @@ const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
4421
4425
  const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
4422
4426
  const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
4423
4427
  const OPTION_CHECK_SIGNATURE = "checkSignature";
4428
+ const OPTION_CHECK_CRC32 = "checkCrc32";
4429
+ const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
4424
4430
  const OPTION_USE_WEB_WORKERS = "useWebWorkers";
4425
4431
  const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
4426
4432
  const OPTION_TRANSFER_STREAMS = "transferStreams";
@@ -4492,6 +4498,7 @@ const CHARSET_UTF8 = "utf-8";
4492
4498
  const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
4493
4499
  const CHARSET_CP437 = "cp437";
4494
4500
  const BITFLAG_AMBIGUITY_MASK = BITFLAG_ENCRYPTED | BITFLAG_DATA_DESCRIPTOR | BITFLAG_LANG_ENCODING_FLAG;
4501
+ const VENDOR_VERSION_AE_1 = 1;
4495
4502
  const ZIP64_PROPERTIES = [
4496
4503
  [PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
4497
4504
  [PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
@@ -4971,6 +4978,11 @@ let ZipEntry$1 = class ZipEntry {
4971
4978
  if (deflate64) {
4972
4979
  useCompressionStream = false;
4973
4980
  }
4981
+ const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
4982
+ const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
4983
+ getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
4984
+ checkCrc32Option) && !passThrough &&
4985
+ (!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1));
4974
4986
  const workerOptions = {
4975
4987
  options: {
4976
4988
  codecType: CODEC_INFLATE,
@@ -4978,7 +4990,8 @@ let ZipEntry$1 = class ZipEntry {
4978
4990
  rawPassword,
4979
4991
  zipCrypto,
4980
4992
  encryptionStrength: extraFieldAES && extraFieldAES.strength,
4981
- signed: getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
4993
+ checkCrc32,
4994
+ checkAuthenticationCode: getOptionValue$1(zipEntry, options, OPTION_CHECK_AUTHENTICATION_CODE),
4982
4995
  passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((signature >>> 24) & MAX_8_BITS)),
4983
4996
  outputSize: passThrough ? compressedSize : uncompressedSize,
4984
4997
  signature,
@@ -5094,6 +5107,7 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
5094
5107
  const compressionMethod = getUint16(dataView, offset + 4);
5095
5108
  Object.assign(directory, {
5096
5109
  signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
5110
+ crc32: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
5097
5111
  compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
5098
5112
  uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
5099
5113
  });
@@ -5195,6 +5209,9 @@ function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
5195
5209
  compressionMethod: getUint16(extraFieldView, 5)
5196
5210
  });
5197
5211
  directory.compressionMethod = extraFieldAES.compressionMethod;
5212
+ if (extraFieldAES.vendorVersion != VENDOR_VERSION_AE_1) {
5213
+ directory.crc32 = UNDEFINED_VALUE;
5214
+ }
5198
5215
  }
5199
5216
 
5200
5217
  function readExtraFieldNTFS(extraFieldNTFS, directory) {
@@ -5213,26 +5230,22 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
5213
5230
  } catch {
5214
5231
  // ignored
5215
5232
  }
5216
- try {
5217
- if (tag1Data && tag1Data.length == 24) {
5218
- const tag1View = getDataView(tag1Data);
5219
- const rawLastModDate = tag1View.getBigUint64(0, true);
5220
- const rawLastAccessDate = tag1View.getBigUint64(8, true);
5221
- const rawCreationDate = tag1View.getBigUint64(16, true);
5222
- Object.assign(extraFieldNTFS, {
5223
- rawLastModDate,
5224
- rawLastAccessDate,
5225
- rawCreationDate
5226
- });
5227
- const lastModDate = getDateNTFS(rawLastModDate);
5228
- const lastAccessDate = getDateNTFS(rawLastAccessDate);
5229
- const creationDate = getDateNTFS(rawCreationDate);
5230
- const extraFieldData = { lastModDate, lastAccessDate, creationDate };
5231
- Object.assign(extraFieldNTFS, extraFieldData);
5232
- Object.assign(directory, extraFieldData);
5233
- }
5234
- } catch {
5235
- // ignored
5233
+ if (tag1Data && tag1Data.length == 24) {
5234
+ const tag1View = getDataView(tag1Data);
5235
+ const rawLastModDate = tag1View.getBigUint64(0, true);
5236
+ const rawLastAccessDate = tag1View.getBigUint64(8, true);
5237
+ const rawCreationDate = tag1View.getBigUint64(16, true);
5238
+ Object.assign(extraFieldNTFS, {
5239
+ rawLastModDate,
5240
+ rawLastAccessDate,
5241
+ rawCreationDate
5242
+ });
5243
+ const lastModDate = getDateNTFS(rawLastModDate);
5244
+ const lastAccessDate = getDateNTFS(rawLastAccessDate);
5245
+ const creationDate = getDateNTFS(rawCreationDate);
5246
+ const extraFieldData = { lastModDate, lastAccessDate, creationDate };
5247
+ Object.assign(extraFieldNTFS, extraFieldData);
5248
+ Object.assign(directory, extraFieldData);
5236
5249
  }
5237
5250
  }
5238
5251
 
@@ -5535,11 +5548,7 @@ function getOptionValue$1(zipReader, options, name) {
5535
5548
 
5536
5549
  function getDate(timeRaw) {
5537
5550
  const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
5538
- try {
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
- }
5551
+ return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
5543
5552
  }
5544
5553
 
5545
5554
  function getDateNTFS(timeRaw) {
@@ -5572,7 +5581,9 @@ var zipReader = /*#__PURE__*/Object.freeze({
5572
5581
  ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
5573
5582
  ERR_EOCDR_NOT_FOUND: ERR_EOCDR_NOT_FOUND,
5574
5583
  ERR_EXTRAFIELD_ZIP64_NOT_FOUND: ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
5584
+ ERR_INVALID_AUTHENTICATION_CODE: ERR_INVALID_AUTHENTICATION_CODE,
5575
5585
  ERR_INVALID_COMPRESSED_DATA: ERR_INVALID_COMPRESSED_DATA,
5586
+ ERR_INVALID_CRC32: ERR_INVALID_CRC32,
5576
5587
  ERR_INVALID_PASSWORD: ERR_INVALID_PASSWORD,
5577
5588
  ERR_INVALID_SIGNATURE: ERR_INVALID_SIGNATURE,
5578
5589
  ERR_INVALID_UNCOMPRESSED_SIZE: ERR_INVALID_UNCOMPRESSED_SIZE,
@@ -5626,6 +5637,8 @@ const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
5626
5637
  const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
5627
5638
  const MIN_UNIX_TIME = -2147483648;
5628
5639
  const MAX_UNIX_TIME = 2147483647;
5640
+ const MIN_NTFS_TIME = BigInt(0);
5641
+ const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
5629
5642
  const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
5630
5643
  const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
5631
5644
  const ERR_UNDEFINED_READER = "Undefined reader";
@@ -6519,9 +6532,12 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
6519
6532
  msdosAttributes
6520
6533
  };
6521
6534
  let {
6522
- signature,
6535
+ crc32: signature,
6523
6536
  uncompressedSize
6524
6537
  } = options;
6538
+ if (signature === UNDEFINED_VALUE) {
6539
+ ({ signature } = options);
6540
+ }
6525
6541
  let compressedSize = 0;
6526
6542
  if (!passThrough) {
6527
6543
  uncompressedSize = 0;
@@ -6539,7 +6555,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
6539
6555
  encryptionStrength,
6540
6556
  zipCrypto: encrypted && zipCrypto,
6541
6557
  passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
6542
- signed: !passThrough,
6558
+ computeCrc32: !passThrough,
6543
6559
  compressed: compressed && !passThrough,
6544
6560
  encrypted: encrypted && !passThrough,
6545
6561
  useWebWorkers,
@@ -6558,7 +6574,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
6558
6574
  writer.size += compressedSize;
6559
6575
  if (!passThrough) {
6560
6576
  uncompressedSize = result.inputSize;
6561
- signature = result.signature;
6577
+ if (!encrypted || zipCrypto) {
6578
+ signature = result.signature;
6579
+ }
6562
6580
  }
6563
6581
  if ((!zip64CompressedSize && compressedSize >= MAX_32_BITS) ||
6564
6582
  (!zip64UncompressedSize && uncompressedSize >= MAX_32_BITS)) {
@@ -6597,6 +6615,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
6597
6615
  headerArray,
6598
6616
  headerView,
6599
6617
  signature,
6618
+ crc32: encrypted && !zipCrypto ? UNDEFINED_VALUE : signature,
6600
6619
  extraFieldExtendedTimestampFlag,
6601
6620
  zip64UncompressedSize,
6602
6621
  zip64CompressedSize
@@ -6697,8 +6716,8 @@ function getHeaderInfo(options) {
6697
6716
  extraFieldNTFS.uint16(EXTRAFIELD_TYPE_NTFS_TAG1);
6698
6717
  extraFieldNTFS.uint16(24);
6699
6718
  extraFieldNTFS.uint64(lastModTimeNTFS);
6700
- extraFieldNTFS.uint64(getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
6701
- extraFieldNTFS.uint64(getTimeNTFS(creationDate) || lastModTimeNTFS);
6719
+ extraFieldNTFS.uint64(lastAccessDate ? getTimeNTFS(lastAccessDate) : lastModTimeNTFS);
6720
+ extraFieldNTFS.uint64(creationDate ? getTimeNTFS(creationDate) : lastModTimeNTFS);
6702
6721
  rawExtraFieldNTFS = extraFieldNTFS.array;
6703
6722
  } catch {
6704
6723
  rawExtraFieldNTFS = EMPTY_UINT8_ARRAY;
@@ -6758,7 +6777,7 @@ function getHeaderInfo(options) {
6758
6777
  if (extraFieldLength > MAX_16_BITS) {
6759
6778
  throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
6760
6779
  }
6761
- const dosLastModDate = new Date(Math.ceil(lastModDate.getTime() / 2000) * 2000);
6780
+ const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
6762
6781
  const {
6763
6782
  headerArray,
6764
6783
  headerView,
@@ -7267,7 +7286,8 @@ async function flushBufferedData(readable, writer, signal, onChunkWritten) {
7267
7286
 
7268
7287
  function getTimeNTFS(date) {
7269
7288
  if (date) {
7270
- return ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
7289
+ const timeNTFS = ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
7290
+ return timeNTFS < MIN_NTFS_TIME ? MIN_NTFS_TIME : timeNTFS > MAX_NTFS_TIME ? MAX_NTFS_TIME : timeNTFS;
7271
7291
  }
7272
7292
  }
7273
7293
 
@@ -10911,4 +10931,4 @@ function getMimeTypes() {
10911
10931
  return mimeTypes;
10912
10932
  }
10913
10933
 
10914
- 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 };
10934
+ 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 };