@zip.js/zip.js 2.8.56 → 2.8.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/deno.json +1 -1
- package/dist/zip-core-external.js +47 -23
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +47 -22
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +48 -24
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +47 -23
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +48 -24
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +48 -23
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +48 -23
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +47 -22
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +47 -22
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +47 -22
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +48 -23
- package/index-native.min.js +1 -1
- package/index.cjs +48 -23
- package/index.d.cts +13 -1
- package/index.d.ts +13 -1
- package/index.min.js +1 -1
- package/lib/core/zip-fs.js +1 -1
- package/lib/core/zip-reader.js +11 -4
- package/lib/core/zip-writer.js +37 -20
- package/lib/zip-core-reader.js +1 -0
- package/package.json +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -4733,6 +4733,7 @@
|
|
|
4733
4733
|
const ERR_INVALID_STRICTNESS = "Invalid strictness (must be 'strict', 'balanced' or 'tolerant')";
|
|
4734
4734
|
const ERR_INVALID_FILENAME_VALIDATION = "Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')";
|
|
4735
4735
|
const ERR_INVALID_MAX_APPENDED_DATA_SIZE = "Invalid maxAppendedDataSize (must be a number greater than or equal to 0)";
|
|
4736
|
+
const ERR_UNSUPPORTED_UINT64 = "64-bit value exceeds Number.MAX_SAFE_INTEGER";
|
|
4736
4737
|
const DRIVE_LETTER_REGEXP = /^[a-zA-Z]:/;
|
|
4737
4738
|
const CHARSET_UTF8 = "utf-8";
|
|
4738
4739
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
@@ -4755,6 +4756,7 @@
|
|
|
4755
4756
|
bytes: 8
|
|
4756
4757
|
}
|
|
4757
4758
|
};
|
|
4759
|
+
const MAX_SAFE_UINT64 = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4758
4760
|
const MAX_END_OF_CENTRAL_DIR_PROBES = 64;
|
|
4759
4761
|
const MAX_DEFLATE_EXPANSION_RATIO = 1032;
|
|
4760
4762
|
const CENTRAL_DIRECTORY_UNREACHABLE = 0;
|
|
@@ -4850,7 +4852,7 @@
|
|
|
4850
4852
|
zip64EndOfDirectoryVersion2 = getBigUint64(endOfDirectoryView, 4) > ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12;
|
|
4851
4853
|
if (zip64EndOfDirectoryVersion2) {
|
|
4852
4854
|
const extensibleDataLength = Math.min(
|
|
4853
|
-
|
|
4855
|
+
getBigUint64(endOfDirectoryView, 4) - (ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12),
|
|
4854
4856
|
reader.size - directoryDataOffset - ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4855
4857
|
if (extensibleDataLength > 0) {
|
|
4856
4858
|
zip64EndOfDirectoryLength += extensibleDataLength;
|
|
@@ -5431,8 +5433,8 @@
|
|
|
5431
5433
|
const hashDataLength = getUint16$1(extensibleDataView, 26);
|
|
5432
5434
|
Object.assign(directoryEncryptionInfo, {
|
|
5433
5435
|
compressionMethod: getUint16$1(extensibleDataView, 0),
|
|
5434
|
-
compressedSize:
|
|
5435
|
-
uncompressedSize:
|
|
5436
|
+
compressedSize: getBigUint64(extensibleDataView, 2),
|
|
5437
|
+
uncompressedSize: getBigUint64(extensibleDataView, 10),
|
|
5436
5438
|
encryptionAlgorithm: getUint16$1(extensibleDataView, 18),
|
|
5437
5439
|
bitLength: getUint16$1(extensibleDataView, 20),
|
|
5438
5440
|
flags: getUint16$1(extensibleDataView, 22),
|
|
@@ -6067,7 +6069,11 @@
|
|
|
6067
6069
|
}
|
|
6068
6070
|
|
|
6069
6071
|
function getBigUint64(view, offset) {
|
|
6070
|
-
|
|
6072
|
+
const value = view.getBigUint64(offset, true);
|
|
6073
|
+
if (value > MAX_SAFE_UINT64) {
|
|
6074
|
+
throw new Error(ERR_UNSUPPORTED_UINT64);
|
|
6075
|
+
}
|
|
6076
|
+
return Number(value);
|
|
6071
6077
|
}
|
|
6072
6078
|
|
|
6073
6079
|
var zipReader = /*#__PURE__*/Object.freeze({
|
|
@@ -6096,6 +6102,7 @@
|
|
|
6096
6102
|
ERR_UNSAFE_FILENAME: ERR_UNSAFE_FILENAME,
|
|
6097
6103
|
ERR_UNSUPPORTED_COMPRESSION: ERR_UNSUPPORTED_COMPRESSION$1,
|
|
6098
6104
|
ERR_UNSUPPORTED_ENCRYPTION: ERR_UNSUPPORTED_ENCRYPTION,
|
|
6105
|
+
ERR_UNSUPPORTED_UINT64: ERR_UNSUPPORTED_UINT64,
|
|
6099
6106
|
ERR_WORKER_STARTUP_TIMEOUT: ERR_WORKER_STARTUP_TIMEOUT,
|
|
6100
6107
|
ZipReader: ZipReader,
|
|
6101
6108
|
ZipReaderStream: ZipReaderStream
|
|
@@ -6236,7 +6243,7 @@
|
|
|
6236
6243
|
encrypted,
|
|
6237
6244
|
uncompressedSize,
|
|
6238
6245
|
compressedSize,
|
|
6239
|
-
|
|
6246
|
+
extraFieldZip64
|
|
6240
6247
|
} = entry;
|
|
6241
6248
|
let {
|
|
6242
6249
|
compressionMethod,
|
|
@@ -6253,13 +6260,13 @@
|
|
|
6253
6260
|
rawExtraFieldExtendedTimestamp = rawExtraFieldExtendedTimestamp || EMPTY_UINT8_ARRAY;
|
|
6254
6261
|
rawExtraFieldNTFS = rawExtraFieldNTFS || EMPTY_UINT8_ARRAY;
|
|
6255
6262
|
rawExtraFieldUnix = rawExtraFieldUnix || EMPTY_UINT8_ARRAY;
|
|
6256
|
-
rawExtraField = rawExtraField || EMPTY_UINT8_ARRAY;
|
|
6263
|
+
rawExtraField = removeExtraFieldZip64(rawExtraField || EMPTY_UINT8_ARRAY);
|
|
6257
6264
|
if (entry.extraFieldAES) {
|
|
6258
6265
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
6259
6266
|
}
|
|
6260
6267
|
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
|
|
6261
|
-
const zip64UncompressedSize =
|
|
6262
|
-
const zip64CompressedSize =
|
|
6268
|
+
const zip64UncompressedSize = Boolean(extraFieldZip64) && extraFieldZip64.uncompressedSize !== UNDEFINED_VALUE;
|
|
6269
|
+
const zip64CompressedSize = Boolean(extraFieldZip64) && extraFieldZip64.compressedSize !== UNDEFINED_VALUE;
|
|
6263
6270
|
const bitFlagValue = (getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted, compressionMethod) & ~BITFLAG_LEVEL) | (level << 1);
|
|
6264
6271
|
const {
|
|
6265
6272
|
headerArray,
|
|
@@ -6815,6 +6822,10 @@
|
|
|
6815
6822
|
maximumCompressedSize = contentSize === UNDEFINED_VALUE ? getMaximumCompressedSize(uncompressedSize) + encryptionOverhead : contentSize;
|
|
6816
6823
|
}
|
|
6817
6824
|
}
|
|
6825
|
+
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !passThrough)) && !isCompressed(compressionMethod, level);
|
|
6826
|
+
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
6827
|
+
dataDescriptor = false;
|
|
6828
|
+
}
|
|
6818
6829
|
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
6819
6830
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
6820
6831
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
@@ -6829,6 +6840,7 @@
|
|
|
6829
6840
|
maximumCompressedSize,
|
|
6830
6841
|
resolvedOptions: {
|
|
6831
6842
|
dataDescriptor,
|
|
6843
|
+
emptyEntry,
|
|
6832
6844
|
zip64,
|
|
6833
6845
|
zip64UncompressedSize,
|
|
6834
6846
|
zip64CompressedSize,
|
|
@@ -6927,6 +6939,7 @@
|
|
|
6927
6939
|
const {
|
|
6928
6940
|
keepOrder,
|
|
6929
6941
|
dataDescriptor,
|
|
6942
|
+
emptyEntry,
|
|
6930
6943
|
signal
|
|
6931
6944
|
} = options;
|
|
6932
6945
|
const {
|
|
@@ -6951,7 +6964,7 @@
|
|
|
6951
6964
|
lockPreviousFileEntry = previousFileEntry && previousFileEntry.lockFileEntry;
|
|
6952
6965
|
requestLockCurrentFileEntry();
|
|
6953
6966
|
}
|
|
6954
|
-
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || !dataDescriptor) {
|
|
6967
|
+
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || (!dataDescriptor && !emptyEntry)) {
|
|
6955
6968
|
bufferedWrite = true;
|
|
6956
6969
|
zipWriter.bufferedWrites++;
|
|
6957
6970
|
if (options.createTempStream) {
|
|
@@ -7373,8 +7386,8 @@
|
|
|
7373
7386
|
try {
|
|
7374
7387
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7375
7388
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE$1 && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7376
|
-
const uidBytes = packUnixId(uid);
|
|
7377
|
-
const gidBytes = packUnixId(gid);
|
|
7389
|
+
const uidBytes = packUnixId(uid === UNDEFINED_VALUE ? 0 : uid);
|
|
7390
|
+
const gidBytes = packUnixId(gid === UNDEFINED_VALUE ? 0 : gid);
|
|
7378
7391
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
7379
7392
|
const extraFieldUnix = createRecordWriter(4 + payloadLength);
|
|
7380
7393
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_INFOZIP);
|
|
@@ -7505,18 +7518,14 @@
|
|
|
7505
7518
|
}
|
|
7506
7519
|
|
|
7507
7520
|
function packUnixId(id) {
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
let length = 4;
|
|
7515
|
-
while (length > 1 && dataArray[length - 1] === 0) {
|
|
7516
|
-
length--;
|
|
7517
|
-
}
|
|
7518
|
-
return dataArray.subarray(0, length);
|
|
7521
|
+
const dataArray = new Uint8Array(4);
|
|
7522
|
+
const dataView = getDataView(dataArray);
|
|
7523
|
+
dataView.setUint32(0, id, true);
|
|
7524
|
+
let length = 4;
|
|
7525
|
+
while (length > 1 && dataArray[length - 1] === 0) {
|
|
7526
|
+
length--;
|
|
7519
7527
|
}
|
|
7528
|
+
return dataArray.subarray(0, length);
|
|
7520
7529
|
}
|
|
7521
7530
|
|
|
7522
7531
|
function normalizeMsdosAttributes(msdosAttributesRaw, msdosAttributes) {
|
|
@@ -7935,6 +7944,21 @@
|
|
|
7935
7944
|
return getUint32(getDataView(signatureArray), 0) == SPLIT_ZIP_FILE_SIGNATURE;
|
|
7936
7945
|
}
|
|
7937
7946
|
|
|
7947
|
+
function removeExtraFieldZip64(rawExtraField) {
|
|
7948
|
+
const rawExtraFieldView = getDataView(rawExtraField);
|
|
7949
|
+
let offsetExtraField = 0;
|
|
7950
|
+
while (offsetExtraField + 4 <= getLength(rawExtraField)) {
|
|
7951
|
+
const size = 4 + getUint16(rawExtraFieldView, offsetExtraField + 2);
|
|
7952
|
+
if (getUint16(rawExtraFieldView, offsetExtraField) == EXTRAFIELD_TYPE_ZIP64) {
|
|
7953
|
+
return removeExtraFieldZip64(concat(
|
|
7954
|
+
rawExtraField.subarray(0, offsetExtraField),
|
|
7955
|
+
rawExtraField.subarray(Math.min(offsetExtraField + size, getLength(rawExtraField)))));
|
|
7956
|
+
}
|
|
7957
|
+
offsetExtraField += size;
|
|
7958
|
+
}
|
|
7959
|
+
return rawExtraField;
|
|
7960
|
+
}
|
|
7961
|
+
|
|
7938
7962
|
async function copyZipData(zipWriter, reader, entries, directoryOffset) {
|
|
7939
7963
|
const { writer } = zipWriter;
|
|
7940
7964
|
const entryPositions = new Map();
|
|
@@ -9867,7 +9891,7 @@
|
|
|
9867
9891
|
} else if (writer.constructor == BlobWriter) {
|
|
9868
9892
|
return data.type == contentType;
|
|
9869
9893
|
} else if (writer.constructor == Data64URIWriter) {
|
|
9870
|
-
return data.startsWith(
|
|
9894
|
+
return data.startsWith("data:" + (contentType || "") + ";base64,");
|
|
9871
9895
|
} else {
|
|
9872
9896
|
return true;
|
|
9873
9897
|
}
|
|
@@ -10540,6 +10564,7 @@
|
|
|
10540
10564
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
10541
10565
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
10542
10566
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
10567
|
+
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
10543
10568
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
10544
10569
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
10545
10570
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|