@zip.js/zip.js 2.8.10 → 2.8.13

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/index-native.cjs CHANGED
@@ -5185,15 +5185,19 @@ function getHeaderInfo(options) {
5185
5185
  let { version, compressionMethod } = options;
5186
5186
  const compressed = !directory && (level > 0 || (level === UNDEFINED_VALUE && compressionMethod !== 0));
5187
5187
  let rawExtraFieldZip64;
5188
+ let rawLocalExtraFieldZip64;
5188
5189
  const uncompressedFile = passThrough || !compressed;
5189
5190
  const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
5190
5191
  if (zip64) {
5191
5192
  let rawExtraFieldZip64Length = 4;
5193
+ let rawLocalExtraFieldZip64Length = 4;
5192
5194
  if (zip64UncompressedSize) {
5193
5195
  rawExtraFieldZip64Length += 8;
5196
+ rawLocalExtraFieldZip64Length += 8;
5194
5197
  }
5195
5198
  if (zip64CompressedSize) {
5196
5199
  rawExtraFieldZip64Length += 8;
5200
+ rawLocalExtraFieldZip64Length += 8;
5197
5201
  }
5198
5202
  if (zip64Offset) {
5199
5203
  rawExtraFieldZip64Length += 8;
@@ -5203,18 +5207,28 @@ function getHeaderInfo(options) {
5203
5207
  }
5204
5208
  rawExtraFieldZip64 = new Uint8Array(rawExtraFieldZip64Length);
5205
5209
  const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64);
5210
+ rawLocalExtraFieldZip64 = new Uint8Array(rawLocalExtraFieldZip64Length);
5211
+ const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
5206
5212
  setUint16(rawExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
5207
5213
  setUint16(rawExtraFieldZip64View, 2, getLength(rawExtraFieldZip64) - 4);
5214
+ setUint16(rawLocalExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
5215
+ setUint16(rawLocalExtraFieldZip64View, 2, getLength(rawLocalExtraFieldZip64) - 4);
5208
5216
  if (zip64ExtraFieldComplete) {
5209
5217
  const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64);
5218
+ const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
5210
5219
  let rawExtraFieldZip64Offset = 4;
5220
+ let rawLocalExtraFieldZip64Offset = 4;
5211
5221
  if (zip64UncompressedSize) {
5212
5222
  setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(uncompressedSize));
5213
5223
  rawExtraFieldZip64Offset += 8;
5224
+ setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
5225
+ rawLocalExtraFieldZip64Offset += 8;
5214
5226
  }
5215
5227
  if (zip64CompressedSize && uncompressedFile) {
5216
5228
  setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(uncompressedSize));
5217
5229
  rawExtraFieldZip64Offset += 8;
5230
+ setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
5231
+ rawLocalExtraFieldZip64Offset += 8;
5218
5232
  }
5219
5233
  if (zip64Offset) {
5220
5234
  setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(offset));
@@ -5227,6 +5241,7 @@ function getHeaderInfo(options) {
5227
5241
  }
5228
5242
  } else {
5229
5243
  rawExtraFieldZip64 = new Uint8Array();
5244
+ rawLocalExtraFieldZip64 = new Uint8Array();
5230
5245
  }
5231
5246
  let rawExtraFieldAES;
5232
5247
  if (encrypted && !zipCrypto) {
@@ -5329,7 +5344,7 @@ function getHeaderInfo(options) {
5329
5344
  rawExtraFieldAES[9] = compressionMethod;
5330
5345
  compressionMethod = COMPRESSION_METHOD_AES;
5331
5346
  }
5332
- const localExtraFieldZip64Length = zip64ExtraFieldComplete ? getLength(rawExtraFieldZip64) : 0;
5347
+ const localExtraFieldZip64Length = zip64ExtraFieldComplete ? getLength(rawLocalExtraFieldZip64) : 0;
5333
5348
  const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
5334
5349
  const {
5335
5350
  headerArray,
@@ -5354,7 +5369,7 @@ function getHeaderInfo(options) {
5354
5369
  arraySet(localHeaderArray, rawFilename, localHeaderOffset);
5355
5370
  localHeaderOffset += getLength(rawFilename);
5356
5371
  if (zip64ExtraFieldComplete) {
5357
- arraySet(localHeaderArray, rawExtraFieldZip64, localHeaderOffset);
5372
+ arraySet(localHeaderArray, rawLocalExtraFieldZip64, localHeaderOffset);
5358
5373
  }
5359
5374
  localHeaderOffset += localExtraFieldZip64Length;
5360
5375
  arraySet(localHeaderArray, rawExtraFieldAES, localHeaderOffset);
@@ -5527,12 +5542,8 @@ function updateLocalHeader({
5527
5542
  signature,
5528
5543
  compressedSize,
5529
5544
  uncompressedSize,
5530
- offset,
5531
- diskNumberStart,
5532
5545
  zip64UncompressedSize,
5533
- zip64CompressedSize,
5534
- zip64Offset,
5535
- zip64DiskNumberStart
5546
+ zip64CompressedSize
5536
5547
  }, localHeaderView, { dataDescriptor }) {
5537
5548
  if (!dataDescriptor) {
5538
5549
  if (!encrypted) {
@@ -5554,13 +5565,6 @@ function updateLocalHeader({
5554
5565
  setBigUint64(localHeaderView, localHeaderOffset, BigInt(compressedSize));
5555
5566
  localHeaderOffset += 8;
5556
5567
  }
5557
- if (zip64Offset) {
5558
- setBigUint64(localHeaderView, localHeaderOffset, BigInt(offset));
5559
- localHeaderOffset += 8;
5560
- }
5561
- if (zip64DiskNumberStart) {
5562
- setUint32(localHeaderView, localHeaderOffset, diskNumberStart);
5563
- }
5564
5568
  }
5565
5569
  }
5566
5570
  }