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