@zip.js/zip.js 2.18.0 → 2.18.1
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 +39 -31
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +39 -31
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +39 -31
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +39 -31
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +39 -31
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +39 -31
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +39 -31
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +39 -31
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +39 -31
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +39 -31
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +39 -31
- package/index-native.min.js +1 -1
- package/index.cjs +39 -31
- package/index.d.cts +12 -0
- package/index.d.ts +12 -0
- package/index.min.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/zip-reader.js +38 -30
- package/package.json +1 -1
package/dist/zip-fs-core.js
CHANGED
|
@@ -6023,32 +6023,27 @@
|
|
|
6023
6023
|
}) {
|
|
6024
6024
|
let dataDescriptorLength = 0;
|
|
6025
6025
|
if (dataDescriptor) {
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
} else {
|
|
6029
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6030
|
-
}
|
|
6031
|
-
}
|
|
6032
|
-
if (dataDescriptorLength) {
|
|
6033
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6026
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6027
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6034
6028
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
const
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6044
|
-
} else {
|
|
6045
|
-
signature = false;
|
|
6029
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6030
|
+
let localDataDescriptor;
|
|
6031
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6032
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6033
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6034
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6035
|
+
localDataDescriptor = candidate;
|
|
6036
|
+
break;
|
|
6046
6037
|
}
|
|
6047
6038
|
}
|
|
6048
|
-
if (
|
|
6049
|
-
|
|
6050
|
-
|
|
6039
|
+
if (!localDataDescriptor) {
|
|
6040
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6041
|
+
}
|
|
6042
|
+
if (localDataDescriptor) {
|
|
6051
6043
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6044
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6045
|
+
} else {
|
|
6046
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6052
6047
|
}
|
|
6053
6048
|
}
|
|
6054
6049
|
const range = {
|
|
@@ -6113,18 +6108,31 @@
|
|
|
6113
6108
|
return mergedRanges;
|
|
6114
6109
|
}
|
|
6115
6110
|
|
|
6116
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6111
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6112
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6113
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6114
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6115
|
+
return UNDEFINED_VALUE;
|
|
6116
|
+
}
|
|
6117
6117
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6118
6118
|
let compressedSize;
|
|
6119
6119
|
let uncompressedSize;
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6120
|
+
try {
|
|
6121
|
+
if (zip64) {
|
|
6122
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6123
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6124
|
+
} else {
|
|
6125
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6126
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6127
|
+
}
|
|
6128
|
+
} catch {
|
|
6129
|
+
return UNDEFINED_VALUE;
|
|
6126
6130
|
}
|
|
6127
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6131
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6135
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6128
6136
|
}
|
|
6129
6137
|
|
|
6130
6138
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9045,7 +9053,7 @@
|
|
|
9045
9053
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9046
9054
|
*/
|
|
9047
9055
|
|
|
9048
|
-
const VERSION = "2.18.
|
|
9056
|
+
const VERSION = "2.18.1";
|
|
9049
9057
|
|
|
9050
9058
|
/*
|
|
9051
9059
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|