@zip.js/zip.js 2.8.51 → 2.8.52

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 CHANGED
@@ -174,15 +174,20 @@ Run the code on Plunker: https://plnkr.co/edit/4sVljNIpqSUE9HCA?preview
174
174
 
175
175
  ## Custom web workers and compression engines
176
176
 
177
- zip.js can create its web workers with the standard bundler pattern and
178
- delegate compression/decompression to a custom engine, e.g.
177
+ zip.js lets you create its web workers yourself by using the
178
+ `new Worker(new URL("./zip-worker.js", import.meta.url))` form. Bundlers like
179
+ Vite, webpack and Rollup detect it and bundle the worker automatically. You can
180
+ also delegate compression and decompression to a custom engine, e.g.
179
181
  [fflate](https://github.com/101arrowz/fflate):
180
182
 
181
183
  ```js
182
184
  import { configure } from "@zip.js/zip.js/lib/zip-core-custom.js";
183
185
 
184
186
  configure({
185
- createWorker: () => new Worker(new URL("./zip-worker.js", import.meta.url), { type: "module" })
187
+ createWorker: () => new Worker(
188
+ new URL("./zip-worker.js", import.meta.url),
189
+ { type: "module" }
190
+ )
186
191
  });
187
192
  ```
188
193
 
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zip-js/zip-js",
3
- "version": "2.8.51",
3
+ "version": "2.8.52",
4
4
  "exports": {
5
5
  ".": "./index.js",
6
6
  "./external": "./lib/zip-fs-external.js",
@@ -81,6 +81,8 @@ const FILE_ATTR_MSDOS_SYSTEM_MASK = 0x04;
81
81
  const FILE_ATTR_MSDOS_ARCHIVE_MASK = 0x20;
82
82
  const FILE_ATTR_UNIX_TYPE_MASK = 0o170000;
83
83
  const FILE_ATTR_UNIX_TYPE_DIR = 0o040000;
84
+ const FILE_ATTR_UNIX_TYPE_SYMLINK = 0o120000;
85
+ const FILE_ATTR_UNIX_TYPE_FILE = 0o100000;
84
86
  const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;
85
87
  const FILE_ATTR_UNIX_DEFAULT_MASK = 0o644;
86
88
  const FILE_ATTR_UNIX_SETUID_MASK = 0o4000;
@@ -1806,8 +1808,6 @@ function getInt32(number) {
1806
1808
  */
1807
1809
 
1808
1810
 
1809
- const HTTP_HEADER_CONTENT_TYPE = "Content-Type";
1810
-
1811
1811
  function toCompatibleReadable(readable) {
1812
1812
  if (readable instanceof ReadableStream) {
1813
1813
  return readable;
@@ -1830,12 +1830,9 @@ function toCompatibleReadable(readable) {
1830
1830
 
1831
1831
  function streamToBlob(readable, contentType) {
1832
1832
  readable = toCompatibleReadable(readable);
1833
+ const blobOptions = contentType ? { type: contentType } : {};
1833
1834
  if (responseSupportsGlobalReadable()) {
1834
- const options = {};
1835
- if (contentType) {
1836
- options.headers = [[HTTP_HEADER_CONTENT_TYPE, contentType]];
1837
- }
1838
- return new Response(readable, options).blob();
1835
+ return new Response(readable).blob().then(blob => contentType ? new Blob([blob], blobOptions) : blob);
1839
1836
  }
1840
1837
  const chunks = [];
1841
1838
  return readable
@@ -1844,7 +1841,7 @@ function streamToBlob(readable, contentType) {
1844
1841
  chunks.push(chunk);
1845
1842
  }
1846
1843
  }))
1847
- .then(() => new Blob(chunks, contentType ? { type: contentType } : {}));
1844
+ .then(() => new Blob(chunks, blobOptions));
1848
1845
  }
1849
1846
 
1850
1847
  function responseSupportsGlobalReadable() {
@@ -3379,8 +3376,10 @@ class Reader extends Stream {
3379
3376
  async pull(controller) {
3380
3377
  const dataSize = size === UNDEFINED_VALUE ? chunkSize : Math.min(chunkSize, size - chunkOffset);
3381
3378
  const data = await readUint8Array(reader, offset + chunkOffset, dataSize);
3382
- controller.enqueue(data);
3383
- if ((chunkOffset + chunkSize > size) || (size === UNDEFINED_VALUE && !data.length && dataSize)) {
3379
+ if (data.length) {
3380
+ controller.enqueue(data);
3381
+ }
3382
+ if ((chunkOffset + chunkSize >= size) || (size === UNDEFINED_VALUE && !data.length && dataSize)) {
3384
3383
  controller.close();
3385
3384
  } else {
3386
3385
  chunkOffset += chunkSize;
@@ -3458,6 +3457,7 @@ class Data64URIWriter extends Writer {
3458
3457
  constructor(contentType) {
3459
3458
  super();
3460
3459
  Object.assign(this, {
3460
+ contentType,
3461
3461
  data: "data:" + (contentType || "") + ";base64,",
3462
3462
  pending: []
3463
3463
  });
@@ -3559,6 +3559,7 @@ class BlobWriter extends Stream {
3559
3559
  return transformStream.writable;
3560
3560
  }
3561
3561
  });
3562
+ writer.contentType = contentType;
3562
3563
  writer.blob = streamToBlob(transformStream.readable, contentType);
3563
3564
  writer.blob.catch(() => { });
3564
3565
  }
@@ -4238,6 +4239,10 @@ class GenericWriter {
4238
4239
  }
4239
4240
  }
4240
4241
 
4242
+ function ownsWritable(writer) {
4243
+ return Boolean(writer && writer.getData);
4244
+ }
4245
+
4241
4246
  function isHttpFamily(url) {
4242
4247
  const { baseURI } = getConfiguration();
4243
4248
  const { protocol } = new URL(url, baseURI);
@@ -4382,6 +4387,8 @@ const PROPERTY_NAME_CREATION_DATE = "creationDate";
4382
4387
  const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
4383
4388
  const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
4384
4389
  const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
4390
+ const PROPERTY_NAME_DEPRECATED_INTERNAL_FILE_ATTRIBUTES = "internalFileAttribute";
4391
+ const PROPERTY_NAME_DEPRECATED_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttribute";
4385
4392
  const PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW = "msdosAttributesRaw";
4386
4393
  const PROPERTY_NAME_MSDOS_ATTRIBUTES = "msdosAttributes";
4387
4394
  const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
@@ -4392,6 +4399,7 @@ const PROPERTY_NAME_VERSION_MADE_BY = "versionMadeBy";
4392
4399
  const PROPERTY_NAME_ZIPCRYPTO = "zipCrypto";
4393
4400
  const PROPERTY_NAME_DIRECTORY = "directory";
4394
4401
  const PROPERTY_NAME_EXECUTABLE = "executable";
4402
+ const PROPERTY_NAME_SYMLINK = "symlink";
4395
4403
  const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
4396
4404
  const PROPERTY_NAME_SIGNATURE = "signature";
4397
4405
  const PROPERTY_NAME_CRC32 = "crc32";
@@ -4435,6 +4443,8 @@ const PROPERTY_NAMES = [
4435
4443
  PROPERTY_NAME_DISK_NUMBER_START,
4436
4444
  PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES,
4437
4445
  PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES,
4446
+ PROPERTY_NAME_DEPRECATED_INTERNAL_FILE_ATTRIBUTES,
4447
+ PROPERTY_NAME_DEPRECATED_EXTERNAL_FILE_ATTRIBUTES,
4438
4448
  PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW,
4439
4449
  PROPERTY_NAME_MSDOS_ATTRIBUTES,
4440
4450
  PROPERTY_NAME_MS_DOS_COMPATIBLE,
@@ -4445,6 +4455,7 @@ const PROPERTY_NAMES = [
4445
4455
  PROPERTY_NAME_ZIPCRYPTO,
4446
4456
  PROPERTY_NAME_DIRECTORY,
4447
4457
  PROPERTY_NAME_EXECUTABLE,
4458
+ PROPERTY_NAME_SYMLINK,
4448
4459
  PROPERTY_NAME_COMPRESSION_METHOD,
4449
4460
  PROPERTY_NAME_SIGNATURE,
4450
4461
  PROPERTY_NAME_CRC32,
@@ -4907,15 +4918,18 @@ class ZipReader {
4907
4918
  const setuid = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_SETUID_MASK);
4908
4919
  const setgid = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_SETGID_MASK);
4909
4920
  const sticky = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_STICKY_MASK);
4910
- const executable = (fileEntry.unixMode !== UNDEFINED_VALUE)
4921
+ const unixType = fileEntry.unixMode === UNDEFINED_VALUE ? unixExternalUpper : fileEntry.unixMode;
4922
+ const symlink = (unixType & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_SYMLINK;
4923
+ const executable = !symlink && ((fileEntry.unixMode !== UNDEFINED_VALUE)
4911
4924
  ? ((fileEntry.unixMode & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0)
4912
- : (unixCompatible && ((unixExternalUpper & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0));
4925
+ : (unixCompatible && ((unixExternalUpper & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0)));
4913
4926
  const modeIsDir = fileEntry.unixMode !== UNDEFINED_VALUE && ((fileEntry.unixMode & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_DIR);
4914
4927
  const upperIsDir = ((unixExternalUpper & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_DIR);
4915
4928
  Object.assign(fileEntry, {
4916
4929
  setuid,
4917
4930
  setgid,
4918
4931
  sticky,
4932
+ symlink,
4919
4933
  unixExternalUpper,
4920
4934
  internalFileAttribute: fileEntry.internalFileAttributes,
4921
4935
  externalFileAttribute: fileEntry.externalFileAttributes,
@@ -4981,6 +4995,10 @@ class ZipReader {
4981
4995
  }
4982
4996
 
4983
4997
  async close() {
4998
+ const { reader } = this;
4999
+ if (!reader.readUint8Array && reader.readable && !reader.readable.locked) {
5000
+ await reader.readable.cancel();
5001
+ }
4984
5002
  }
4985
5003
  }
4986
5004
 
@@ -5205,7 +5223,7 @@ class ZipEntry {
5205
5223
  throw error;
5206
5224
  }
5207
5225
  } finally {
5208
- const preventClose = getOptionValue$1(zipEntry, options, OPTION_PREVENT_CLOSE);
5226
+ const preventClose = !ownsWritable(writer) && getOptionValue$1(zipEntry, options, OPTION_PREVENT_CLOSE);
5209
5227
  if (!preventClose && writable && !writable.locked) {
5210
5228
  const writableWriter = writable.getWriter();
5211
5229
  if (abortError) {
@@ -5449,8 +5467,8 @@ function readExtraFieldUnixDates(extraField, directory) {
5449
5467
  return;
5450
5468
  }
5451
5469
  const extraFieldView = getDataView(extraField.data);
5452
- const lastAccessDate = new Date(getUint32(extraFieldView, 0) * 1000);
5453
- const lastModDate = new Date(getUint32(extraFieldView, 4) * 1000);
5470
+ const lastAccessDate = new Date((getUint32(extraFieldView, 0) | 0) * 1000);
5471
+ const lastModDate = new Date((getUint32(extraFieldView, 4) | 0) * 1000);
5454
5472
  const extraFieldData = { lastAccessDate, lastModDate };
5455
5473
  if (extraField.data.length >= 12) {
5456
5474
  extraFieldData.uid = getUint16(extraFieldView, 8);
@@ -5881,6 +5899,7 @@ const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
5881
5899
  const ERR_INVALID_VERSION = "Version exceeds 65535";
5882
5900
  const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
5883
5901
  const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
5902
+ const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
5884
5903
  const ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535";
5885
5904
  const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
5886
5905
  const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
@@ -5890,6 +5909,7 @@ const MIN_NTFS_TIME = BigInt(0);
5890
5909
  const MAX_NTFS_TIME = BigInt("0x7fffffffffffffff");
5891
5910
  const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
5892
5911
  const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
5912
+ const ERR_UNDETERMINED_SIZE = "Undetermined size";
5893
5913
  const ERR_UNDEFINED_READER = "Undefined reader";
5894
5914
  const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
5895
5915
  const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
@@ -6097,7 +6117,7 @@ class ZipWriter {
6097
6117
  await Promise.allSettled(Array.from(pendingAddFileCalls));
6098
6118
  }
6099
6119
  await closeFile(zipWriter, comment, options);
6100
- const preventClose = getOptionValue(zipWriter, options, OPTION_PREVENT_CLOSE);
6120
+ const preventClose = !ownsWritable(writer) && getOptionValue(zipWriter, options, OPTION_PREVENT_CLOSE);
6101
6121
  if (!preventClose) {
6102
6122
  await writable.getWriter().close();
6103
6123
  }
@@ -6256,7 +6276,7 @@ function resolveAttributes(zipWriter, name, options) {
6256
6276
  if (versionMadeBy > MAX_16_BITS) {
6257
6277
  throw new Error(ERR_INVALID_VERSION);
6258
6278
  }
6259
- let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES);
6279
+ let externalFileAttributes = getAliasedOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_DEPRECATED_EXTERNAL_FILE_ATTRIBUTES);
6260
6280
  const externalFileAttributesProvided = externalFileAttributes !== UNDEFINED_VALUE;
6261
6281
  if (!externalFileAttributesProvided) {
6262
6282
  externalFileAttributes = 0;
@@ -6304,7 +6324,9 @@ function resolveAttributes(zipWriter, name, options) {
6304
6324
  }
6305
6325
  if (!externalFileAttributesProvided || unixModeProvided) {
6306
6326
  if (directory) {
6307
- unixMode |= FILE_ATTR_UNIX_TYPE_DIR;
6327
+ unixMode = (unixMode & ~FILE_ATTR_UNIX_TYPE_MASK) | FILE_ATTR_UNIX_TYPE_DIR;
6328
+ } else if (!(unixMode & FILE_ATTR_UNIX_TYPE_MASK)) {
6329
+ unixMode |= FILE_ATTR_UNIX_TYPE_FILE;
6308
6330
  }
6309
6331
  externalFileAttributes = ((unixMode & MAX_16_BITS) << 16) | (externalFileAttributes & MAX_16_BITS);
6310
6332
  }
@@ -6357,15 +6379,12 @@ function resolveMetadata(zipWriter, name, options) {
6357
6379
  const lastModDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
6358
6380
  const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
6359
6381
  const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
6360
- const internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
6382
+ const internalFileAttributes = getAliasedOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_DEPRECATED_INTERNAL_FILE_ATTRIBUTES, 0);
6361
6383
  const passThrough = getOptionValue(zipWriter, options, OPTION_PASS_THROUGH);
6362
- let password, rawPassword;
6363
- if (!passThrough) {
6364
- password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
6365
- rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
6366
- if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
6367
- throw new Error(ERR_INVALID_PASSWORD_TYPE);
6368
- }
6384
+ const password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
6385
+ const rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
6386
+ if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
6387
+ throw new Error(ERR_INVALID_PASSWORD_TYPE);
6369
6388
  }
6370
6389
  const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
6371
6390
  const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
@@ -6478,14 +6497,24 @@ function serializeExtraField(extraField) {
6478
6497
  }
6479
6498
 
6480
6499
  async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, options) {
6500
+ if (metadata.passThrough && !reader && !getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY)) {
6501
+ throw new Error(ERR_UNDEFINED_READER);
6502
+ }
6503
+ let contentSize;
6504
+ if (reader) {
6505
+ reader = new GenericReader(reader);
6506
+ await initStream(reader);
6507
+ ({ size: contentSize } = reader);
6508
+ }
6509
+ return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
6510
+ }
6511
+
6512
+ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options) {
6481
6513
  const { passThrough, zipCrypto, password, rawPassword, encryptionStrength } = metadata;
6482
6514
  let { dataDescriptor, zip64, level, compressionMethod } = metadata;
6483
6515
  let maximumCompressedSize = 0;
6484
6516
  let uncompressedSize = 0;
6485
- if (passThrough) {
6486
- if (!reader) {
6487
- throw new Error(ERR_UNDEFINED_READER);
6488
- }
6517
+ if (passThrough && hasContent) {
6489
6518
  uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
6490
6519
  if (uncompressedSize === UNDEFINED_VALUE) {
6491
6520
  throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
@@ -6493,29 +6522,30 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
6493
6522
  }
6494
6523
  const zip64Enabled = zip64 === true;
6495
6524
  const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
6496
- const encryptedEntry = Boolean(reader) && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted));
6497
- if (!reader) {
6525
+ if (hasContent && passThrough && !encrypted && getLength(password, rawPassword)) {
6526
+ throw new Error(ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH);
6527
+ }
6528
+ const encryptedEntry = hasContent && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted));
6529
+ if (!hasContent) {
6498
6530
  level = 0;
6499
6531
  compressionMethod = COMPRESSION_METHOD_STORE;
6500
6532
  }
6501
6533
  const encryptionOverhead = encryptedEntry ? (zipCrypto ? 12 : 16 + encryptionStrength * 4) : 0;
6502
- if (reader) {
6503
- reader = new GenericReader(reader);
6504
- await initStream(reader);
6534
+ if (hasContent) {
6505
6535
  if (!passThrough) {
6506
- if (reader.size === UNDEFINED_VALUE) {
6536
+ if (contentSize === UNDEFINED_VALUE) {
6507
6537
  dataDescriptor = true;
6508
6538
  if (zip64 || zip64 === UNDEFINED_VALUE) {
6509
6539
  zip64 = true;
6510
6540
  uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
6511
6541
  }
6512
6542
  } else {
6513
- options.uncompressedSize = uncompressedSize = reader.size;
6514
- maximumCompressedSize = getMaximumCompressedSize(uncompressedSize) + encryptionOverhead;
6543
+ options.uncompressedSize = uncompressedSize = contentSize;
6544
+ maximumCompressedSize = (isCompressed(compressionMethod, level) ? getMaximumCompressedSize(uncompressedSize) : uncompressedSize) + encryptionOverhead;
6515
6545
  }
6516
6546
  } else {
6517
6547
  options.uncompressedSize = uncompressedSize;
6518
- maximumCompressedSize = getMaximumCompressedSize(uncompressedSize) + encryptionOverhead;
6548
+ maximumCompressedSize = contentSize === UNDEFINED_VALUE ? getMaximumCompressedSize(uncompressedSize) + encryptionOverhead : contentSize;
6519
6549
  }
6520
6550
  }
6521
6551
  const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
@@ -6529,7 +6559,7 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
6529
6559
  }
6530
6560
  zip64 = zip64 || false;
6531
6561
  return {
6532
- reader,
6562
+ maximumCompressedSize,
6533
6563
  resolvedOptions: {
6534
6564
  dataDescriptor,
6535
6565
  zip64,
@@ -6914,9 +6944,7 @@ function getHeaderInfo(options) {
6914
6944
  crc32
6915
6945
  } = options;
6916
6946
  let { version, compressionMethod } = options;
6917
- const compressed = !directory && (compressionMethod === UNDEFINED_VALUE
6918
- ? (level === UNDEFINED_VALUE || level > 0)
6919
- : compressionMethod !== COMPRESSION_METHOD_STORE);
6947
+ const compressed = !directory && isCompressed(compressionMethod, level);
6920
6948
  let rawLocalExtraFieldZip64;
6921
6949
  const uncompressedFile = passThrough || !compressed;
6922
6950
  const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
@@ -7603,6 +7631,16 @@ function getOptionValue(zipWriter, options, name, defaultValue) {
7603
7631
  return result === UNDEFINED_VALUE ? defaultValue : result;
7604
7632
  }
7605
7633
 
7634
+ function getAliasedOptionValue(zipWriter, options, name, deprecatedName, defaultValue) {
7635
+ const value = getAliasedValue(options, name, deprecatedName);
7636
+ const result = value === UNDEFINED_VALUE ? getAliasedValue(zipWriter.options, name, deprecatedName) : value;
7637
+ return result === UNDEFINED_VALUE ? defaultValue : result;
7638
+ }
7639
+
7640
+ function getAliasedValue(options, name, deprecatedName) {
7641
+ return options[name] === UNDEFINED_VALUE ? options[deprecatedName] : options[name];
7642
+ }
7643
+
7606
7644
  function getNumberOptionValue(zipWriter, options, name, defaultValue) {
7607
7645
  return toNumber(getOptionValue(zipWriter, options, name, defaultValue));
7608
7646
  }
@@ -7615,6 +7653,12 @@ function getMaximumCompressedSize(uncompressedSize) {
7615
7653
  return uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1));
7616
7654
  }
7617
7655
 
7656
+ function isCompressed(compressionMethod, level) {
7657
+ return compressionMethod === UNDEFINED_VALUE
7658
+ ? (level === UNDEFINED_VALUE || level > 0)
7659
+ : compressionMethod !== COMPRESSION_METHOD_STORE;
7660
+ }
7661
+
7618
7662
  function setUint8(view, offset, value) {
7619
7663
  view.setUint8(offset, value);
7620
7664
  }
@@ -8569,4 +8613,4 @@ function terminateWorkersAndModule() {
8569
8613
 
8570
8614
  configureExternalAssets();
8571
8615
 
8572
- 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_FILENAME_VALIDATION, ERR_INVALID_GID, ERR_INVALID_LEVEL, ERR_INVALID_MAX_APPENDED_DATA_SIZE, ERR_INVALID_MSDOS_ATTRIBUTES, ERR_INVALID_MSDOS_DATA, ERR_INVALID_PASSWORD, ERR_INVALID_PASSWORD_TYPE, ERR_INVALID_SIGNATURE, ERR_INVALID_SIGNATURE_DATA, ERR_INVALID_STRICTNESS, ERR_INVALID_UID, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_UNIX_EXTRA_FIELD_TYPE, ERR_INVALID_UNIX_ID_SIZE, ERR_INVALID_UNIX_MODE, 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_UNSAFE_FILENAME, ERR_UNSUPPORTED_COMPRESSION$1 as ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_CONTEXT, ERR_UNSUPPORTED_CRYPTO_API, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_WORKER_STARTUP_TIMEOUT, 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, getMimeType, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };
8616
+ 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_FILENAME_VALIDATION, ERR_INVALID_GID, ERR_INVALID_LEVEL, ERR_INVALID_MAX_APPENDED_DATA_SIZE, ERR_INVALID_MSDOS_ATTRIBUTES, ERR_INVALID_MSDOS_DATA, ERR_INVALID_PASSWORD, ERR_INVALID_PASSWORD_TYPE, ERR_INVALID_SIGNATURE, ERR_INVALID_SIGNATURE_DATA, ERR_INVALID_STRICTNESS, ERR_INVALID_UID, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_UNIX_EXTRA_FIELD_TYPE, ERR_INVALID_UNIX_ID_SIZE, ERR_INVALID_UNIX_MODE, 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_UNDETERMINED_SIZE, ERR_UNSAFE_FILENAME, ERR_UNSUPPORTED_COMPRESSION$1 as ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_CONTEXT, ERR_UNSUPPORTED_CRYPTO_API, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_WORKER_STARTUP_TIMEOUT, 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, getMimeType, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };