@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.js
CHANGED
|
@@ -6033,32 +6033,27 @@
|
|
|
6033
6033
|
}) {
|
|
6034
6034
|
let dataDescriptorLength = 0;
|
|
6035
6035
|
if (dataDescriptor) {
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
} else {
|
|
6039
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6040
|
-
}
|
|
6041
|
-
}
|
|
6042
|
-
if (dataDescriptorLength) {
|
|
6043
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6036
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6037
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6044
6038
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
const
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6054
|
-
} else {
|
|
6055
|
-
signature = false;
|
|
6039
|
+
const ignoreCrc32 = fileEntry.encrypted && !fileEntry.zipCrypto;
|
|
6040
|
+
let localDataDescriptor;
|
|
6041
|
+
for (const [zip64Layout, signature] of [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]) {
|
|
6042
|
+
const candidate = readDataDescriptor(dataDescriptorView, zip64Layout, signature);
|
|
6043
|
+
if (candidate && (ignoreCrc32 || candidate.crc32 == crc32) &&
|
|
6044
|
+
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6045
|
+
localDataDescriptor = candidate;
|
|
6046
|
+
break;
|
|
6056
6047
|
}
|
|
6057
6048
|
}
|
|
6058
|
-
if (
|
|
6059
|
-
|
|
6060
|
-
|
|
6049
|
+
if (!localDataDescriptor) {
|
|
6050
|
+
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6051
|
+
}
|
|
6052
|
+
if (localDataDescriptor) {
|
|
6061
6053
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6054
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6055
|
+
} else {
|
|
6056
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6062
6057
|
}
|
|
6063
6058
|
}
|
|
6064
6059
|
const range = {
|
|
@@ -6123,18 +6118,31 @@
|
|
|
6123
6118
|
return mergedRanges;
|
|
6124
6119
|
}
|
|
6125
6120
|
|
|
6126
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6121
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6122
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6123
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6124
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6125
|
+
return UNDEFINED_VALUE;
|
|
6126
|
+
}
|
|
6127
6127
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6128
6128
|
let compressedSize;
|
|
6129
6129
|
let uncompressedSize;
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6130
|
+
try {
|
|
6131
|
+
if (zip64) {
|
|
6132
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6133
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6134
|
+
} else {
|
|
6135
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6136
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6137
|
+
}
|
|
6138
|
+
} catch {
|
|
6139
|
+
return UNDEFINED_VALUE;
|
|
6136
6140
|
}
|
|
6137
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6141
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6142
|
+
}
|
|
6143
|
+
|
|
6144
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6145
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6138
6146
|
}
|
|
6139
6147
|
|
|
6140
6148
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9055,7 +9063,7 @@
|
|
|
9055
9063
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9056
9064
|
*/
|
|
9057
9065
|
|
|
9058
|
-
const VERSION = "2.18.
|
|
9066
|
+
const VERSION = "2.18.1";
|
|
9059
9067
|
|
|
9060
9068
|
/*
|
|
9061
9069
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|