@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/index.cjs
CHANGED
|
@@ -6027,32 +6027,19 @@ async function detectOverlappingEntry({
|
|
|
6027
6027
|
}) {
|
|
6028
6028
|
let dataDescriptorLength = 0;
|
|
6029
6029
|
if (dataDescriptor) {
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
} else {
|
|
6033
|
-
dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
|
|
6034
|
-
}
|
|
6035
|
-
}
|
|
6036
|
-
if (dataDescriptorLength) {
|
|
6037
|
-
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6030
|
+
const zip64 = Boolean(extraFieldZip64);
|
|
6031
|
+
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6038
6032
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
signedDataDescriptor.compressedSize == compressedSize &&
|
|
6046
|
-
signedDataDescriptor.uncompressedSize == uncompressedSize) {
|
|
6047
|
-
dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
|
|
6048
|
-
} else {
|
|
6049
|
-
signature = false;
|
|
6050
|
-
}
|
|
6051
|
-
}
|
|
6052
|
-
if (dataDescriptorArray.length >= dataDescriptorLength) {
|
|
6053
|
-
const localDataDescriptor = readDataDescriptor(dataDescriptorView, signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0, extraFieldZip64);
|
|
6054
|
-
localDataDescriptor.signature = signature;
|
|
6033
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6034
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6035
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6036
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6037
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6038
|
+
if (localDataDescriptor) {
|
|
6055
6039
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6040
|
+
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
6041
|
+
} else {
|
|
6042
|
+
dataDescriptorLength = getDataDescriptorLength(zip64, false);
|
|
6056
6043
|
}
|
|
6057
6044
|
}
|
|
6058
6045
|
const range = {
|
|
@@ -6117,18 +6104,31 @@ function mergeRanges(sortedRanges, pendingRanges) {
|
|
|
6117
6104
|
return mergedRanges;
|
|
6118
6105
|
}
|
|
6119
6106
|
|
|
6120
|
-
function readDataDescriptor(dataDescriptorView,
|
|
6107
|
+
function readDataDescriptor(dataDescriptorView, zip64, signature) {
|
|
6108
|
+
const offset = signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0;
|
|
6109
|
+
if (dataDescriptorView.byteLength < getDataDescriptorLength(zip64, signature) ||
|
|
6110
|
+
(signature && getUint32$1(dataDescriptorView, 0) != DATA_DESCRIPTOR_RECORD_SIGNATURE)) {
|
|
6111
|
+
return UNDEFINED_VALUE;
|
|
6112
|
+
}
|
|
6121
6113
|
const crc32 = getUint32$1(dataDescriptorView, offset);
|
|
6122
6114
|
let compressedSize;
|
|
6123
6115
|
let uncompressedSize;
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6116
|
+
try {
|
|
6117
|
+
if (zip64) {
|
|
6118
|
+
compressedSize = getBigUint64(dataDescriptorView, offset + 4);
|
|
6119
|
+
uncompressedSize = getBigUint64(dataDescriptorView, offset + 12);
|
|
6120
|
+
} else {
|
|
6121
|
+
compressedSize = getUint32$1(dataDescriptorView, offset + 4);
|
|
6122
|
+
uncompressedSize = getUint32$1(dataDescriptorView, offset + 8);
|
|
6123
|
+
}
|
|
6124
|
+
} catch {
|
|
6125
|
+
return UNDEFINED_VALUE;
|
|
6130
6126
|
}
|
|
6131
|
-
return { crc32, compressedSize, uncompressedSize };
|
|
6127
|
+
return { signature, zip64, crc32, compressedSize, uncompressedSize };
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
function getDataDescriptorLength(zip64, signature) {
|
|
6131
|
+
return (zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH) + (signature ? DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH : 0);
|
|
6132
6132
|
}
|
|
6133
6133
|
|
|
6134
6134
|
function getDiskOffset$1(reader, diskNumber) {
|
|
@@ -9049,7 +9049,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9049
9049
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9050
9050
|
*/
|
|
9051
9051
|
|
|
9052
|
-
const VERSION = "2.18.
|
|
9052
|
+
const VERSION = "2.18.2";
|
|
9053
9053
|
|
|
9054
9054
|
/*
|
|
9055
9055
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
package/index.d.cts
CHANGED
|
@@ -2240,10 +2240,23 @@ export interface LocalDataDescriptor {
|
|
|
2240
2240
|
* `true` if the record is preceded by its optional signature.
|
|
2241
2241
|
*
|
|
2242
2242
|
* The signature is not part of the original format, it is a later convention writers are free to follow. It is
|
|
2243
|
-
*
|
|
2244
|
-
*
|
|
2243
|
+
* `false` when the record is read as starting at its first byte, see {@link LocalDataDescriptor#zip64} for how the
|
|
2244
|
+
* layout is chosen.
|
|
2245
2245
|
*/
|
|
2246
2246
|
signature: boolean;
|
|
2247
|
+
/**
|
|
2248
|
+
* `true` if the sizes are stored as 8-byte values.
|
|
2249
|
+
*
|
|
2250
|
+
* Neither record tells the width reliably: the local file header is written before a streaming writer knows the
|
|
2251
|
+
* sizes, and the Zip64 extra field of the central directory record, written last, describes that record, not the
|
|
2252
|
+
* descriptor, so e.g. an entry placed past 4 GB can carry a Zip64 extra field in its central directory record for
|
|
2253
|
+
* its offset alone and a descriptor with 4-byte sizes. The record is therefore read with the layout, among the two
|
|
2254
|
+
* widths with and without the signature, whose sizes agree with the central directory, its CRC-32 too when the
|
|
2255
|
+
* central directory stores one and several layouts qualify; when none does, the width announced by the Zip64 extra
|
|
2256
|
+
* field of the local file header or of the central directory record is used, with the signature when the record
|
|
2257
|
+
* starts with one.
|
|
2258
|
+
*/
|
|
2259
|
+
zip64: boolean;
|
|
2247
2260
|
/**
|
|
2248
2261
|
* The CRC-32 checksum stored in the record, which is allowed to differ from {@link EntryMetaData#crc32}.
|
|
2249
2262
|
*/
|
package/index.d.ts
CHANGED
|
@@ -2240,10 +2240,23 @@ export interface LocalDataDescriptor {
|
|
|
2240
2240
|
* `true` if the record is preceded by its optional signature.
|
|
2241
2241
|
*
|
|
2242
2242
|
* The signature is not part of the original format, it is a later convention writers are free to follow. It is
|
|
2243
|
-
*
|
|
2244
|
-
*
|
|
2243
|
+
* `false` when the record is read as starting at its first byte, see {@link LocalDataDescriptor#zip64} for how the
|
|
2244
|
+
* layout is chosen.
|
|
2245
2245
|
*/
|
|
2246
2246
|
signature: boolean;
|
|
2247
|
+
/**
|
|
2248
|
+
* `true` if the sizes are stored as 8-byte values.
|
|
2249
|
+
*
|
|
2250
|
+
* Neither record tells the width reliably: the local file header is written before a streaming writer knows the
|
|
2251
|
+
* sizes, and the Zip64 extra field of the central directory record, written last, describes that record, not the
|
|
2252
|
+
* descriptor, so e.g. an entry placed past 4 GB can carry a Zip64 extra field in its central directory record for
|
|
2253
|
+
* its offset alone and a descriptor with 4-byte sizes. The record is therefore read with the layout, among the two
|
|
2254
|
+
* widths with and without the signature, whose sizes agree with the central directory, its CRC-32 too when the
|
|
2255
|
+
* central directory stores one and several layouts qualify; when none does, the width announced by the Zip64 extra
|
|
2256
|
+
* field of the local file header or of the central directory record is used, with the signature when the record
|
|
2257
|
+
* starts with one.
|
|
2258
|
+
*/
|
|
2259
|
+
zip64: boolean;
|
|
2247
2260
|
/**
|
|
2248
2261
|
* The CRC-32 checksum stored in the record, which is allowed to differ from {@link EntryMetaData#crc32}.
|
|
2249
2262
|
*/
|