@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-native.js
CHANGED
|
@@ -6025,32 +6025,19 @@
|
|
|
6025
6025
|
}) {
|
|
6026
6026
|
let dataDescriptorLength = 0;
|
|
6027
6027
|
if (dataDescriptor) {
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
} else {
|
|
6031
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6032
|
-
}
|
|
6033
|
-
}
|
|
6034
|
-
if (dataDescriptorLength) {
|
|
6035
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6028
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6029
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6036
6030
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6044
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6045
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6046
|
-
} else {
|
|
6047
|
-
signature = false;
|
|
6048
|
-
}
|
|
6049
|
-
}
|
|
6050
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6051
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6052
|
-
localDataDescriptor.signature = signature;
|
|
6031
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6032
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6033
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6034
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6035
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6036
|
+
if (localDataDescriptor) {
|
|
6053
6037
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6038
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6039
|
+
} else {
|
|
6040
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6054
6041
|
}
|
|
6055
6042
|
}
|
|
6056
6043
|
const range = {
|
|
@@ -6115,18 +6102,31 @@
|
|
|
6115
6102
|
return mergedRanges;
|
|
6116
6103
|
}
|
|
6117
6104
|
|
|
6118
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6105
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6106
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6107
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6108
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6109
|
+
return UNDEFINED_VALUE;
|
|
6110
|
+
}
|
|
6119
6111
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6120
6112
|
let compressedSize;
|
|
6121
6113
|
let uncompressedSize;
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6114
|
+
try {
|
|
6115
|
+
if (zip64) {
|
|
6116
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6117
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6118
|
+
} else {
|
|
6119
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6120
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6121
|
+
}
|
|
6122
|
+
} catch {
|
|
6123
|
+
return UNDEFINED_VALUE;
|
|
6128
6124
|
}
|
|
6129
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6125
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6126
|
+
}
|
|
6127
|
+
|
|
6128
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6129
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6130
6130
|
}
|
|
6131
6131
|
|
|
6132
6132
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9047,7 +9047,7 @@
|
|
|
9047
9047
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9048
9048
|
*/
|
|
9049
9049
|
|
|
9050
|
-
const VERSION = "2.18.
|
|
9050
|
+
const VERSION = "2.18.2";
|
|
9051
9051
|
|
|
9052
9052
|
/*
|
|
9053
9053
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|