@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.js
CHANGED
|
@@ -6013,32 +6013,27 @@
|
|
|
6013
6013
|
}) {
|
|
6014
6014
|
let dataDescriptorLength = 0;
|
|
6015
6015
|
if (dataDescriptor) {
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
} else {
|
|
6019
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6020
|
-
}
|
|
6021
|
-
}
|
|
6022
|
-
if (dataDescriptorLength) {
|
|
6023
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6016
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6017
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6024
6018
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
const
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6034
|
-
} else {
|
|
6035
|
-
signature = false;
|
|
6019
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6020
|
+
let localDataDescriptor;
|
|
6021
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6022
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6023
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6024
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6025
|
+
localDataDescriptor = candidate;
|
|
6026
|
+
break;
|
|
6036
6027
|
}
|
|
6037
6028
|
}
|
|
6038
|
-
if (
|
|
6039
|
-
|
|
6040
|
-
|
|
6029
|
+
if (!localDataDescriptor) {
|
|
6030
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6031
|
+
}
|
|
6032
|
+
if (localDataDescriptor) {
|
|
6041
6033
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6034
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6035
|
+
} else {
|
|
6036
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6042
6037
|
}
|
|
6043
6038
|
}
|
|
6044
6039
|
const range = {
|
|
@@ -6103,18 +6098,31 @@
|
|
|
6103
6098
|
return mergedRanges;
|
|
6104
6099
|
}
|
|
6105
6100
|
|
|
6106
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6101
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6102
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6103
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6104
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6105
|
+
return UNDEFINED_VALUE;
|
|
6106
|
+
}
|
|
6107
6107
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6108
6108
|
let compressedSize;
|
|
6109
6109
|
let uncompressedSize;
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6110
|
+
try {
|
|
6111
|
+
if (zip64) {
|
|
6112
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6113
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6114
|
+
} else {
|
|
6115
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6116
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6117
|
+
}
|
|
6118
|
+
} catch {
|
|
6119
|
+
return UNDEFINED_VALUE;
|
|
6116
6120
|
}
|
|
6117
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6121
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6122
|
+
}
|
|
6123
|
+
|
|
6124
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6125
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6118
6126
|
}
|
|
6119
6127
|
|
|
6120
6128
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8937,7 +8945,7 @@
|
|
|
8937
8945
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8938
8946
|
*/
|
|
8939
8947
|
|
|
8940
|
-
const VERSION = "2.18.
|
|
8948
|
+
const VERSION = "2.18.1";
|
|
8941
8949
|
|
|
8942
8950
|
/*
|
|
8943
8951
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|