@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-native.js
CHANGED
|
@@ -4729,6 +4729,7 @@
|
|
|
4729
4729
|
const ERR_INVALID_STRICTNESS = "Invalid strictness (must be 'strict', 'balanced' or 'tolerant')";
|
|
4730
4730
|
const ERR_INVALID_FILENAME_VALIDATION = "Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')";
|
|
4731
4731
|
const ERR_INVALID_MAX_APPENDED_DATA_SIZE = "Invalid maxAppendedDataSize (must be a number greater than or equal to 0)";
|
|
4732
|
+
const ERR_UNSUPPORTED_UINT64 = "64-bit value exceeds Number.MAX_SAFE_INTEGER";
|
|
4732
4733
|
const DRIVE_LETTER_REGEXP = /^[a-zA-Z]:/;
|
|
4733
4734
|
const CHARSET_UTF8 = "utf-8";
|
|
4734
4735
|
const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
|
|
@@ -4751,6 +4752,7 @@
|
|
|
4751
4752
|
bytes: 8
|
|
4752
4753
|
}
|
|
4753
4754
|
};
|
|
4755
|
+
const MAX_SAFE_UINT64 = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4754
4756
|
const MAX_END_OF_CENTRAL_DIR_PROBES = 64;
|
|
4755
4757
|
const MAX_DEFLATE_EXPANSION_RATIO = 1032;
|
|
4756
4758
|
const CENTRAL_DIRECTORY_UNREACHABLE = 0;
|
|
@@ -4846,7 +4848,7 @@
|
|
|
4846
4848
|
zip64EndOfDirectoryVersion2 = getBigUint64(endOfDirectoryView, 4) > ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12;
|
|
4847
4849
|
if (zip64EndOfDirectoryVersion2) {
|
|
4848
4850
|
const extensibleDataLength = Math.min(
|
|
4849
|
-
|
|
4851
|
+
getBigUint64(endOfDirectoryView, 4) - (ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12),
|
|
4850
4852
|
reader.size - directoryDataOffset - ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4851
4853
|
if (extensibleDataLength > 0) {
|
|
4852
4854
|
zip64EndOfDirectoryLength += extensibleDataLength;
|
|
@@ -5427,8 +5429,8 @@
|
|
|
5427
5429
|
const hashDataLength = getUint16$1(extensibleDataView, 26);
|
|
5428
5430
|
Object.assign(directoryEncryptionInfo, {
|
|
5429
5431
|
compressionMethod: getUint16$1(extensibleDataView, 0),
|
|
5430
|
-
compressedSize:
|
|
5431
|
-
uncompressedSize:
|
|
5432
|
+
compressedSize: getBigUint64(extensibleDataView, 2),
|
|
5433
|
+
uncompressedSize: getBigUint64(extensibleDataView, 10),
|
|
5432
5434
|
encryptionAlgorithm: getUint16$1(extensibleDataView, 18),
|
|
5433
5435
|
bitLength: getUint16$1(extensibleDataView, 20),
|
|
5434
5436
|
flags: getUint16$1(extensibleDataView, 22),
|
|
@@ -6063,7 +6065,11 @@
|
|
|
6063
6065
|
}
|
|
6064
6066
|
|
|
6065
6067
|
function getBigUint64(view, offset) {
|
|
6066
|
-
|
|
6068
|
+
const value = view.getBigUint64(offset, true);
|
|
6069
|
+
if (value > MAX_SAFE_UINT64) {
|
|
6070
|
+
throw new Error(ERR_UNSUPPORTED_UINT64);
|
|
6071
|
+
}
|
|
6072
|
+
return Number(value);
|
|
6067
6073
|
}
|
|
6068
6074
|
|
|
6069
6075
|
var zipReader = /*#__PURE__*/Object.freeze({
|
|
@@ -6092,6 +6098,7 @@
|
|
|
6092
6098
|
ERR_UNSAFE_FILENAME: ERR_UNSAFE_FILENAME,
|
|
6093
6099
|
ERR_UNSUPPORTED_COMPRESSION: ERR_UNSUPPORTED_COMPRESSION$1,
|
|
6094
6100
|
ERR_UNSUPPORTED_ENCRYPTION: ERR_UNSUPPORTED_ENCRYPTION,
|
|
6101
|
+
ERR_UNSUPPORTED_UINT64: ERR_UNSUPPORTED_UINT64,
|
|
6095
6102
|
ERR_WORKER_STARTUP_TIMEOUT: ERR_WORKER_STARTUP_TIMEOUT,
|
|
6096
6103
|
ZipReader: ZipReader,
|
|
6097
6104
|
ZipReaderStream: ZipReaderStream
|
|
@@ -6232,7 +6239,7 @@
|
|
|
6232
6239
|
encrypted,
|
|
6233
6240
|
uncompressedSize,
|
|
6234
6241
|
compressedSize,
|
|
6235
|
-
|
|
6242
|
+
extraFieldZip64
|
|
6236
6243
|
} = entry;
|
|
6237
6244
|
let {
|
|
6238
6245
|
compressionMethod,
|
|
@@ -6249,13 +6256,13 @@
|
|
|
6249
6256
|
rawExtraFieldExtendedTimestamp = rawExtraFieldExtendedTimestamp || EMPTY_UINT8_ARRAY;
|
|
6250
6257
|
rawExtraFieldNTFS = rawExtraFieldNTFS || EMPTY_UINT8_ARRAY;
|
|
6251
6258
|
rawExtraFieldUnix = rawExtraFieldUnix || EMPTY_UINT8_ARRAY;
|
|
6252
|
-
rawExtraField = rawExtraField || EMPTY_UINT8_ARRAY;
|
|
6259
|
+
rawExtraField = removeExtraFieldZip64(rawExtraField || EMPTY_UINT8_ARRAY);
|
|
6253
6260
|
if (entry.extraFieldAES) {
|
|
6254
6261
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
6255
6262
|
}
|
|
6256
6263
|
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
|
|
6257
|
-
const zip64UncompressedSize =
|
|
6258
|
-
const zip64CompressedSize =
|
|
6264
|
+
const zip64UncompressedSize = Boolean(extraFieldZip64) && extraFieldZip64.uncompressedSize !== UNDEFINED_VALUE;
|
|
6265
|
+
const zip64CompressedSize = Boolean(extraFieldZip64) && extraFieldZip64.compressedSize !== UNDEFINED_VALUE;
|
|
6259
6266
|
const bitFlagValue = (getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted, compressionMethod) & ~BITFLAG_LEVEL) | (level << 1);
|
|
6260
6267
|
const {
|
|
6261
6268
|
headerArray,
|
|
@@ -6811,6 +6818,10 @@
|
|
|
6811
6818
|
maximumCompressedSize = contentSize === UNDEFINED_VALUE ? getMaximumCompressedSize(uncompressedSize) + encryptionOverhead : contentSize;
|
|
6812
6819
|
}
|
|
6813
6820
|
}
|
|
6821
|
+
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !passThrough)) && !isCompressed(compressionMethod, level);
|
|
6822
|
+
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
6823
|
+
dataDescriptor = false;
|
|
6824
|
+
}
|
|
6814
6825
|
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
6815
6826
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
6816
6827
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
@@ -6825,6 +6836,7 @@
|
|
|
6825
6836
|
maximumCompressedSize,
|
|
6826
6837
|
resolvedOptions: {
|
|
6827
6838
|
dataDescriptor,
|
|
6839
|
+
emptyEntry,
|
|
6828
6840
|
zip64,
|
|
6829
6841
|
zip64UncompressedSize,
|
|
6830
6842
|
zip64CompressedSize,
|
|
@@ -6923,6 +6935,7 @@
|
|
|
6923
6935
|
const {
|
|
6924
6936
|
keepOrder,
|
|
6925
6937
|
dataDescriptor,
|
|
6938
|
+
emptyEntry,
|
|
6926
6939
|
signal
|
|
6927
6940
|
} = options;
|
|
6928
6941
|
const {
|
|
@@ -6947,7 +6960,7 @@
|
|
|
6947
6960
|
lockPreviousFileEntry = previousFileEntry && previousFileEntry.lockFileEntry;
|
|
6948
6961
|
requestLockCurrentFileEntry();
|
|
6949
6962
|
}
|
|
6950
|
-
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || !dataDescriptor) {
|
|
6963
|
+
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || (!dataDescriptor && !emptyEntry)) {
|
|
6951
6964
|
bufferedWrite = true;
|
|
6952
6965
|
zipWriter.bufferedWrites++;
|
|
6953
6966
|
if (options.createTempStream) {
|
|
@@ -7369,8 +7382,8 @@
|
|
|
7369
7382
|
try {
|
|
7370
7383
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7371
7384
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE$1 && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7372
|
-
const uidBytes = packUnixId(uid);
|
|
7373
|
-
const gidBytes = packUnixId(gid);
|
|
7385
|
+
const uidBytes = packUnixId(uid === UNDEFINED_VALUE ? 0 : uid);
|
|
7386
|
+
const gidBytes = packUnixId(gid === UNDEFINED_VALUE ? 0 : gid);
|
|
7374
7387
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
7375
7388
|
const extraFieldUnix = createRecordWriter(4 + payloadLength);
|
|
7376
7389
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_INFOZIP);
|
|
@@ -7501,18 +7514,14 @@
|
|
|
7501
7514
|
}
|
|
7502
7515
|
|
|
7503
7516
|
function packUnixId(id) {
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
let length = 4;
|
|
7511
|
-
while (length > 1 && dataArray[length - 1] === 0) {
|
|
7512
|
-
length--;
|
|
7513
|
-
}
|
|
7514
|
-
return dataArray.subarray(0, length);
|
|
7517
|
+
const dataArray = new Uint8Array(4);
|
|
7518
|
+
const dataView = getDataView(dataArray);
|
|
7519
|
+
dataView.setUint32(0, id, true);
|
|
7520
|
+
let length = 4;
|
|
7521
|
+
while (length > 1 && dataArray[length - 1] === 0) {
|
|
7522
|
+
length--;
|
|
7515
7523
|
}
|
|
7524
|
+
return dataArray.subarray(0, length);
|
|
7516
7525
|
}
|
|
7517
7526
|
|
|
7518
7527
|
function normalizeMsdosAttributes(msdosAttributesRaw, msdosAttributes) {
|
|
@@ -7931,6 +7940,21 @@
|
|
|
7931
7940
|
return getUint32(getDataView(signatureArray), 0) == SPLIT_ZIP_FILE_SIGNATURE;
|
|
7932
7941
|
}
|
|
7933
7942
|
|
|
7943
|
+
function removeExtraFieldZip64(rawExtraField) {
|
|
7944
|
+
const rawExtraFieldView = getDataView(rawExtraField);
|
|
7945
|
+
let offsetExtraField = 0;
|
|
7946
|
+
while (offsetExtraField + 4 <= getLength(rawExtraField)) {
|
|
7947
|
+
const size = 4 + getUint16(rawExtraFieldView, offsetExtraField + 2);
|
|
7948
|
+
if (getUint16(rawExtraFieldView, offsetExtraField) == EXTRAFIELD_TYPE_ZIP64) {
|
|
7949
|
+
return removeExtraFieldZip64(concat(
|
|
7950
|
+
rawExtraField.subarray(0, offsetExtraField),
|
|
7951
|
+
rawExtraField.subarray(Math.min(offsetExtraField + size, getLength(rawExtraField)))));
|
|
7952
|
+
}
|
|
7953
|
+
offsetExtraField += size;
|
|
7954
|
+
}
|
|
7955
|
+
return rawExtraField;
|
|
7956
|
+
}
|
|
7957
|
+
|
|
7934
7958
|
async function copyZipData(zipWriter, reader, entries, directoryOffset) {
|
|
7935
7959
|
const { writer } = zipWriter;
|
|
7936
7960
|
const entryPositions = new Map();
|
|
@@ -9498,7 +9522,7 @@
|
|
|
9498
9522
|
} else if (writer.constructor == BlobWriter) {
|
|
9499
9523
|
return data.type == contentType;
|
|
9500
9524
|
} else if (writer.constructor == Data64URIWriter) {
|
|
9501
|
-
return data.startsWith(
|
|
9525
|
+
return data.startsWith("data:" + (contentType || "") + ";base64,");
|
|
9502
9526
|
} else {
|
|
9503
9527
|
return true;
|
|
9504
9528
|
}
|
|
@@ -10171,6 +10195,7 @@
|
|
|
10171
10195
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
10172
10196
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
10173
10197
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
10198
|
+
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
10174
10199
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
10175
10200
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
10176
10201
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|