@zip.js/zip.js 2.7.54 → 2.7.56

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.
@@ -104,7 +104,8 @@ function terminateWorker(workerData, workerOptions) {
104
104
  pool = pool.filter(data => data != workerData);
105
105
  try {
106
106
  await workerData.terminate();
107
- } catch (_error) {
107
+ // eslint-disable-next-line no-unused-vars
108
+ } catch (_) {
108
109
  // ignored
109
110
  }
110
111
  }, terminateWorkerTimeout);
@@ -125,7 +125,8 @@ class ProgressWatcherStream extends TransformStream {
125
125
  async function callHandler(handler, ...parameters) {
126
126
  try {
127
127
  await handler(...parameters);
128
- } catch (_error) {
128
+ // eslint-disable-next-line no-unused-vars
129
+ } catch (_) {
129
130
  // ignored
130
131
  }
131
132
  }
@@ -142,7 +143,8 @@ function createWebWorkerInterface(workerData, config) {
142
143
  let worker;
143
144
  try {
144
145
  worker = getWebWorker(workerData.scripts[0], baseURL, workerData);
145
- } catch (_error) {
146
+ // eslint-disable-next-line no-unused-vars
147
+ } catch (_) {
146
148
  WEB_WORKERS_SUPPORTED = false;
147
149
  return createWorkerInterface(workerData, config);
148
150
  }
@@ -245,13 +247,15 @@ function getWebWorker(url, baseURL, workerData) {
245
247
  }
246
248
  try {
247
249
  scriptUrl = new URL(url, baseURL);
248
- } catch (_error) {
250
+ // eslint-disable-next-line no-unused-vars
251
+ } catch (_) {
249
252
  scriptUrl = url;
250
253
  }
251
254
  if (classicWorkersSupported) {
252
255
  try {
253
256
  worker = new Worker(scriptUrl);
254
- } catch (_error) {
257
+ // eslint-disable-next-line no-unused-vars
258
+ } catch (_) {
255
259
  classicWorkersSupported = false;
256
260
  worker = new Worker(scriptUrl, workerOptions);
257
261
  }
@@ -289,7 +293,8 @@ function sendMessage(message, { worker, writer, onTaskFinished, transferStreams
289
293
  try {
290
294
  worker.postMessage(message, transferables);
291
295
  return true;
292
- } catch (_error) {
296
+ // eslint-disable-next-line no-unused-vars
297
+ } catch (_) {
293
298
  transferStreamsSupported = false;
294
299
  message.readable = message.writable = null;
295
300
  worker.postMessage(message);
@@ -40,7 +40,8 @@ try {
40
40
  if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
41
41
  maxWorkers = navigator.hardwareConcurrency;
42
42
  }
43
- } catch (_error) {
43
+ // eslint-disable-next-line no-unused-vars
44
+ } catch (_) {
44
45
  // ignored
45
46
  }
46
47
  const DEFAULT_CONFIGURATION = {
@@ -58,6 +58,8 @@ const BITFLAG_LEVEL = 0x06;
58
58
  const BITFLAG_DATA_DESCRIPTOR = 0x0008;
59
59
  const BITFLAG_LANG_ENCODING_FLAG = 0x0800;
60
60
  const FILE_ATTR_MSDOS_DIR_MASK = 0x10;
61
+ const FILE_ATTR_UNIX_DIR_MASK = 0x4000;
62
+ const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;
61
63
 
62
64
  const VERSION_DEFLATE = 0x14;
63
65
  const VERSION_ZIP64 = 0x2D;
@@ -102,6 +104,8 @@ export {
102
104
  BITFLAG_DATA_DESCRIPTOR,
103
105
  BITFLAG_LANG_ENCODING_FLAG,
104
106
  FILE_ATTR_MSDOS_DIR_MASK,
107
+ FILE_ATTR_UNIX_DIR_MASK,
108
+ FILE_ATTR_UNIX_EXECUTABLE_MASK,
105
109
  VERSION_DEFLATE,
106
110
  VERSION_ZIP64,
107
111
  VERSION_AES,
@@ -265,7 +265,8 @@ async function importKey(format, password, algorithm, extractable, keyUsages) {
265
265
  if (IMPORT_KEY_SUPPORTED) {
266
266
  try {
267
267
  return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
268
- } catch (_error) {
268
+ // eslint-disable-next-line no-unused-vars
269
+ } catch (_) {
269
270
  IMPORT_KEY_SUPPORTED = false;
270
271
  return misc.importKey(password);
271
272
  }
@@ -278,7 +279,8 @@ async function deriveBits(algorithm, baseKey, length) {
278
279
  if (DERIVE_BITS_SUPPORTED) {
279
280
  try {
280
281
  return await subtle.deriveBits(algorithm, baseKey, length);
281
- } catch (_error) {
282
+ // eslint-disable-next-line no-unused-vars
283
+ } catch (_) {
282
284
  DERIVE_BITS_SUPPORTED = false;
283
285
  return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
284
286
  }
@@ -1237,7 +1237,6 @@ function Deflate() {
1237
1237
  }
1238
1238
 
1239
1239
  // Copy as much as possible from input to output:
1240
- // eslint-disable-next-line no-constant-condition
1241
1240
  while (true) {
1242
1241
  // Fill the win as much as possible:
1243
1242
  if (lookahead <= 1) {
@@ -1332,7 +1331,6 @@ function Deflate() {
1332
1331
 
1333
1332
  // We check for insufficient lookahead only every 8th comparison;
1334
1333
  // the 256th check will be made at strstart+258.
1335
- // eslint-disable-next-line no-empty
1336
1334
  do {
1337
1335
  // empty block
1338
1336
  } while (win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match]
@@ -1368,7 +1366,6 @@ function Deflate() {
1368
1366
  let hash_head = 0; // head of the hash chain
1369
1367
  let bflush; // set if current block must be flushed
1370
1368
 
1371
- // eslint-disable-next-line no-constant-condition
1372
1369
  while (true) {
1373
1370
  // Make sure that we always have enough lookahead, except
1374
1371
  // at the end of the input file. We need MAX_MATCH bytes
@@ -1475,7 +1472,6 @@ function Deflate() {
1475
1472
  let max_insert;
1476
1473
 
1477
1474
  // Process the input block.
1478
- // eslint-disable-next-line no-constant-condition
1479
1475
  while (true) {
1480
1476
  // Make sure that we always have enough lookahead, except
1481
1477
  // at the end of the input file. We need MAX_MATCH bytes
@@ -766,7 +766,6 @@ function InfCodes() {
766
766
  m = q < s.read ? s.read - q - 1 : s.end - q;
767
767
 
768
768
  // process input and output based on current state
769
- // eslint-disable-next-line no-constant-condition
770
769
  while (true) {
771
770
  switch (mode) {
772
771
  // waiting for "i:"=input, "o:"=output, "x:"=nothing
@@ -1257,7 +1256,6 @@ function InfBlocks(z, w) {
1257
1256
 
1258
1257
  // process input based on current state
1259
1258
  // DEBUG dtree
1260
- // eslint-disable-next-line no-constant-condition
1261
1259
  while (true) {
1262
1260
  let bl, bd, tl, td, bl_, bd_, tl_, td_;
1263
1261
  switch (mode) {
@@ -1534,7 +1532,6 @@ function InfBlocks(z, w) {
1534
1532
  mode = DTREE;
1535
1533
  /* falls through */
1536
1534
  case DTREE:
1537
- // eslint-disable-next-line no-constant-condition
1538
1535
  while (true) {
1539
1536
  t = table;
1540
1537
  if (index >= 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) {
@@ -1842,7 +1839,6 @@ function Inflate() {
1842
1839
  const istate = z.istate;
1843
1840
  f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
1844
1841
  r = Z_BUF_ERROR;
1845
- // eslint-disable-next-line no-constant-condition
1846
1842
  while (true) {
1847
1843
  switch (istate.mode) {
1848
1844
  case METHOD:
@@ -146,11 +146,13 @@ function pipeThroughCommpressionStream(readable, useCompressionStream, options,
146
146
  try {
147
147
  const CompressionStream = useCompressionStream && CodecStreamNative ? CodecStreamNative : CodecStream;
148
148
  readable = pipeThrough(readable, new CompressionStream(COMPRESSION_FORMAT, options));
149
- } catch (_error) {
149
+ // eslint-disable-next-line no-unused-vars
150
+ } catch (_) {
150
151
  if (useCompressionStream) {
151
152
  try {
152
153
  readable = pipeThrough(readable, new CodecStream(COMPRESSION_FORMAT, options));
153
- } catch (_error) {
154
+ // eslint-disable-next-line no-unused-vars
155
+ } catch (_) {
154
156
  return readable;
155
157
  }
156
158
  } else {
@@ -80,7 +80,8 @@ async function init(message) {
80
80
  } else {
81
81
  await imporModuleScripts(scripts);
82
82
  }
83
- } catch (_error) {
83
+ // eslint-disable-next-line no-unused-vars
84
+ } catch (_) {
84
85
  importScriptSupported = false;
85
86
  await imporModuleScripts(scripts);
86
87
  }
@@ -159,7 +160,8 @@ function sendMessage(message) {
159
160
  value = new Uint8Array(value);
160
161
  message.value = value.buffer;
161
162
  postMessage(message, [message.value]);
162
- } catch (_error) {
163
+ // eslint-disable-next-line no-unused-vars
164
+ } catch (_) {
163
165
  postMessage(message);
164
166
  }
165
167
  } else {
@@ -41,7 +41,9 @@ const PROPERTY_NAME_RAW_LAST_ACCESS_DATE = "rawLastAccessDate";
41
41
  const PROPERTY_NAME_CREATION_DATE = "creationDate";
42
42
  const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
43
43
  const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE = "internalFileAttribute";
44
+ const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
44
45
  const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE = "externalFileAttribute";
46
+ const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
45
47
  const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
46
48
  const PROPERTY_NAME_ZIP64 = "zip64";
47
49
  const PROPERTY_NAME_ENCRYPTED = "encrypted";
@@ -53,10 +55,7 @@ const PROPERTY_NAMES = [
53
55
  PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, PROPERTY_NAME_COMPPRESSED_SIZE, PROPERTY_NAME_UNCOMPPRESSED_SIZE,
54
56
  PROPERTY_NAME_LAST_MODIFICATION_DATE, PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT,
55
57
  PROPERTY_NAME_LAST_ACCESS_DATE, PROPERTY_NAME_CREATION_DATE, PROPERTY_NAME_OFFSET, PROPERTY_NAME_DISK_NUMBER_START,
56
- PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
57
- PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY,
58
- PROPERTY_NAME_ZIPCRYPTO, "directory", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField",
59
- "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
58
+ PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY, PROPERTY_NAME_ZIPCRYPTO, "directory", "executable", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField", "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
60
59
 
61
60
  class Entry {
62
61
 
@@ -82,7 +81,9 @@ export {
82
81
  PROPERTY_NAME_CREATION_DATE,
83
82
  PROPERTY_NAME_RAW_CREATION_DATE,
84
83
  PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE,
84
+ PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES,
85
85
  PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
86
+ PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES,
86
87
  PROPERTY_NAME_MS_DOS_COMPATIBLE,
87
88
  PROPERTY_NAME_ZIP64,
88
89
  PROPERTY_NAME_ENCRYPTED,
@@ -425,7 +425,8 @@ class ZipDirectoryEntry extends ZipEntry {
425
425
  error.cause = {
426
426
  entry
427
427
  };
428
- } catch (_error) {
428
+ // eslint-disable-next-line no-unused-vars
429
+ } catch (_) {
429
430
  // ignored
430
431
  }
431
432
  throw error;
@@ -683,7 +684,8 @@ async function initReaders(entry, options) {
683
684
  error.cause = {
684
685
  entry: child
685
686
  };
686
- } catch (_error) {
687
+ // eslint-disable-next-line no-unused-vars
688
+ } catch (_) {
687
689
  // ignored
688
690
  }
689
691
  throw error;
@@ -729,7 +731,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
729
731
  let zipEntryOptions = {};
730
732
  if (child.data instanceof Entry) {
731
733
  const {
732
- externalFileAttribute,
734
+ externalFileAttributes,
733
735
  versionMadeBy,
734
736
  comment,
735
737
  lastModDate,
@@ -743,7 +745,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
743
745
  extraFieldAES
744
746
  } = child.data;
745
747
  zipEntryOptions = {
746
- externalFileAttribute,
748
+ externalFileAttributes,
747
749
  versionMadeBy,
748
750
  comment,
749
751
  lastModDate,
@@ -778,7 +780,8 @@ async function exportZip(zipWriter, entry, totalSize, options) {
778
780
  entryOffsets.set(name, indexProgress);
779
781
  try {
780
782
  await options.onprogress(Array.from(entryOffsets.values()).reduce((previousValue, currentValue) => previousValue + currentValue), totalSize);
781
- } catch (_error) {
783
+ // eslint-disable-next-line no-unused-vars
784
+ } catch (_) {
782
785
  // ignored
783
786
  }
784
787
  }
@@ -26,7 +26,7 @@
26
26
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  */
28
28
 
29
- /* global BigInt, Response, WritableStream, ReadableStream, TransformStream */
29
+ /* global Response, WritableStream, ReadableStream, TransformStream */
30
30
  // deno-lint-ignore-file no-this-alias
31
31
 
32
32
  import {
@@ -57,6 +57,8 @@ import {
57
57
  BITFLAG_DATA_DESCRIPTOR,
58
58
  BITFLAG_LANG_ENCODING_FLAG,
59
59
  FILE_ATTR_MSDOS_DIR_MASK,
60
+ FILE_ATTR_UNIX_DIR_MASK,
61
+ FILE_ATTR_UNIX_EXECUTABLE_MASK,
60
62
  DIRECTORY_SIGNATURE,
61
63
  UNDEFINED_VALUE
62
64
  } from "./constants.js";
@@ -250,14 +252,20 @@ class ZipReader {
250
252
  const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
251
253
  const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
252
254
  const versionMadeBy = getUint16(directoryView, offset + 4);
253
- const msDosCompatible = (versionMadeBy & 0) == 0;
255
+ const msDosCompatible = versionMadeBy >> 8 == 0;
256
+ const unixCompatible = versionMadeBy >> 8 == 3;
254
257
  const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
255
258
  const commentLength = getUint16(directoryView, offset + 32);
256
259
  const endOffset = commentOffset + commentLength;
257
260
  const rawComment = directoryArray.subarray(commentOffset, endOffset);
258
261
  const filenameUTF8 = languageEncodingFlag;
259
262
  const commentUTF8 = languageEncodingFlag;
260
- const directory = msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK);
263
+ const externalFileAttributes = getUint32(directoryView, offset + 38);
264
+ const directory =
265
+ (msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK)) ||
266
+ (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_DIR_MASK) == FILE_ATTR_UNIX_DIR_MASK)) ||
267
+ (rawFilename.length && rawFilename[rawFilename.length - 1] == DIRECTORY_SIGNATURE.charCodeAt(0));
268
+ const executable = (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_EXECUTABLE_MASK) == FILE_ATTR_UNIX_EXECUTABLE_MASK));
261
269
  const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
262
270
  Object.assign(fileEntry, {
263
271
  versionMadeBy,
@@ -268,13 +276,16 @@ class ZipReader {
268
276
  directory,
269
277
  offset: offsetFileEntry,
270
278
  diskNumberStart: getUint16(directoryView, offset + 34),
271
- internalFileAttribute: getUint16(directoryView, offset + 36),
272
- externalFileAttribute: getUint32(directoryView, offset + 38),
279
+ internalFileAttributes: getUint16(directoryView, offset + 36),
280
+ externalFileAttributes,
273
281
  rawFilename,
274
282
  filenameUTF8,
275
283
  commentUTF8,
276
- rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
284
+ rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
285
+ executable
277
286
  });
287
+ fileEntry.internalFileAttribute = fileEntry.internalFileAttributes;
288
+ fileEntry.externalFileAttribute = fileEntry.externalFileAttributes;
278
289
  const decode = getOptionValue(zipReader, options, "decodeText") || decodeText;
279
290
  const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
280
291
  const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
@@ -302,7 +313,8 @@ class ZipReader {
302
313
  if (onprogress) {
303
314
  try {
304
315
  await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
305
- } catch (_error) {
316
+ // eslint-disable-next-line no-unused-vars
317
+ } catch (_) {
306
318
  // ignored
307
319
  }
308
320
  }
@@ -531,7 +543,8 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
531
543
  });
532
544
  offsetExtraField += 4 + size;
533
545
  }
534
- } catch (_error) {
546
+ // eslint-disable-next-line no-unused-vars
547
+ } catch (_) {
535
548
  // ignored
536
549
  }
537
550
  const compressionMethod = getUint16(dataView, offset + 4);
@@ -638,7 +651,8 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
638
651
  }
639
652
  offsetExtraField += 4 + attributeSize;
640
653
  }
641
- } catch (_error) {
654
+ // eslint-disable-next-line no-unused-vars
655
+ } catch (_) {
642
656
  // ignored
643
657
  }
644
658
  try {
@@ -659,7 +673,8 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
659
673
  Object.assign(extraFieldNTFS, extraFieldData);
660
674
  Object.assign(directory, extraFieldData);
661
675
  }
662
- } catch (_error) {
676
+ // eslint-disable-next-line no-unused-vars
677
+ } catch (_) {
663
678
  // ignored
664
679
  }
665
680
  }
@@ -728,7 +743,8 @@ function getDate(timeRaw) {
728
743
  const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
729
744
  try {
730
745
  return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
731
- } catch (_error) {
746
+ // eslint-disable-next-line no-unused-vars
747
+ } catch (_) {
732
748
  // ignored
733
749
  }
734
750
  }
@@ -26,7 +26,7 @@
26
26
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  */
28
28
 
29
- /* global BigInt, TransformStream, Response */
29
+ /* global TransformStream, Response */
30
30
  // deno-lint-ignore-file no-this-alias
31
31
 
32
32
  import {
@@ -84,6 +84,8 @@ import {
84
84
  PROPERTY_NAME_CREATION_DATE,
85
85
  PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE,
86
86
  PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
87
+ PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES,
88
+ PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES,
87
89
  PROPERTY_NAME_MS_DOS_COMPATIBLE,
88
90
  PROPERTY_NAME_ZIP64,
89
91
  PROPERTY_NAME_ENCRYPTED,
@@ -258,8 +260,14 @@ async function addFile(zipWriter, name, reader, options) {
258
260
  const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
259
261
  const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
260
262
  const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE, true);
261
- const internalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
262
- const externalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
263
+ let internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
264
+ if (internalFileAttributes === 0) {
265
+ internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
266
+ }
267
+ let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
268
+ if (externalFileAttributes === 0) {
269
+ externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
270
+ }
263
271
  const passThrough = getOptionValue(zipWriter, options, "passThrough");
264
272
  let password, rawPassword;
265
273
  if (!passThrough) {
@@ -375,8 +383,10 @@ async function addFile(zipWriter, name, reader, options) {
375
383
  dataDescriptorSignature,
376
384
  signal,
377
385
  msDosCompatible,
378
- internalFileAttribute,
379
- externalFileAttribute,
386
+ internalFileAttribute: internalFileAttributes,
387
+ internalFileAttributes,
388
+ externalFileAttribute: externalFileAttributes,
389
+ externalFileAttributes,
380
390
  useCompressionStream,
381
391
  passThrough,
382
392
  encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
@@ -497,7 +507,8 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
497
507
  if (error) {
498
508
  try {
499
509
  error.corruptedEntry = true;
500
- } catch (_error) {
510
+ // eslint-disable-next-line no-unused-vars
511
+ } catch (_) {
501
512
  // ignored
502
513
  }
503
514
  }
@@ -590,8 +601,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
590
601
  encryptionStrength,
591
602
  extendedTimestamp,
592
603
  msDosCompatible,
593
- internalFileAttribute,
594
- externalFileAttribute,
604
+ internalFileAttributes,
605
+ externalFileAttributes,
595
606
  useCompressionStream,
596
607
  passThrough
597
608
  } = options;
@@ -610,8 +621,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
610
621
  rawExtraField,
611
622
  extendedTimestamp,
612
623
  msDosCompatible,
613
- internalFileAttribute,
614
- externalFileAttribute,
624
+ internalFileAttributes,
625
+ externalFileAttributes,
615
626
  diskNumberStart
616
627
  };
617
628
  let {
@@ -771,7 +782,8 @@ function getHeaderInfo(options) {
771
782
  setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
772
783
  setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
773
784
  setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
774
- } catch (_error) {
785
+ // eslint-disable-next-line no-unused-vars
786
+ } catch (_) {
775
787
  rawExtraFieldNTFS = new Uint8Array();
776
788
  }
777
789
  } else {
@@ -1066,8 +1078,8 @@ async function closeFile(zipWriter, comment, options) {
1066
1078
  zip64DiskNumberStart,
1067
1079
  zip64Offset,
1068
1080
  msDosCompatible,
1069
- internalFileAttribute,
1070
- externalFileAttribute,
1081
+ internalFileAttributes,
1082
+ externalFileAttributes,
1071
1083
  diskNumberStart,
1072
1084
  uncompressedSize,
1073
1085
  compressedSize
@@ -1086,9 +1098,9 @@ async function closeFile(zipWriter, comment, options) {
1086
1098
  setUint16(directoryView, offset + 30, extraFieldLength);
1087
1099
  setUint16(directoryView, offset + 32, getLength(rawComment));
1088
1100
  setUint16(directoryView, offset + 34, zip64 && zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
1089
- setUint16(directoryView, offset + 36, internalFileAttribute);
1090
- if (externalFileAttribute) {
1091
- setUint32(directoryView, offset + 38, externalFileAttribute);
1101
+ setUint16(directoryView, offset + 36, internalFileAttributes);
1102
+ if (externalFileAttributes) {
1103
+ setUint32(directoryView, offset + 38, externalFileAttributes);
1092
1104
  } else if (directory && msDosCompatible) {
1093
1105
  setUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);
1094
1106
  }
@@ -1110,7 +1122,8 @@ async function closeFile(zipWriter, comment, options) {
1110
1122
  if (options.onprogress) {
1111
1123
  try {
1112
1124
  await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
1113
- } catch (_error) {
1125
+ // eslint-disable-next-line no-unused-vars
1126
+ } catch (_) {
1114
1127
  // ignored
1115
1128
  }
1116
1129
  }
@@ -35,7 +35,8 @@ import { terminateWorkers } from "./core/codec-pool.js";
35
35
  let baseURL;
36
36
  try {
37
37
  baseURL = import.meta.url;
38
- } catch (_error) {
38
+ // eslint-disable-next-line no-unused-vars
39
+ } catch (_) {
39
40
  // ignored
40
41
  }
41
42
  configure({ baseURL });
package/lib/zip-fs.js CHANGED
@@ -35,7 +35,8 @@ import { terminateWorkers } from "./core/codec-pool.js";
35
35
  let baseURL;
36
36
  try {
37
37
  baseURL = import.meta.url;
38
- } catch (_error) {
38
+ // eslint-disable-next-line no-unused-vars
39
+ } catch (_) {
39
40
  // ignored
40
41
  }
41
42
  configure({ baseURL });
@@ -36,7 +36,8 @@ import { terminateWorkers } from "./core/codec-pool.js";
36
36
  let baseURL;
37
37
  try {
38
38
  baseURL = import.meta.url;
39
- } catch (_error) {
39
+ // eslint-disable-next-line no-unused-vars
40
+ } catch (_) {
40
41
  // ignored
41
42
  }
42
43
  configureWebWorker(configure);
package/lib/zip-full.js CHANGED
@@ -37,7 +37,8 @@ import { terminateWorkers } from "./core/codec-pool.js";
37
37
  let baseURL;
38
38
  try {
39
39
  baseURL = import.meta.url;
40
- } catch (_error) {
40
+ // eslint-disable-next-line no-unused-vars
41
+ } catch (_) {
41
42
  // ignored
42
43
  }
43
44
  configureWebWorker(configure);
package/lib/zip.js CHANGED
@@ -35,7 +35,8 @@ import { terminateWorkers } from "./core/codec-pool.js";
35
35
  let baseURL;
36
36
  try {
37
37
  baseURL = import.meta.url;
38
- } catch (_error) {
38
+ // eslint-disable-next-line no-unused-vars
39
+ } catch (_) {
39
40
  // ignored
40
41
  }
41
42
  configure({ baseURL });