@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-legacy.js
CHANGED
|
@@ -6005,32 +6005,27 @@
|
|
|
6005
6005
|
}) {
|
|
6006
6006
|
let dataDescriptorLength = 0;
|
|
6007
6007
|
if (dataDescriptor) {
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
} else {
|
|
6011
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
if (dataDescriptorLength) {
|
|
6015
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6008
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6009
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6016
6010
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
const
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6026
|
-
} else {
|
|
6027
|
-
signature = false;
|
|
6011
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6012
|
+
let localDataDescriptor;
|
|
6013
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6014
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6015
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6016
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6017
|
+
localDataDescriptor = candidate;
|
|
6018
|
+
break;
|
|
6028
6019
|
}
|
|
6029
6020
|
}
|
|
6030
|
-
if (
|
|
6031
|
-
|
|
6032
|
-
|
|
6021
|
+
if (!localDataDescriptor) {
|
|
6022
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6023
|
+
}
|
|
6024
|
+
if (localDataDescriptor) {
|
|
6033
6025
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6026
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6027
|
+
} else {
|
|
6028
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6034
6029
|
}
|
|
6035
6030
|
}
|
|
6036
6031
|
const range = {
|
|
@@ -6095,18 +6090,31 @@
|
|
|
6095
6090
|
return mergedRanges;
|
|
6096
6091
|
}
|
|
6097
6092
|
|
|
6098
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6093
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6094
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6095
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6096
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6097
|
+
return UNDEFINED_VALUE;
|
|
6098
|
+
}
|
|
6099
6099
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6100
6100
|
let compressedSize;
|
|
6101
6101
|
let uncompressedSize;
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6102
|
+
try {
|
|
6103
|
+
if (zip64) {
|
|
6104
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6105
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6106
|
+
} else {
|
|
6107
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6108
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6109
|
+
}
|
|
6110
|
+
} catch {
|
|
6111
|
+
return UNDEFINED_VALUE;
|
|
6108
6112
|
}
|
|
6109
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6113
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6116
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6117
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6110
6118
|
}
|
|
6111
6119
|
|
|
6112
6120
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8929,7 +8937,7 @@
|
|
|
8929
8937
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8930
8938
|
*/
|
|
8931
8939
|
|
|
8932
|
-
const VERSION = "2.18.
|
|
8940
|
+
const VERSION = "2.18.1";
|
|
8933
8941
|
|
|
8934
8942
|
/*
|
|
8935
8943
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|