@zip.js/zip.js 2.18.0 → 2.18.2
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 +33 -33
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +33 -33
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +33 -33
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +33 -33
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +33 -33
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +33 -33
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +33 -33
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +33 -33
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +33 -33
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +33 -33
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +33 -33
- package/index-native.min.js +1 -1
- package/index.cjs +33 -33
- package/index.d.cts +15 -2
- package/index.d.ts +15 -2
- package/index.min.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/zip-reader.js +32 -32
- package/package.json +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -6033,32 +6033,19 @@
|
|
|
6033
6033
|
}) {
|
|
6034
6034
|
let dataDescriptorLength = 0;
|
|
6035
6035
|
if (dataDescriptor) {
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
} else {
|
|
6039
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6040
|
-
}
|
|
6041
|
-
}
|
|
6042
|
-
if (dataDescriptorLength) {
|
|
6043
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6036
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6037
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6044
6038
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6052
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6053
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6054
|
-
} else {
|
|
6055
|
-
signature = false;
|
|
6056
|
-
}
|
|
6057
|
-
}
|
|
6058
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6059
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6060
|
-
localDataDescriptor.signature = signature;
|
|
6039
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6040
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6041
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6042
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6043
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6044
|
+
if (localDataDescriptor) {
|
|
6061
6045
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6046
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6047
|
+
} else {
|
|
6048
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6062
6049
|
}
|
|
6063
6050
|
}
|
|
6064
6051
|
const range = {
|
|
@@ -6123,18 +6110,31 @@
|
|
|
6123
6110
|
return mergedRanges;
|
|
6124
6111
|
}
|
|
6125
6112
|
|
|
6126
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6113
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6114
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6115
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6116
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6117
|
+
return UNDEFINED_VALUE;
|
|
6118
|
+
}
|
|
6127
6119
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6128
6120
|
let compressedSize;
|
|
6129
6121
|
let uncompressedSize;
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6122
|
+
try {
|
|
6123
|
+
if (zip64) {
|
|
6124
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6125
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6126
|
+
} else {
|
|
6127
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6128
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6129
|
+
}
|
|
6130
|
+
} catch {
|
|
6131
|
+
return UNDEFINED_VALUE;
|
|
6136
6132
|
}
|
|
6137
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6133
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6134
|
+
}
|
|
6135
|
+
|
|
6136
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6137
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6138
6138
|
}
|
|
6139
6139
|
|
|
6140
6140
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9055,7 +9055,7 @@
|
|
|
9055
9055
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9056
9056
|
*/
|
|
9057
9057
|
|
|
9058
|
-
const VERSION = "2.18.
|
|
9058
|
+
const VERSION = "2.18.2";
|
|
9059
9059
|
|
|
9060
9060
|
/*
|
|
9061
9061
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|