@zip.js/zip.js 2.18.0 → 2.18.2
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 +33 -33
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +33 -33
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +33 -33
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +33 -33
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +33 -33
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +33 -33
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +33 -33
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +33 -33
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +33 -33
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +33 -33
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +33 -33
- package/index-native.min.js +1 -1
- package/index.cjs +33 -33
- package/index.d.cts +15 -2
- package/index.d.ts +15 -2
- package/index.min.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/zip-reader.js +32 -32
- package/package.json +1 -1
package/dist/zip-core.js
CHANGED
|
@@ -6003,32 +6003,19 @@
|
|
|
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
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6022
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6023
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6024
|
-
} else {
|
|
6025
|
-
signature = false;
|
|
6026
|
-
}
|
|
6027
|
-
}
|
|
6028
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6029
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6030
|
-
localDataDescriptor.signature = signature;
|
|
6009
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6010
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6011
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6012
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6013
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6014
|
+
if (localDataDescriptor) {
|
|
6031
6015
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6016
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6017
|
+
} else {
|
|
6018
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6032
6019
|
}
|
|
6033
6020
|
}
|
|
6034
6021
|
const range = {
|
|
@@ -6093,18 +6080,31 @@
|
|
|
6093
6080
|
return mergedRanges;
|
|
6094
6081
|
}
|
|
6095
6082
|
|
|
6096
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6083
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6084
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6085
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6086
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6087
|
+
return UNDEFINED_VALUE;
|
|
6088
|
+
}
|
|
6097
6089
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6098
6090
|
let compressedSize;
|
|
6099
6091
|
let uncompressedSize;
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6092
|
+
try {
|
|
6093
|
+
if (zip64) {
|
|
6094
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6095
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6096
|
+
} else {
|
|
6097
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6098
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6099
|
+
}
|
|
6100
|
+
} catch {
|
|
6101
|
+
return UNDEFINED_VALUE;
|
|
6106
6102
|
}
|
|
6107
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6103
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6104
|
+
}
|
|
6105
|
+
|
|
6106
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6107
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6108
6108
|
}
|
|
6109
6109
|
|
|
6110
6110
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -8927,7 +8927,7 @@
|
|
|
8927
8927
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8928
8928
|
*/
|
|
8929
8929
|
|
|
8930
|
-
const VERSION = "2.18.
|
|
8930
|
+
const VERSION = "2.18.2";
|
|
8931
8931
|
|
|
8932
8932
|
/*
|
|
8933
8933
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|