@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-native.js
CHANGED
|
@@ -6025,32 +6025,27 @@
|
|
|
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
|
-
const
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6046
|
-
} else {
|
|
6047
|
-
signature = false;
|
|
6031
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6032
|
+
let localDataDescriptor;
|
|
6033
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6034
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6035
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6036
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6037
|
+
localDataDescriptor = candidate;
|
|
6038
|
+
break;
|
|
6048
6039
|
}
|
|
6049
6040
|
}
|
|
6050
|
-
if (
|
|
6051
|
-
|
|
6052
|
-
|
|
6041
|
+
if (!localDataDescriptor) {
|
|
6042
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6043
|
+
}
|
|
6044
|
+
if (localDataDescriptor) {
|
|
6053
6045
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6046
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6047
|
+
} else {
|
|
6048
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6054
6049
|
}
|
|
6055
6050
|
}
|
|
6056
6051
|
const range = {
|
|
@@ -6115,18 +6110,31 @@
|
|
|
6115
6110
|
return mergedRanges;
|
|
6116
6111
|
}
|
|
6117
6112
|
|
|
6118
|
-
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
|
+
}
|
|
6119
6119
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6120
6120
|
let compressedSize;
|
|
6121
6121
|
let uncompressedSize;
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
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;
|
|
6128
6132
|
}
|
|
6129
|
-
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);
|
|
6130
6138
|
}
|
|
6131
6139
|
|
|
6132
6140
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9047,7 +9055,7 @@
|
|
|
9047
9055
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9048
9056
|
*/
|
|
9049
9057
|
|
|
9050
|
-
const VERSION = "2.18.
|
|
9058
|
+
const VERSION = "2.18.1";
|
|
9051
9059
|
|
|
9052
9060
|
/*
|
|
9053
9061
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|