@zip.js/zip.js 2.7.55 → 2.7.57

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/dist/zip.js CHANGED
@@ -67,6 +67,9 @@
67
67
  const BITFLAG_DATA_DESCRIPTOR = 0x0008;
68
68
  const BITFLAG_LANG_ENCODING_FLAG = 0x0800;
69
69
  const FILE_ATTR_MSDOS_DIR_MASK = 0x10;
70
+ const FILE_ATTR_UNIX_DIR_MASK = 0x4000;
71
+ const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;
72
+ const FILE_ATTR_UNIX_DEFAULT_MASK = 0o644;
70
73
 
71
74
  const VERSION_DEFLATE = 0x14;
72
75
  const VERSION_ZIP64 = 0x2D;
@@ -167,7 +170,8 @@
167
170
  if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
168
171
  maxWorkers = navigator.hardwareConcurrency;
169
172
  }
170
- } catch (_error) {
173
+ // eslint-disable-next-line no-unused-vars
174
+ } catch (_) {
171
175
  // ignored
172
176
  }
173
177
  const DEFAULT_CONFIGURATION = {
@@ -1605,7 +1609,8 @@
1605
1609
  if (IMPORT_KEY_SUPPORTED) {
1606
1610
  try {
1607
1611
  return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
1608
- } catch (_error) {
1612
+ // eslint-disable-next-line no-unused-vars
1613
+ } catch (_) {
1609
1614
  IMPORT_KEY_SUPPORTED = false;
1610
1615
  return misc.importKey(password);
1611
1616
  }
@@ -1618,7 +1623,8 @@
1618
1623
  if (DERIVE_BITS_SUPPORTED) {
1619
1624
  try {
1620
1625
  return await subtle.deriveBits(algorithm, baseKey, length);
1621
- } catch (_error) {
1626
+ // eslint-disable-next-line no-unused-vars
1627
+ } catch (_) {
1622
1628
  DERIVE_BITS_SUPPORTED = false;
1623
1629
  return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
1624
1630
  }
@@ -1936,11 +1942,13 @@
1936
1942
  try {
1937
1943
  const CompressionStream = useCompressionStream && CodecStreamNative ? CodecStreamNative : CodecStream;
1938
1944
  readable = pipeThrough(readable, new CompressionStream(COMPRESSION_FORMAT, options));
1939
- } catch (_error) {
1945
+ // eslint-disable-next-line no-unused-vars
1946
+ } catch (_) {
1940
1947
  if (useCompressionStream) {
1941
1948
  try {
1942
1949
  readable = pipeThrough(readable, new CodecStream(COMPRESSION_FORMAT, options));
1943
- } catch (_error) {
1950
+ // eslint-disable-next-line no-unused-vars
1951
+ } catch (_) {
1944
1952
  return readable;
1945
1953
  }
1946
1954
  } else {
@@ -2183,7 +2191,8 @@
2183
2191
  async function callHandler(handler, ...parameters) {
2184
2192
  try {
2185
2193
  await handler(...parameters);
2186
- } catch (_error) {
2194
+ // eslint-disable-next-line no-unused-vars
2195
+ } catch (_) {
2187
2196
  // ignored
2188
2197
  }
2189
2198
  }
@@ -2200,7 +2209,8 @@
2200
2209
  let worker;
2201
2210
  try {
2202
2211
  worker = getWebWorker(workerData.scripts[0], baseURL, workerData);
2203
- } catch (_error) {
2212
+ // eslint-disable-next-line no-unused-vars
2213
+ } catch (_) {
2204
2214
  WEB_WORKERS_SUPPORTED = false;
2205
2215
  return createWorkerInterface(workerData, config);
2206
2216
  }
@@ -2303,13 +2313,15 @@
2303
2313
  }
2304
2314
  try {
2305
2315
  scriptUrl = new URL(url, baseURL);
2306
- } catch (_error) {
2316
+ // eslint-disable-next-line no-unused-vars
2317
+ } catch (_) {
2307
2318
  scriptUrl = url;
2308
2319
  }
2309
2320
  if (classicWorkersSupported) {
2310
2321
  try {
2311
2322
  worker = new Worker(scriptUrl);
2312
- } catch (_error) {
2323
+ // eslint-disable-next-line no-unused-vars
2324
+ } catch (_) {
2313
2325
  classicWorkersSupported = false;
2314
2326
  worker = new Worker(scriptUrl, workerOptions);
2315
2327
  }
@@ -2347,7 +2359,8 @@
2347
2359
  try {
2348
2360
  worker.postMessage(message, transferables);
2349
2361
  return true;
2350
- } catch (_error) {
2362
+ // eslint-disable-next-line no-unused-vars
2363
+ } catch (_) {
2351
2364
  transferStreamsSupported = false;
2352
2365
  message.readable = message.writable = null;
2353
2366
  worker.postMessage(message);
@@ -2490,7 +2503,8 @@
2490
2503
  pool = pool.filter(data => data != workerData);
2491
2504
  try {
2492
2505
  await workerData.terminate();
2493
- } catch (_error) {
2506
+ // eslint-disable-next-line no-unused-vars
2507
+ } catch (_) {
2494
2508
  // ignored
2495
2509
  }
2496
2510
  }, terminateWorkerTimeout);
@@ -2831,7 +2845,7 @@
2831
2845
  combineSizeEocd
2832
2846
  } = httpReader;
2833
2847
  if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRequest)) {
2834
- const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -END_OF_CENTRAL_DIR_LENGTH : undefined));
2848
+ const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -22 : undefined));
2835
2849
  if (!forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {
2836
2850
  throw new Error(ERR_HTTP_RANGE);
2837
2851
  } else {
@@ -3354,22 +3368,23 @@
3354
3368
  const PROPERTY_NAME_CREATION_DATE = "creationDate";
3355
3369
  const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
3356
3370
  const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE = "internalFileAttribute";
3371
+ const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
3357
3372
  const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE = "externalFileAttribute";
3373
+ const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
3358
3374
  const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
3359
3375
  const PROPERTY_NAME_ZIP64 = "zip64";
3360
3376
  const PROPERTY_NAME_ENCRYPTED = "encrypted";
3361
3377
  const PROPERTY_NAME_VERSION = "version";
3362
3378
  const PROPERTY_NAME_VERSION_MADE_BY = "versionMadeBy";
3363
3379
  const PROPERTY_NAME_ZIPCRYPTO = "zipCrypto";
3380
+ const PROPERTY_NAME_DIRECTORY = "directory";
3381
+ const PROPERTY_NAME_EXECUTABLE = "executable";
3364
3382
 
3365
3383
  const PROPERTY_NAMES = [
3366
3384
  PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, PROPERTY_NAME_COMPPRESSED_SIZE, PROPERTY_NAME_UNCOMPPRESSED_SIZE,
3367
3385
  PROPERTY_NAME_LAST_MODIFICATION_DATE, PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT,
3368
3386
  PROPERTY_NAME_LAST_ACCESS_DATE, PROPERTY_NAME_CREATION_DATE, PROPERTY_NAME_OFFSET, PROPERTY_NAME_DISK_NUMBER_START,
3369
- PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
3370
- PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY,
3371
- PROPERTY_NAME_ZIPCRYPTO, "directory", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField",
3372
- "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
3387
+ 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, PROPERTY_NAME_DIRECTORY, PROPERTY_NAME_EXECUTABLE, "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField", "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
3373
3388
 
3374
3389
  class Entry {
3375
3390
 
@@ -3560,14 +3575,20 @@
3560
3575
  const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
3561
3576
  const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
3562
3577
  const versionMadeBy = getUint16(directoryView, offset + 4);
3563
- const msDosCompatible = (versionMadeBy & 0) == 0;
3578
+ const msDosCompatible = versionMadeBy >> 8 == 0;
3579
+ const unixCompatible = versionMadeBy >> 8 == 3;
3564
3580
  const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
3565
3581
  const commentLength = getUint16(directoryView, offset + 32);
3566
3582
  const endOffset = commentOffset + commentLength;
3567
3583
  const rawComment = directoryArray.subarray(commentOffset, endOffset);
3568
3584
  const filenameUTF8 = languageEncodingFlag;
3569
3585
  const commentUTF8 = languageEncodingFlag;
3570
- const directory = msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK);
3586
+ const externalFileAttributes = getUint32(directoryView, offset + 38);
3587
+ const directory =
3588
+ (msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK)) ||
3589
+ (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_DIR_MASK) == FILE_ATTR_UNIX_DIR_MASK)) ||
3590
+ (rawFilename.length && rawFilename[rawFilename.length - 1] == DIRECTORY_SIGNATURE.charCodeAt(0));
3591
+ const executable = (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_EXECUTABLE_MASK) == FILE_ATTR_UNIX_EXECUTABLE_MASK));
3571
3592
  const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
3572
3593
  Object.assign(fileEntry, {
3573
3594
  versionMadeBy,
@@ -3578,13 +3599,16 @@
3578
3599
  directory,
3579
3600
  offset: offsetFileEntry,
3580
3601
  diskNumberStart: getUint16(directoryView, offset + 34),
3581
- internalFileAttribute: getUint16(directoryView, offset + 36),
3582
- externalFileAttribute: getUint32(directoryView, offset + 38),
3602
+ internalFileAttributes: getUint16(directoryView, offset + 36),
3603
+ externalFileAttributes,
3583
3604
  rawFilename,
3584
3605
  filenameUTF8,
3585
3606
  commentUTF8,
3586
- rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
3607
+ rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
3608
+ executable
3587
3609
  });
3610
+ fileEntry.internalFileAttribute = fileEntry.internalFileAttributes;
3611
+ fileEntry.externalFileAttribute = fileEntry.externalFileAttributes;
3588
3612
  const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
3589
3613
  const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
3590
3614
  const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
@@ -3612,7 +3636,8 @@
3612
3636
  if (onprogress) {
3613
3637
  try {
3614
3638
  await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
3615
- } catch (_error) {
3639
+ // eslint-disable-next-line no-unused-vars
3640
+ } catch (_) {
3616
3641
  // ignored
3617
3642
  }
3618
3643
  }
@@ -3824,7 +3849,8 @@
3824
3849
  });
3825
3850
  offsetExtraField += 4 + size;
3826
3851
  }
3827
- } catch (_error) {
3852
+ // eslint-disable-next-line no-unused-vars
3853
+ } catch (_) {
3828
3854
  // ignored
3829
3855
  }
3830
3856
  const compressionMethod = getUint16(dataView, offset + 4);
@@ -3931,7 +3957,8 @@
3931
3957
  }
3932
3958
  offsetExtraField += 4 + attributeSize;
3933
3959
  }
3934
- } catch (_error) {
3960
+ // eslint-disable-next-line no-unused-vars
3961
+ } catch (_) {
3935
3962
  // ignored
3936
3963
  }
3937
3964
  try {
@@ -3952,7 +3979,8 @@
3952
3979
  Object.assign(extraFieldNTFS, extraFieldData);
3953
3980
  Object.assign(directory, extraFieldData);
3954
3981
  }
3955
- } catch (_error) {
3982
+ // eslint-disable-next-line no-unused-vars
3983
+ } catch (_) {
3956
3984
  // ignored
3957
3985
  }
3958
3986
  }
@@ -4021,7 +4049,8 @@
4021
4049
  const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
4022
4050
  try {
4023
4051
  return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
4024
- } catch (_error) {
4052
+ // eslint-disable-next-line no-unused-vars
4053
+ } catch (_) {
4025
4054
  // ignored
4026
4055
  }
4027
4056
  }
@@ -4200,10 +4229,37 @@
4200
4229
 
4201
4230
  async function addFile(zipWriter, name, reader, options) {
4202
4231
  name = name.trim();
4203
- if (options.directory && (!name.endsWith(DIRECTORY_SIGNATURE))) {
4204
- name += DIRECTORY_SIGNATURE;
4205
- } else {
4206
- options.directory = name.endsWith(DIRECTORY_SIGNATURE);
4232
+ const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
4233
+ const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768);
4234
+ const executable = getOptionValue(zipWriter, options, PROPERTY_NAME_EXECUTABLE);
4235
+ if (versionMadeBy > MAX_16_BITS) {
4236
+ throw new Error(ERR_INVALID_VERSION);
4237
+ }
4238
+ let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
4239
+ if (externalFileAttributes === 0) {
4240
+ externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
4241
+ }
4242
+ if (!options.directory && name.endsWith(DIRECTORY_SIGNATURE)) {
4243
+ options.directory = true;
4244
+ }
4245
+ const directory = getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
4246
+ if (directory) {
4247
+ if (!name.endsWith(DIRECTORY_SIGNATURE)) {
4248
+ name += DIRECTORY_SIGNATURE;
4249
+ }
4250
+ if (externalFileAttributes === 0) {
4251
+ if (msDosCompatible) {
4252
+ externalFileAttributes = FILE_ATTR_MSDOS_DIR_MASK;
4253
+ } else {
4254
+ externalFileAttributes = FILE_ATTR_UNIX_DIR_MASK << 16;
4255
+ }
4256
+ }
4257
+ } else if (!msDosCompatible && externalFileAttributes === 0) {
4258
+ if (executable) {
4259
+ externalFileAttributes = (FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
4260
+ } else {
4261
+ externalFileAttributes = FILE_ATTR_UNIX_DEFAULT_MASK << 16;
4262
+ }
4207
4263
  }
4208
4264
  const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
4209
4265
  let rawFilename = encode(name);
@@ -4225,16 +4281,13 @@
4225
4281
  if (version > MAX_16_BITS) {
4226
4282
  throw new Error(ERR_INVALID_VERSION);
4227
4283
  }
4228
- const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, 20);
4229
- if (versionMadeBy > MAX_16_BITS) {
4230
- throw new Error(ERR_INVALID_VERSION);
4231
- }
4232
4284
  const lastModDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
4233
4285
  const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
4234
4286
  const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
4235
- const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE, true);
4236
- const internalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
4237
- const externalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
4287
+ let internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
4288
+ if (internalFileAttributes === 0) {
4289
+ internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
4290
+ }
4238
4291
  const passThrough = getOptionValue(zipWriter, options, "passThrough");
4239
4292
  let password, rawPassword;
4240
4293
  if (!passThrough) {
@@ -4350,8 +4403,10 @@
4350
4403
  dataDescriptorSignature,
4351
4404
  signal,
4352
4405
  msDosCompatible,
4353
- internalFileAttribute,
4354
- externalFileAttribute,
4406
+ internalFileAttribute: internalFileAttributes,
4407
+ internalFileAttributes,
4408
+ externalFileAttribute: externalFileAttributes,
4409
+ externalFileAttributes,
4355
4410
  useCompressionStream,
4356
4411
  passThrough,
4357
4412
  encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
@@ -4472,7 +4527,8 @@
4472
4527
  if (error) {
4473
4528
  try {
4474
4529
  error.corruptedEntry = true;
4475
- } catch (_error) {
4530
+ // eslint-disable-next-line no-unused-vars
4531
+ } catch (_) {
4476
4532
  // ignored
4477
4533
  }
4478
4534
  }
@@ -4554,6 +4610,7 @@
4554
4610
  zipCrypto,
4555
4611
  dataDescriptor,
4556
4612
  directory,
4613
+ executable,
4557
4614
  versionMadeBy,
4558
4615
  rawComment,
4559
4616
  rawExtraField,
@@ -4565,8 +4622,8 @@
4565
4622
  encryptionStrength,
4566
4623
  extendedTimestamp,
4567
4624
  msDosCompatible,
4568
- internalFileAttribute,
4569
- externalFileAttribute,
4625
+ internalFileAttributes,
4626
+ externalFileAttributes,
4570
4627
  useCompressionStream,
4571
4628
  passThrough
4572
4629
  } = options;
@@ -4575,6 +4632,7 @@
4575
4632
  versionMadeBy,
4576
4633
  zip64,
4577
4634
  directory: Boolean(directory),
4635
+ executable: Boolean(executable),
4578
4636
  filenameUTF8: true,
4579
4637
  rawFilename,
4580
4638
  commentUTF8: true,
@@ -4585,8 +4643,8 @@
4585
4643
  rawExtraField,
4586
4644
  extendedTimestamp,
4587
4645
  msDosCompatible,
4588
- internalFileAttribute,
4589
- externalFileAttribute,
4646
+ internalFileAttributes,
4647
+ externalFileAttributes,
4590
4648
  diskNumberStart
4591
4649
  };
4592
4650
  let {
@@ -4746,7 +4804,8 @@
4746
4804
  setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
4747
4805
  setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
4748
4806
  setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
4749
- } catch (_error) {
4807
+ // eslint-disable-next-line no-unused-vars
4808
+ } catch (_) {
4750
4809
  rawExtraFieldNTFS = new Uint8Array();
4751
4810
  }
4752
4811
  } else {
@@ -5034,15 +5093,13 @@
5034
5093
  rawComment,
5035
5094
  versionMadeBy,
5036
5095
  headerArray,
5037
- directory,
5038
5096
  zip64,
5039
5097
  zip64UncompressedSize,
5040
5098
  zip64CompressedSize,
5041
5099
  zip64DiskNumberStart,
5042
5100
  zip64Offset,
5043
- msDosCompatible,
5044
- internalFileAttribute,
5045
- externalFileAttribute,
5101
+ internalFileAttributes,
5102
+ externalFileAttributes,
5046
5103
  diskNumberStart,
5047
5104
  uncompressedSize,
5048
5105
  compressedSize
@@ -5061,11 +5118,9 @@
5061
5118
  setUint16(directoryView, offset + 30, extraFieldLength);
5062
5119
  setUint16(directoryView, offset + 32, getLength(rawComment));
5063
5120
  setUint16(directoryView, offset + 34, zip64 && zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
5064
- setUint16(directoryView, offset + 36, internalFileAttribute);
5065
- if (externalFileAttribute) {
5066
- setUint32(directoryView, offset + 38, externalFileAttribute);
5067
- } else if (directory && msDosCompatible) {
5068
- setUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);
5121
+ setUint16(directoryView, offset + 36, internalFileAttributes);
5122
+ if (externalFileAttributes) {
5123
+ setUint32(directoryView, offset + 38, externalFileAttributes);
5069
5124
  }
5070
5125
  setUint32(directoryView, offset + 42, zip64 && zip64Offset ? MAX_32_BITS : fileEntryOffset);
5071
5126
  arraySet(directoryArray, rawFilename, offset + 46);
@@ -5085,7 +5140,8 @@
5085
5140
  if (options.onprogress) {
5086
5141
  try {
5087
5142
  await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
5088
- } catch (_error) {
5143
+ // eslint-disable-next-line no-unused-vars
5144
+ } catch (_) {
5089
5145
  // ignored
5090
5146
  }
5091
5147
  }
@@ -5240,7 +5296,8 @@
5240
5296
  let baseURL;
5241
5297
  try {
5242
5298
  baseURL = (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('zip.js', document.baseURI).href));
5243
- } catch (_error) {
5299
+ // eslint-disable-next-line no-unused-vars
5300
+ } catch (_) {
5244
5301
  // ignored
5245
5302
  }
5246
5303
  configure({ baseURL });