@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/dist/zip-fs-native.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zip = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker, Symbol, setTimeout, clearTimeout, structuredClone } = typeof globalThis !== 'undefined' ? globalThis :
|
|
7
|
+
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker, Symbol, setTimeout, clearTimeout, structuredClone } = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
8
8
|
|
|
9
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
10
|
/*
|
|
@@ -217,6 +217,8 @@
|
|
|
217
217
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
218
218
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
219
219
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
220
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
221
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
220
222
|
|
|
221
223
|
function checkFunctionOption(value) {
|
|
222
224
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -232,6 +234,12 @@
|
|
|
232
234
|
return signal || UNDEFINED_VALUE;
|
|
233
235
|
}
|
|
234
236
|
|
|
237
|
+
function throwIfAborted(signal) {
|
|
238
|
+
if (signal && signal.aborted) {
|
|
239
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
235
243
|
function checkPasswordOption(password, rawPassword) {
|
|
236
244
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
237
245
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3756,11 +3764,13 @@
|
|
|
3756
3764
|
const reader = this;
|
|
3757
3765
|
const { sourceBlob, size } = reader;
|
|
3758
3766
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3759
|
-
if (
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3767
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3768
|
+
if (!offset && readSize >= size) {
|
|
3769
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3770
|
+
}
|
|
3771
|
+
if (blobSliceReliable) {
|
|
3772
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3773
|
+
}
|
|
3764
3774
|
}
|
|
3765
3775
|
return super.createReadable(options);
|
|
3766
3776
|
}
|
|
@@ -5196,27 +5206,28 @@
|
|
|
5196
5206
|
const { done, value } = await gen.next();
|
|
5197
5207
|
if (done)
|
|
5198
5208
|
return controller.close();
|
|
5199
|
-
const
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
return readable;
|
|
5206
|
-
}
|
|
5209
|
+
const entryReadable = (function () {
|
|
5210
|
+
const { readable, writable } = new TransformStream();
|
|
5211
|
+
if (value.getData) {
|
|
5212
|
+
getData();
|
|
5213
|
+
return readable;
|
|
5214
|
+
}
|
|
5207
5215
|
|
|
5208
|
-
|
|
5216
|
+
async function getData() {
|
|
5217
|
+
try {
|
|
5218
|
+
await value.getData(writable);
|
|
5219
|
+
} catch (error) {
|
|
5209
5220
|
try {
|
|
5210
|
-
await
|
|
5211
|
-
} catch
|
|
5212
|
-
|
|
5213
|
-
await writable.abort(error);
|
|
5214
|
-
} catch {
|
|
5215
|
-
// ignored
|
|
5216
|
-
}
|
|
5221
|
+
await writable.abort(error);
|
|
5222
|
+
} catch {
|
|
5223
|
+
// ignored
|
|
5217
5224
|
}
|
|
5218
5225
|
}
|
|
5219
|
-
}
|
|
5226
|
+
}
|
|
5227
|
+
})();
|
|
5228
|
+
const chunk = {
|
|
5229
|
+
...value,
|
|
5230
|
+
readable: entryReadable
|
|
5220
5231
|
};
|
|
5221
5232
|
delete chunk.getData;
|
|
5222
5233
|
controller.enqueue(chunk);
|
|
@@ -5362,6 +5373,7 @@
|
|
|
5362
5373
|
const size = compressedSize;
|
|
5363
5374
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5364
5375
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5376
|
+
throwIfAborted(signal);
|
|
5365
5377
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5366
5378
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5367
5379
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6268,6 +6280,7 @@
|
|
|
6268
6280
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
6269
6281
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6270
6282
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6283
|
+
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6271
6284
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6272
6285
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6273
6286
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
@@ -6282,6 +6295,7 @@
|
|
|
6282
6295
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6283
6296
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6284
6297
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6298
|
+
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
6285
6299
|
const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
|
|
6286
6300
|
const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
|
|
6287
6301
|
const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
|
|
@@ -6313,6 +6327,9 @@
|
|
|
6313
6327
|
const addSplitZipSignature =
|
|
6314
6328
|
availableSize > 0 && availableSize !== INFINITY_VALUE &&
|
|
6315
6329
|
maxSize > 0 && maxSize !== INFINITY_VALUE;
|
|
6330
|
+
if (addSplitZipSignature && options[OPTION_USDZ]) {
|
|
6331
|
+
throw new Error(ERR_UNSUPPORTED_SPLIT_USDZ);
|
|
6332
|
+
}
|
|
6316
6333
|
Object.assign(this, {
|
|
6317
6334
|
writer,
|
|
6318
6335
|
addSplitZipSignature,
|
|
@@ -6428,6 +6445,7 @@
|
|
|
6428
6445
|
}
|
|
6429
6446
|
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6430
6447
|
Object.assign(entry, {
|
|
6448
|
+
zip64Enabled: true,
|
|
6431
6449
|
zip64UncompressedSize,
|
|
6432
6450
|
zip64CompressedSize,
|
|
6433
6451
|
offset,
|
|
@@ -6886,6 +6904,7 @@
|
|
|
6886
6904
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6887
6905
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6888
6906
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6907
|
+
throwIfAborted(signal);
|
|
6889
6908
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6890
6909
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6891
6910
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -7003,6 +7022,9 @@
|
|
|
7003
7022
|
if (reader) {
|
|
7004
7023
|
reader = new GenericReader(reader);
|
|
7005
7024
|
await initStream(reader);
|
|
7025
|
+
if (!reader.readable && !reader.readUint8Array) {
|
|
7026
|
+
throw new Error(ERR_INVALID_READER);
|
|
7027
|
+
}
|
|
7006
7028
|
({ size: contentSize } = reader);
|
|
7007
7029
|
}
|
|
7008
7030
|
return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
|
|
@@ -7013,6 +7035,7 @@
|
|
|
7013
7035
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7014
7036
|
let maximumCompressedSize = 0;
|
|
7015
7037
|
let uncompressedSize = 0;
|
|
7038
|
+
let unknownSize = false;
|
|
7016
7039
|
if (passThrough && hasContent) {
|
|
7017
7040
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7018
7041
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
@@ -7038,8 +7061,8 @@
|
|
|
7038
7061
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7039
7062
|
dataDescriptor = true;
|
|
7040
7063
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
7041
|
-
zip64 = true;
|
|
7042
|
-
|
|
7064
|
+
zip64 = unknownSize = true;
|
|
7065
|
+
maximumCompressedSize = MAX_32_BITS + 1;
|
|
7043
7066
|
}
|
|
7044
7067
|
} else {
|
|
7045
7068
|
options.uncompressedSize = uncompressedSize = contentSize;
|
|
@@ -7054,7 +7077,7 @@
|
|
|
7054
7077
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7055
7078
|
dataDescriptor = false;
|
|
7056
7079
|
}
|
|
7057
|
-
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
7080
|
+
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
7058
7081
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
7059
7082
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
7060
7083
|
if (zip64 === false) {
|
|
@@ -7070,6 +7093,8 @@
|
|
|
7070
7093
|
dataDescriptor,
|
|
7071
7094
|
emptyEntry,
|
|
7072
7095
|
zip64,
|
|
7096
|
+
zip64Enabled,
|
|
7097
|
+
unknownSize,
|
|
7073
7098
|
zip64UncompressedSize,
|
|
7074
7099
|
zip64CompressedSize,
|
|
7075
7100
|
uncompressedSize,
|
|
@@ -7143,7 +7168,7 @@
|
|
|
7143
7168
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7144
7169
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7145
7170
|
}
|
|
7146
|
-
const directoryDataLength = createDirectoryRecords(files);
|
|
7171
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(files);
|
|
7147
7172
|
let zip64 = getOptionValue(zipWriter, writerOptions, PROPERTY_NAME_ZIP64);
|
|
7148
7173
|
if (offset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || files.size >= MAX_16_BITS) {
|
|
7149
7174
|
if (zip64 === false) {
|
|
@@ -7151,6 +7176,8 @@
|
|
|
7151
7176
|
} else {
|
|
7152
7177
|
zip64 = true;
|
|
7153
7178
|
}
|
|
7179
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
7180
|
+
zip64 = true;
|
|
7154
7181
|
}
|
|
7155
7182
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7156
7183
|
}
|
|
@@ -7343,6 +7370,7 @@
|
|
|
7343
7370
|
rawPassword,
|
|
7344
7371
|
level,
|
|
7345
7372
|
zip64,
|
|
7373
|
+
zip64Enabled,
|
|
7346
7374
|
zip64UncompressedSize,
|
|
7347
7375
|
zip64CompressedSize,
|
|
7348
7376
|
zipCrypto,
|
|
@@ -7383,6 +7411,7 @@
|
|
|
7383
7411
|
lockFileEntry,
|
|
7384
7412
|
versionMadeBy,
|
|
7385
7413
|
zip64,
|
|
7414
|
+
zip64Enabled,
|
|
7386
7415
|
directory: Boolean(directory),
|
|
7387
7416
|
executable: Boolean(executable),
|
|
7388
7417
|
filenameUTF8: true,
|
|
@@ -7526,13 +7555,14 @@
|
|
|
7526
7555
|
zip64UncompressedSize,
|
|
7527
7556
|
zip64CompressedSize,
|
|
7528
7557
|
uncompressedSize,
|
|
7558
|
+
unknownSize,
|
|
7529
7559
|
crc32
|
|
7530
7560
|
} = options;
|
|
7531
7561
|
let { version, compressionMethod } = options;
|
|
7532
7562
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7533
7563
|
let rawLocalExtraFieldZip64;
|
|
7534
7564
|
const uncompressedFile = passThrough || !compressed;
|
|
7535
|
-
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
7565
|
+
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7536
7566
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7537
7567
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
7538
7568
|
const length = 4 + 16;
|
|
@@ -7666,6 +7696,10 @@
|
|
|
7666
7696
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
7667
7697
|
}
|
|
7668
7698
|
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7699
|
+
const clampedLastModDate = dosLastModDate < MIN_DATE ? MIN_DATE : dosLastModDate > MAX_DATE ? MAX_DATE : dosLastModDate;
|
|
7700
|
+
const storedLastModDate = getLength(rawExtraFieldExtendedTimestamp) ?
|
|
7701
|
+
new Date(getTimeUnix(lastModDate) * 1000) :
|
|
7702
|
+
getLength(rawExtraFieldNTFS) ? lastModDate : clampedLastModDate;
|
|
7669
7703
|
const {
|
|
7670
7704
|
headerArray,
|
|
7671
7705
|
headerView,
|
|
@@ -7675,7 +7709,7 @@
|
|
|
7675
7709
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
7676
7710
|
compressionMethod,
|
|
7677
7711
|
uncompressedSize,
|
|
7678
|
-
lastModDate:
|
|
7712
|
+
lastModDate: clampedLastModDate,
|
|
7679
7713
|
rawLastModDate: rawLastModDateOption,
|
|
7680
7714
|
rawFilename,
|
|
7681
7715
|
zip64CompressedSize,
|
|
@@ -7710,7 +7744,7 @@
|
|
|
7710
7744
|
localHeaderView,
|
|
7711
7745
|
headerArray,
|
|
7712
7746
|
headerView,
|
|
7713
|
-
lastModDate,
|
|
7747
|
+
lastModDate: storedLastModDate,
|
|
7714
7748
|
rawLastModDate,
|
|
7715
7749
|
encrypted,
|
|
7716
7750
|
compressed,
|
|
@@ -7882,14 +7916,15 @@
|
|
|
7882
7916
|
|
|
7883
7917
|
|
|
7884
7918
|
async function closeFile(zipWriter, comment, options) {
|
|
7885
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7919
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(zipWriter.fileEntries);
|
|
7886
7920
|
const { directoryStart, directoryEnd, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7887
7921
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7888
|
-
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength });
|
|
7922
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength, zip64Entries });
|
|
7889
7923
|
}
|
|
7890
7924
|
|
|
7891
7925
|
function createDirectoryRecords(files) {
|
|
7892
7926
|
let directoryDataLength = 0;
|
|
7927
|
+
let zip64Entries = false;
|
|
7893
7928
|
for (const [, fileEntry] of files) {
|
|
7894
7929
|
const {
|
|
7895
7930
|
rawFilename,
|
|
@@ -7902,11 +7937,20 @@
|
|
|
7902
7937
|
extendedTimestamp,
|
|
7903
7938
|
extraFieldExtendedTimestampFlag,
|
|
7904
7939
|
lastModDate,
|
|
7905
|
-
|
|
7906
|
-
zip64CompressedSize,
|
|
7940
|
+
zip64Enabled,
|
|
7907
7941
|
uncompressedSize,
|
|
7908
7942
|
compressedSize
|
|
7909
7943
|
} = fileEntry;
|
|
7944
|
+
let { zip64UncompressedSize, zip64CompressedSize } = fileEntry;
|
|
7945
|
+
if (!zip64Enabled) {
|
|
7946
|
+
if (zip64UncompressedSize && uncompressedSize < MAX_32_BITS) {
|
|
7947
|
+
zip64UncompressedSize = fileEntry.zip64UncompressedSize = false;
|
|
7948
|
+
}
|
|
7949
|
+
if (zip64CompressedSize && compressedSize < MAX_32_BITS) {
|
|
7950
|
+
zip64CompressedSize = fileEntry.zip64CompressedSize = false;
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7953
|
+
zip64Entries = zip64Entries || zip64UncompressedSize || zip64CompressedSize;
|
|
7910
7954
|
const zip64Offset = fileEntry.offset >= MAX_32_BITS;
|
|
7911
7955
|
const zip64DiskNumberStart = fileEntry.diskNumberStart >= MAX_16_BITS;
|
|
7912
7956
|
let rawExtraFieldZip64;
|
|
@@ -7960,7 +8004,7 @@
|
|
|
7960
8004
|
}
|
|
7961
8005
|
directoryDataLength += CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
7962
8006
|
}
|
|
7963
|
-
return directoryDataLength;
|
|
8007
|
+
return { directoryDataLength, zip64Entries };
|
|
7964
8008
|
}
|
|
7965
8009
|
|
|
7966
8010
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
@@ -8080,7 +8124,7 @@
|
|
|
8080
8124
|
|
|
8081
8125
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
8082
8126
|
const { writer } = zipWriter;
|
|
8083
|
-
const { directoryStart, directoryEnd, signatureLength } = cdInfo;
|
|
8127
|
+
const { directoryStart, directoryEnd, signatureLength, zip64Entries } = cdInfo;
|
|
8084
8128
|
let { directoryDataLength } = cdInfo;
|
|
8085
8129
|
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
8086
8130
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -8100,6 +8144,8 @@
|
|
|
8100
8144
|
} else {
|
|
8101
8145
|
zip64 = true;
|
|
8102
8146
|
}
|
|
8147
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
8148
|
+
zip64 = true;
|
|
8103
8149
|
}
|
|
8104
8150
|
const endOfdirectoryRecord = createRecordWriter(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
8105
8151
|
if (exceedsAvailableSize(writer, getLength(endOfdirectoryRecord.array) + commentLength)) {
|
|
@@ -8603,7 +8649,7 @@
|
|
|
8603
8649
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8604
8650
|
*/
|
|
8605
8651
|
|
|
8606
|
-
const VERSION = "2.11.
|
|
8652
|
+
const VERSION = "2.11.4";
|
|
8607
8653
|
|
|
8608
8654
|
/*
|
|
8609
8655
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9132,8 +9178,6 @@
|
|
|
9132
9178
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9133
9179
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9134
9180
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9135
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9136
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9137
9181
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9138
9182
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9139
9183
|
EXTRAFIELD_TYPE_ZIP64,
|
|
@@ -9627,12 +9671,14 @@
|
|
|
9627
9671
|
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
9628
9672
|
options.bufferedWrite = true;
|
|
9629
9673
|
}
|
|
9630
|
-
const
|
|
9674
|
+
const children = zipEntry.getChildren({ recursive: true });
|
|
9675
|
+
const entries = children.filter(child => !isImplicitDirectory(child)).map(child => {
|
|
9631
9676
|
const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
|
|
9632
9677
|
return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
|
|
9633
9678
|
});
|
|
9634
9679
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
9635
|
-
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9680
|
+
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9681
|
+
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
9636
9682
|
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
9637
9683
|
}
|
|
9638
9684
|
|
|
@@ -10661,6 +10707,7 @@
|
|
|
10661
10707
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
10662
10708
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
10663
10709
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
10710
|
+
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
10664
10711
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
10665
10712
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
10666
10713
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
@@ -10689,6 +10736,7 @@
|
|
|
10689
10736
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
10690
10737
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
10691
10738
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
10739
|
+
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
10692
10740
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
10693
10741
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
10694
10742
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|