@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.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);
|
|
@@ -3760,11 +3768,13 @@
|
|
|
3760
3768
|
const reader = this;
|
|
3761
3769
|
const { sourceBlob, size } = reader;
|
|
3762
3770
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3763
|
-
if (
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3771
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3772
|
+
if (!offset && readSize >= size) {
|
|
3773
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3774
|
+
}
|
|
3775
|
+
if (blobSliceReliable) {
|
|
3776
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3777
|
+
}
|
|
3768
3778
|
}
|
|
3769
3779
|
return super.createReadable(options);
|
|
3770
3780
|
}
|
|
@@ -5200,27 +5210,28 @@
|
|
|
5200
5210
|
const { done, value } = await gen.next();
|
|
5201
5211
|
if (done)
|
|
5202
5212
|
return controller.close();
|
|
5203
|
-
const
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
return readable;
|
|
5210
|
-
}
|
|
5213
|
+
const entryReadable = (function () {
|
|
5214
|
+
const { readable, writable } = new TransformStream();
|
|
5215
|
+
if (value.getData) {
|
|
5216
|
+
getData();
|
|
5217
|
+
return readable;
|
|
5218
|
+
}
|
|
5211
5219
|
|
|
5212
|
-
|
|
5220
|
+
async function getData() {
|
|
5221
|
+
try {
|
|
5222
|
+
await value.getData(writable);
|
|
5223
|
+
} catch (error) {
|
|
5213
5224
|
try {
|
|
5214
|
-
await
|
|
5215
|
-
} catch
|
|
5216
|
-
|
|
5217
|
-
await writable.abort(error);
|
|
5218
|
-
} catch {
|
|
5219
|
-
// ignored
|
|
5220
|
-
}
|
|
5225
|
+
await writable.abort(error);
|
|
5226
|
+
} catch {
|
|
5227
|
+
// ignored
|
|
5221
5228
|
}
|
|
5222
5229
|
}
|
|
5223
|
-
}
|
|
5230
|
+
}
|
|
5231
|
+
})();
|
|
5232
|
+
const chunk = {
|
|
5233
|
+
...value,
|
|
5234
|
+
readable: entryReadable
|
|
5224
5235
|
};
|
|
5225
5236
|
delete chunk.getData;
|
|
5226
5237
|
controller.enqueue(chunk);
|
|
@@ -5366,6 +5377,7 @@
|
|
|
5366
5377
|
const size = compressedSize;
|
|
5367
5378
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5368
5379
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5380
|
+
throwIfAborted(signal);
|
|
5369
5381
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5370
5382
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5371
5383
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6272,6 +6284,7 @@
|
|
|
6272
6284
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
6273
6285
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6274
6286
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6287
|
+
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6275
6288
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6276
6289
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6277
6290
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
@@ -6286,6 +6299,7 @@
|
|
|
6286
6299
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6287
6300
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6288
6301
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6302
|
+
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
6289
6303
|
const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
|
|
6290
6304
|
const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
|
|
6291
6305
|
const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
|
|
@@ -6317,6 +6331,9 @@
|
|
|
6317
6331
|
const addSplitZipSignature =
|
|
6318
6332
|
availableSize > 0 && availableSize !== INFINITY_VALUE &&
|
|
6319
6333
|
maxSize > 0 && maxSize !== INFINITY_VALUE;
|
|
6334
|
+
if (addSplitZipSignature && options[OPTION_USDZ]) {
|
|
6335
|
+
throw new Error(ERR_UNSUPPORTED_SPLIT_USDZ);
|
|
6336
|
+
}
|
|
6320
6337
|
Object.assign(this, {
|
|
6321
6338
|
writer,
|
|
6322
6339
|
addSplitZipSignature,
|
|
@@ -6432,6 +6449,7 @@
|
|
|
6432
6449
|
}
|
|
6433
6450
|
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6434
6451
|
Object.assign(entry, {
|
|
6452
|
+
zip64Enabled: true,
|
|
6435
6453
|
zip64UncompressedSize,
|
|
6436
6454
|
zip64CompressedSize,
|
|
6437
6455
|
offset,
|
|
@@ -6890,6 +6908,7 @@
|
|
|
6890
6908
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6891
6909
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6892
6910
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6911
|
+
throwIfAborted(signal);
|
|
6893
6912
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6894
6913
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6895
6914
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -7007,6 +7026,9 @@
|
|
|
7007
7026
|
if (reader) {
|
|
7008
7027
|
reader = new GenericReader(reader);
|
|
7009
7028
|
await initStream(reader);
|
|
7029
|
+
if (!reader.readable && !reader.readUint8Array) {
|
|
7030
|
+
throw new Error(ERR_INVALID_READER);
|
|
7031
|
+
}
|
|
7010
7032
|
({ size: contentSize } = reader);
|
|
7011
7033
|
}
|
|
7012
7034
|
return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
|
|
@@ -7017,6 +7039,7 @@
|
|
|
7017
7039
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7018
7040
|
let maximumCompressedSize = 0;
|
|
7019
7041
|
let uncompressedSize = 0;
|
|
7042
|
+
let unknownSize = false;
|
|
7020
7043
|
if (passThrough && hasContent) {
|
|
7021
7044
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7022
7045
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
@@ -7042,8 +7065,8 @@
|
|
|
7042
7065
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7043
7066
|
dataDescriptor = true;
|
|
7044
7067
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
7045
|
-
zip64 = true;
|
|
7046
|
-
|
|
7068
|
+
zip64 = unknownSize = true;
|
|
7069
|
+
maximumCompressedSize = MAX_32_BITS + 1;
|
|
7047
7070
|
}
|
|
7048
7071
|
} else {
|
|
7049
7072
|
options.uncompressedSize = uncompressedSize = contentSize;
|
|
@@ -7058,7 +7081,7 @@
|
|
|
7058
7081
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7059
7082
|
dataDescriptor = false;
|
|
7060
7083
|
}
|
|
7061
|
-
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
7084
|
+
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
7062
7085
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
7063
7086
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
7064
7087
|
if (zip64 === false) {
|
|
@@ -7074,6 +7097,8 @@
|
|
|
7074
7097
|
dataDescriptor,
|
|
7075
7098
|
emptyEntry,
|
|
7076
7099
|
zip64,
|
|
7100
|
+
zip64Enabled,
|
|
7101
|
+
unknownSize,
|
|
7077
7102
|
zip64UncompressedSize,
|
|
7078
7103
|
zip64CompressedSize,
|
|
7079
7104
|
uncompressedSize,
|
|
@@ -7147,7 +7172,7 @@
|
|
|
7147
7172
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7148
7173
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7149
7174
|
}
|
|
7150
|
-
const directoryDataLength = createDirectoryRecords(files);
|
|
7175
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(files);
|
|
7151
7176
|
let zip64 = getOptionValue(zipWriter, writerOptions, PROPERTY_NAME_ZIP64);
|
|
7152
7177
|
if (offset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || files.size >= MAX_16_BITS) {
|
|
7153
7178
|
if (zip64 === false) {
|
|
@@ -7155,6 +7180,8 @@
|
|
|
7155
7180
|
} else {
|
|
7156
7181
|
zip64 = true;
|
|
7157
7182
|
}
|
|
7183
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
7184
|
+
zip64 = true;
|
|
7158
7185
|
}
|
|
7159
7186
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7160
7187
|
}
|
|
@@ -7347,6 +7374,7 @@
|
|
|
7347
7374
|
rawPassword,
|
|
7348
7375
|
level,
|
|
7349
7376
|
zip64,
|
|
7377
|
+
zip64Enabled,
|
|
7350
7378
|
zip64UncompressedSize,
|
|
7351
7379
|
zip64CompressedSize,
|
|
7352
7380
|
zipCrypto,
|
|
@@ -7387,6 +7415,7 @@
|
|
|
7387
7415
|
lockFileEntry,
|
|
7388
7416
|
versionMadeBy,
|
|
7389
7417
|
zip64,
|
|
7418
|
+
zip64Enabled,
|
|
7390
7419
|
directory: Boolean(directory),
|
|
7391
7420
|
executable: Boolean(executable),
|
|
7392
7421
|
filenameUTF8: true,
|
|
@@ -7530,13 +7559,14 @@
|
|
|
7530
7559
|
zip64UncompressedSize,
|
|
7531
7560
|
zip64CompressedSize,
|
|
7532
7561
|
uncompressedSize,
|
|
7562
|
+
unknownSize,
|
|
7533
7563
|
crc32
|
|
7534
7564
|
} = options;
|
|
7535
7565
|
let { version, compressionMethod } = options;
|
|
7536
7566
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7537
7567
|
let rawLocalExtraFieldZip64;
|
|
7538
7568
|
const uncompressedFile = passThrough || !compressed;
|
|
7539
|
-
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
7569
|
+
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7540
7570
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7541
7571
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
7542
7572
|
const length = 4 + 16;
|
|
@@ -7670,6 +7700,10 @@
|
|
|
7670
7700
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
7671
7701
|
}
|
|
7672
7702
|
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7703
|
+
const clampedLastModDate = dosLastModDate < MIN_DATE ? MIN_DATE : dosLastModDate > MAX_DATE ? MAX_DATE : dosLastModDate;
|
|
7704
|
+
const storedLastModDate = getLength(rawExtraFieldExtendedTimestamp) ?
|
|
7705
|
+
new Date(getTimeUnix(lastModDate) * 1000) :
|
|
7706
|
+
getLength(rawExtraFieldNTFS) ? lastModDate : clampedLastModDate;
|
|
7673
7707
|
const {
|
|
7674
7708
|
headerArray,
|
|
7675
7709
|
headerView,
|
|
@@ -7679,7 +7713,7 @@
|
|
|
7679
7713
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
7680
7714
|
compressionMethod,
|
|
7681
7715
|
uncompressedSize,
|
|
7682
|
-
lastModDate:
|
|
7716
|
+
lastModDate: clampedLastModDate,
|
|
7683
7717
|
rawLastModDate: rawLastModDateOption,
|
|
7684
7718
|
rawFilename,
|
|
7685
7719
|
zip64CompressedSize,
|
|
@@ -7714,7 +7748,7 @@
|
|
|
7714
7748
|
localHeaderView,
|
|
7715
7749
|
headerArray,
|
|
7716
7750
|
headerView,
|
|
7717
|
-
lastModDate,
|
|
7751
|
+
lastModDate: storedLastModDate,
|
|
7718
7752
|
rawLastModDate,
|
|
7719
7753
|
encrypted,
|
|
7720
7754
|
compressed,
|
|
@@ -7886,14 +7920,15 @@
|
|
|
7886
7920
|
|
|
7887
7921
|
|
|
7888
7922
|
async function closeFile(zipWriter, comment, options) {
|
|
7889
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7923
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(zipWriter.fileEntries);
|
|
7890
7924
|
const { directoryStart, directoryEnd, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7891
7925
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7892
|
-
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength });
|
|
7926
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength, zip64Entries });
|
|
7893
7927
|
}
|
|
7894
7928
|
|
|
7895
7929
|
function createDirectoryRecords(files) {
|
|
7896
7930
|
let directoryDataLength = 0;
|
|
7931
|
+
let zip64Entries = false;
|
|
7897
7932
|
for (const [, fileEntry] of files) {
|
|
7898
7933
|
const {
|
|
7899
7934
|
rawFilename,
|
|
@@ -7906,11 +7941,20 @@
|
|
|
7906
7941
|
extendedTimestamp,
|
|
7907
7942
|
extraFieldExtendedTimestampFlag,
|
|
7908
7943
|
lastModDate,
|
|
7909
|
-
|
|
7910
|
-
zip64CompressedSize,
|
|
7944
|
+
zip64Enabled,
|
|
7911
7945
|
uncompressedSize,
|
|
7912
7946
|
compressedSize
|
|
7913
7947
|
} = fileEntry;
|
|
7948
|
+
let { zip64UncompressedSize, zip64CompressedSize } = fileEntry;
|
|
7949
|
+
if (!zip64Enabled) {
|
|
7950
|
+
if (zip64UncompressedSize && uncompressedSize < MAX_32_BITS) {
|
|
7951
|
+
zip64UncompressedSize = fileEntry.zip64UncompressedSize = false;
|
|
7952
|
+
}
|
|
7953
|
+
if (zip64CompressedSize && compressedSize < MAX_32_BITS) {
|
|
7954
|
+
zip64CompressedSize = fileEntry.zip64CompressedSize = false;
|
|
7955
|
+
}
|
|
7956
|
+
}
|
|
7957
|
+
zip64Entries = zip64Entries || zip64UncompressedSize || zip64CompressedSize;
|
|
7914
7958
|
const zip64Offset = fileEntry.offset >= MAX_32_BITS;
|
|
7915
7959
|
const zip64DiskNumberStart = fileEntry.diskNumberStart >= MAX_16_BITS;
|
|
7916
7960
|
let rawExtraFieldZip64;
|
|
@@ -7964,7 +8008,7 @@
|
|
|
7964
8008
|
}
|
|
7965
8009
|
directoryDataLength += CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
7966
8010
|
}
|
|
7967
|
-
return directoryDataLength;
|
|
8011
|
+
return { directoryDataLength, zip64Entries };
|
|
7968
8012
|
}
|
|
7969
8013
|
|
|
7970
8014
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
@@ -8084,7 +8128,7 @@
|
|
|
8084
8128
|
|
|
8085
8129
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
8086
8130
|
const { writer } = zipWriter;
|
|
8087
|
-
const { directoryStart, directoryEnd, signatureLength } = cdInfo;
|
|
8131
|
+
const { directoryStart, directoryEnd, signatureLength, zip64Entries } = cdInfo;
|
|
8088
8132
|
let { directoryDataLength } = cdInfo;
|
|
8089
8133
|
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
8090
8134
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -8104,6 +8148,8 @@
|
|
|
8104
8148
|
} else {
|
|
8105
8149
|
zip64 = true;
|
|
8106
8150
|
}
|
|
8151
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
8152
|
+
zip64 = true;
|
|
8107
8153
|
}
|
|
8108
8154
|
const endOfdirectoryRecord = createRecordWriter(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
8109
8155
|
if (exceedsAvailableSize(writer, getLength(endOfdirectoryRecord.array) + commentLength)) {
|
|
@@ -8607,7 +8653,7 @@
|
|
|
8607
8653
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8608
8654
|
*/
|
|
8609
8655
|
|
|
8610
|
-
const VERSION = "2.11.
|
|
8656
|
+
const VERSION = "2.11.4";
|
|
8611
8657
|
|
|
8612
8658
|
/*
|
|
8613
8659
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9508,8 +9554,6 @@
|
|
|
9508
9554
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9509
9555
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9510
9556
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9511
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9512
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9513
9557
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9514
9558
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9515
9559
|
EXTRAFIELD_TYPE_ZIP64,
|
|
@@ -10003,12 +10047,14 @@
|
|
|
10003
10047
|
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10004
10048
|
options.bufferedWrite = true;
|
|
10005
10049
|
}
|
|
10006
|
-
const
|
|
10050
|
+
const children = zipEntry.getChildren({ recursive: true });
|
|
10051
|
+
const entries = children.filter(child => !isImplicitDirectory(child)).map(child => {
|
|
10007
10052
|
const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
|
|
10008
10053
|
return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
|
|
10009
10054
|
});
|
|
10010
10055
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
10011
|
-
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10056
|
+
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10057
|
+
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
10012
10058
|
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10013
10059
|
}
|
|
10014
10060
|
|
|
@@ -11037,6 +11083,7 @@
|
|
|
11037
11083
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
11038
11084
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
11039
11085
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
11086
|
+
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
11040
11087
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
11041
11088
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
11042
11089
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
@@ -11065,6 +11112,7 @@
|
|
|
11065
11112
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
11066
11113
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
11067
11114
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
11115
|
+
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
11068
11116
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
11069
11117
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
11070
11118
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|