@zip.js/zip.js 2.11.2 → 2.11.4
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/BENCHMARKS.md +146 -38
- package/deno.json +1 -1
- package/dist/zip-core-external.js +80 -36
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +82 -36
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +87 -41
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +89 -41
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +87 -41
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +89 -41
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +89 -41
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +82 -36
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +82 -36
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +82 -36
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +88 -40
- package/index-native.min.js +1 -1
- package/index.cjs +88 -40
- package/index.d.cts +39 -2
- package/index.d.ts +39 -2
- package/index.min.js +1 -1
- package/lib/core/io.js +7 -5
- package/lib/core/options.js +13 -0
- package/lib/core/version.js +1 -1
- package/lib/core/zip-fs.js +5 -5
- package/lib/core/zip-reader.js +20 -17
- package/lib/core/zip-writer.js +50 -13
- package/lib/zip-core-writer.js +2 -0
- package/package.json +1 -1
package/index-native.cjs
CHANGED
|
@@ -211,6 +211,8 @@ const STRICTNESS_TOLERANT = "tolerant";
|
|
|
211
211
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
212
212
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
213
213
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
214
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
215
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
214
216
|
|
|
215
217
|
function checkFunctionOption(value) {
|
|
216
218
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -226,6 +228,12 @@ function checkSignalOption(signal) {
|
|
|
226
228
|
return signal || UNDEFINED_VALUE;
|
|
227
229
|
}
|
|
228
230
|
|
|
231
|
+
function throwIfAborted(signal) {
|
|
232
|
+
if (signal && signal.aborted) {
|
|
233
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
229
237
|
function checkPasswordOption(password, rawPassword) {
|
|
230
238
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
231
239
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3750,11 +3758,13 @@ class BlobReader extends Reader {
|
|
|
3750
3758
|
const reader = this;
|
|
3751
3759
|
const { sourceBlob, size } = reader;
|
|
3752
3760
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3753
|
-
if (
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3761
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3762
|
+
if (!offset && readSize >= size) {
|
|
3763
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3764
|
+
}
|
|
3765
|
+
if (blobSliceReliable) {
|
|
3766
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3767
|
+
}
|
|
3758
3768
|
}
|
|
3759
3769
|
return super.createReadable(options);
|
|
3760
3770
|
}
|
|
@@ -5190,27 +5200,28 @@ class ZipReaderStream {
|
|
|
5190
5200
|
const { done, value } = await gen.next();
|
|
5191
5201
|
if (done)
|
|
5192
5202
|
return controller.close();
|
|
5193
|
-
const
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
return readable;
|
|
5200
|
-
}
|
|
5203
|
+
const entryReadable = (function () {
|
|
5204
|
+
const { readable, writable } = new TransformStream();
|
|
5205
|
+
if (value.getData) {
|
|
5206
|
+
getData();
|
|
5207
|
+
return readable;
|
|
5208
|
+
}
|
|
5201
5209
|
|
|
5202
|
-
|
|
5210
|
+
async function getData() {
|
|
5211
|
+
try {
|
|
5212
|
+
await value.getData(writable);
|
|
5213
|
+
} catch (error) {
|
|
5203
5214
|
try {
|
|
5204
|
-
await
|
|
5205
|
-
} catch
|
|
5206
|
-
|
|
5207
|
-
await writable.abort(error);
|
|
5208
|
-
} catch {
|
|
5209
|
-
// ignored
|
|
5210
|
-
}
|
|
5215
|
+
await writable.abort(error);
|
|
5216
|
+
} catch {
|
|
5217
|
+
// ignored
|
|
5211
5218
|
}
|
|
5212
5219
|
}
|
|
5213
|
-
}
|
|
5220
|
+
}
|
|
5221
|
+
})();
|
|
5222
|
+
const chunk = {
|
|
5223
|
+
...value,
|
|
5224
|
+
readable: entryReadable
|
|
5214
5225
|
};
|
|
5215
5226
|
delete chunk.getData;
|
|
5216
5227
|
controller.enqueue(chunk);
|
|
@@ -5356,6 +5367,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5356
5367
|
const size = compressedSize;
|
|
5357
5368
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5358
5369
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5370
|
+
throwIfAborted(signal);
|
|
5359
5371
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5360
5372
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5361
5373
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6262,6 +6274,7 @@ const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
|
|
|
6262
6274
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
6263
6275
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6264
6276
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6277
|
+
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6265
6278
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6266
6279
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6267
6280
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
@@ -6276,6 +6289,7 @@ const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
|
6276
6289
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6277
6290
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6278
6291
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6292
|
+
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
6279
6293
|
const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
|
|
6280
6294
|
const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
|
|
6281
6295
|
const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
|
|
@@ -6307,6 +6321,9 @@ class ZipWriter {
|
|
|
6307
6321
|
const addSplitZipSignature =
|
|
6308
6322
|
availableSize > 0 && availableSize !== INFINITY_VALUE &&
|
|
6309
6323
|
maxSize > 0 && maxSize !== INFINITY_VALUE;
|
|
6324
|
+
if (addSplitZipSignature && options[OPTION_USDZ]) {
|
|
6325
|
+
throw new Error(ERR_UNSUPPORTED_SPLIT_USDZ);
|
|
6326
|
+
}
|
|
6310
6327
|
Object.assign(this, {
|
|
6311
6328
|
writer,
|
|
6312
6329
|
addSplitZipSignature,
|
|
@@ -6422,6 +6439,7 @@ class ZipWriter {
|
|
|
6422
6439
|
}
|
|
6423
6440
|
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6424
6441
|
Object.assign(entry, {
|
|
6442
|
+
zip64Enabled: true,
|
|
6425
6443
|
zip64UncompressedSize,
|
|
6426
6444
|
zip64CompressedSize,
|
|
6427
6445
|
offset,
|
|
@@ -6880,6 +6898,7 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6880
6898
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6881
6899
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6882
6900
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6901
|
+
throwIfAborted(signal);
|
|
6883
6902
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6884
6903
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6885
6904
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -6997,6 +7016,9 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
|
|
|
6997
7016
|
if (reader) {
|
|
6998
7017
|
reader = new GenericReader(reader);
|
|
6999
7018
|
await initStream(reader);
|
|
7019
|
+
if (!reader.readable && !reader.readUint8Array) {
|
|
7020
|
+
throw new Error(ERR_INVALID_READER);
|
|
7021
|
+
}
|
|
7000
7022
|
({ size: contentSize } = reader);
|
|
7001
7023
|
}
|
|
7002
7024
|
return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
|
|
@@ -7007,6 +7029,7 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7007
7029
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7008
7030
|
let maximumCompressedSize = 0;
|
|
7009
7031
|
let uncompressedSize = 0;
|
|
7032
|
+
let unknownSize = false;
|
|
7010
7033
|
if (passThrough && hasContent) {
|
|
7011
7034
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7012
7035
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
@@ -7032,8 +7055,8 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7032
7055
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7033
7056
|
dataDescriptor = true;
|
|
7034
7057
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
7035
|
-
zip64 = true;
|
|
7036
|
-
|
|
7058
|
+
zip64 = unknownSize = true;
|
|
7059
|
+
maximumCompressedSize = MAX_32_BITS + 1;
|
|
7037
7060
|
}
|
|
7038
7061
|
} else {
|
|
7039
7062
|
options.uncompressedSize = uncompressedSize = contentSize;
|
|
@@ -7048,7 +7071,7 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7048
7071
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7049
7072
|
dataDescriptor = false;
|
|
7050
7073
|
}
|
|
7051
|
-
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
7074
|
+
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
7052
7075
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
7053
7076
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
7054
7077
|
if (zip64 === false) {
|
|
@@ -7064,6 +7087,8 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7064
7087
|
dataDescriptor,
|
|
7065
7088
|
emptyEntry,
|
|
7066
7089
|
zip64,
|
|
7090
|
+
zip64Enabled,
|
|
7091
|
+
unknownSize,
|
|
7067
7092
|
zip64UncompressedSize,
|
|
7068
7093
|
zip64CompressedSize,
|
|
7069
7094
|
uncompressedSize,
|
|
@@ -7137,7 +7162,7 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7137
7162
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7138
7163
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7139
7164
|
}
|
|
7140
|
-
const directoryDataLength = createDirectoryRecords(files);
|
|
7165
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(files);
|
|
7141
7166
|
let zip64 = getOptionValue(zipWriter, writerOptions, PROPERTY_NAME_ZIP64);
|
|
7142
7167
|
if (offset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || files.size >= MAX_16_BITS) {
|
|
7143
7168
|
if (zip64 === false) {
|
|
@@ -7145,6 +7170,8 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7145
7170
|
} else {
|
|
7146
7171
|
zip64 = true;
|
|
7147
7172
|
}
|
|
7173
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
7174
|
+
zip64 = true;
|
|
7148
7175
|
}
|
|
7149
7176
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7150
7177
|
}
|
|
@@ -7337,6 +7364,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7337
7364
|
rawPassword,
|
|
7338
7365
|
level,
|
|
7339
7366
|
zip64,
|
|
7367
|
+
zip64Enabled,
|
|
7340
7368
|
zip64UncompressedSize,
|
|
7341
7369
|
zip64CompressedSize,
|
|
7342
7370
|
zipCrypto,
|
|
@@ -7377,6 +7405,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7377
7405
|
lockFileEntry,
|
|
7378
7406
|
versionMadeBy,
|
|
7379
7407
|
zip64,
|
|
7408
|
+
zip64Enabled,
|
|
7380
7409
|
directory: Boolean(directory),
|
|
7381
7410
|
executable: Boolean(executable),
|
|
7382
7411
|
filenameUTF8: true,
|
|
@@ -7520,13 +7549,14 @@ function getHeaderInfo(options) {
|
|
|
7520
7549
|
zip64UncompressedSize,
|
|
7521
7550
|
zip64CompressedSize,
|
|
7522
7551
|
uncompressedSize,
|
|
7552
|
+
unknownSize,
|
|
7523
7553
|
crc32
|
|
7524
7554
|
} = options;
|
|
7525
7555
|
let { version, compressionMethod } = options;
|
|
7526
7556
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7527
7557
|
let rawLocalExtraFieldZip64;
|
|
7528
7558
|
const uncompressedFile = passThrough || !compressed;
|
|
7529
|
-
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
7559
|
+
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7530
7560
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7531
7561
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
7532
7562
|
const length = 4 + 16;
|
|
@@ -7660,6 +7690,10 @@ function getHeaderInfo(options) {
|
|
|
7660
7690
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
7661
7691
|
}
|
|
7662
7692
|
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7693
|
+
const clampedLastModDate = dosLastModDate < MIN_DATE ? MIN_DATE : dosLastModDate > MAX_DATE ? MAX_DATE : dosLastModDate;
|
|
7694
|
+
const storedLastModDate = getLength(rawExtraFieldExtendedTimestamp) ?
|
|
7695
|
+
new Date(getTimeUnix(lastModDate) * 1000) :
|
|
7696
|
+
getLength(rawExtraFieldNTFS) ? lastModDate : clampedLastModDate;
|
|
7663
7697
|
const {
|
|
7664
7698
|
headerArray,
|
|
7665
7699
|
headerView,
|
|
@@ -7669,7 +7703,7 @@ function getHeaderInfo(options) {
|
|
|
7669
7703
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
7670
7704
|
compressionMethod,
|
|
7671
7705
|
uncompressedSize,
|
|
7672
|
-
lastModDate:
|
|
7706
|
+
lastModDate: clampedLastModDate,
|
|
7673
7707
|
rawLastModDate: rawLastModDateOption,
|
|
7674
7708
|
rawFilename,
|
|
7675
7709
|
zip64CompressedSize,
|
|
@@ -7704,7 +7738,7 @@ function getHeaderInfo(options) {
|
|
|
7704
7738
|
localHeaderView,
|
|
7705
7739
|
headerArray,
|
|
7706
7740
|
headerView,
|
|
7707
|
-
lastModDate,
|
|
7741
|
+
lastModDate: storedLastModDate,
|
|
7708
7742
|
rawLastModDate,
|
|
7709
7743
|
encrypted,
|
|
7710
7744
|
compressed,
|
|
@@ -7876,14 +7910,15 @@ function updateLocalHeader({
|
|
|
7876
7910
|
|
|
7877
7911
|
|
|
7878
7912
|
async function closeFile(zipWriter, comment, options) {
|
|
7879
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7913
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(zipWriter.fileEntries);
|
|
7880
7914
|
const { directoryStart, directoryEnd, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7881
7915
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7882
|
-
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength });
|
|
7916
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength, zip64Entries });
|
|
7883
7917
|
}
|
|
7884
7918
|
|
|
7885
7919
|
function createDirectoryRecords(files) {
|
|
7886
7920
|
let directoryDataLength = 0;
|
|
7921
|
+
let zip64Entries = false;
|
|
7887
7922
|
for (const [, fileEntry] of files) {
|
|
7888
7923
|
const {
|
|
7889
7924
|
rawFilename,
|
|
@@ -7896,11 +7931,20 @@ function createDirectoryRecords(files) {
|
|
|
7896
7931
|
extendedTimestamp,
|
|
7897
7932
|
extraFieldExtendedTimestampFlag,
|
|
7898
7933
|
lastModDate,
|
|
7899
|
-
|
|
7900
|
-
zip64CompressedSize,
|
|
7934
|
+
zip64Enabled,
|
|
7901
7935
|
uncompressedSize,
|
|
7902
7936
|
compressedSize
|
|
7903
7937
|
} = fileEntry;
|
|
7938
|
+
let { zip64UncompressedSize, zip64CompressedSize } = fileEntry;
|
|
7939
|
+
if (!zip64Enabled) {
|
|
7940
|
+
if (zip64UncompressedSize && uncompressedSize < MAX_32_BITS) {
|
|
7941
|
+
zip64UncompressedSize = fileEntry.zip64UncompressedSize = false;
|
|
7942
|
+
}
|
|
7943
|
+
if (zip64CompressedSize && compressedSize < MAX_32_BITS) {
|
|
7944
|
+
zip64CompressedSize = fileEntry.zip64CompressedSize = false;
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
zip64Entries = zip64Entries || zip64UncompressedSize || zip64CompressedSize;
|
|
7904
7948
|
const zip64Offset = fileEntry.offset >= MAX_32_BITS;
|
|
7905
7949
|
const zip64DiskNumberStart = fileEntry.diskNumberStart >= MAX_16_BITS;
|
|
7906
7950
|
let rawExtraFieldZip64;
|
|
@@ -7954,7 +7998,7 @@ function createDirectoryRecords(files) {
|
|
|
7954
7998
|
}
|
|
7955
7999
|
directoryDataLength += CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
7956
8000
|
}
|
|
7957
|
-
return directoryDataLength;
|
|
8001
|
+
return { directoryDataLength, zip64Entries };
|
|
7958
8002
|
}
|
|
7959
8003
|
|
|
7960
8004
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
@@ -8074,7 +8118,7 @@ async function writeDigitalSignatureRecord(zipWriter, directoryArray, options) {
|
|
|
8074
8118
|
|
|
8075
8119
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
8076
8120
|
const { writer } = zipWriter;
|
|
8077
|
-
const { directoryStart, directoryEnd, signatureLength } = cdInfo;
|
|
8121
|
+
const { directoryStart, directoryEnd, signatureLength, zip64Entries } = cdInfo;
|
|
8078
8122
|
let { directoryDataLength } = cdInfo;
|
|
8079
8123
|
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
8080
8124
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -8094,6 +8138,8 @@ async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
|
8094
8138
|
} else {
|
|
8095
8139
|
zip64 = true;
|
|
8096
8140
|
}
|
|
8141
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
8142
|
+
zip64 = true;
|
|
8097
8143
|
}
|
|
8098
8144
|
const endOfdirectoryRecord = createRecordWriter(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
8099
8145
|
if (exceedsAvailableSize(writer, getLength(endOfdirectoryRecord.array) + commentLength)) {
|
|
@@ -8597,7 +8643,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8597
8643
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8598
8644
|
*/
|
|
8599
8645
|
|
|
8600
|
-
const VERSION = "2.11.
|
|
8646
|
+
const VERSION = "2.11.4";
|
|
8601
8647
|
|
|
8602
8648
|
/*
|
|
8603
8649
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9126,8 +9172,6 @@ const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.
|
|
|
9126
9172
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9127
9173
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9128
9174
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9129
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9130
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9131
9175
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9132
9176
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9133
9177
|
EXTRAFIELD_TYPE_ZIP64,
|
|
@@ -9621,12 +9665,14 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
9621
9665
|
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
9622
9666
|
options.bufferedWrite = true;
|
|
9623
9667
|
}
|
|
9624
|
-
const
|
|
9668
|
+
const children = zipEntry.getChildren({ recursive: true });
|
|
9669
|
+
const entries = children.filter(child => !isImplicitDirectory(child)).map(child => {
|
|
9625
9670
|
const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
|
|
9626
9671
|
return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
|
|
9627
9672
|
});
|
|
9628
9673
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
9629
|
-
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9674
|
+
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9675
|
+
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
9630
9676
|
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
9631
9677
|
}
|
|
9632
9678
|
|
|
@@ -10655,6 +10701,7 @@ exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
|
10655
10701
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
10656
10702
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
10657
10703
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
10704
|
+
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
10658
10705
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
10659
10706
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
10660
10707
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
@@ -10683,6 +10730,7 @@ exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
|
|
|
10683
10730
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
10684
10731
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
10685
10732
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
10733
|
+
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
10686
10734
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
10687
10735
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
10688
10736
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|