@zip.js/zip.js 2.18.1 → 2.19.0
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 +122 -118
- package/deno.json +1 -1
- package/dist/zip-core-external.js +59 -94
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +59 -94
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +59 -94
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +59 -94
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +59 -94
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +61 -96
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +60 -95
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +61 -96
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +61 -96
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +60 -95
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +61 -96
- package/index-native.min.js +1 -1
- package/index.cjs +60 -95
- package/index.d.cts +33 -23
- package/index.d.ts +33 -23
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +1 -2
- package/lib/core/codec-worker-web.js +11 -39
- package/lib/core/codec-worker.js +1 -2
- package/lib/core/configuration.js +1 -1
- package/lib/core/options.js +0 -2
- package/lib/core/streams/codec-stream.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +2 -3
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +26 -36
- package/lib/core/zip-writer.js +18 -14
- package/package.json +1 -1
- package/worker-message-property-names.js +1 -1
|
@@ -176,7 +176,6 @@ const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
|
176
176
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
177
177
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
178
178
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
179
|
-
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
180
179
|
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
181
180
|
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
182
181
|
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
@@ -294,7 +293,7 @@ function toNumber(value) {
|
|
|
294
293
|
*/
|
|
295
294
|
|
|
296
295
|
|
|
297
|
-
const DEFAULT_CHUNK_SIZE$1 =
|
|
296
|
+
const DEFAULT_CHUNK_SIZE$1 = 256 * 1024;
|
|
298
297
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
299
298
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
300
299
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
@@ -2423,7 +2422,7 @@ function mapInflateStreamError(readable, sourceErrors) {
|
|
|
2423
2422
|
*/
|
|
2424
2423
|
|
|
2425
2424
|
|
|
2426
|
-
const DEFAULT_CHUNK_SIZE =
|
|
2425
|
+
const DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
2427
2426
|
const MESSAGE_EVENT_TYPE = "message";
|
|
2428
2427
|
const MESSAGE_START = "start";
|
|
2429
2428
|
const MESSAGE_PULL = "pull";
|
|
@@ -2633,7 +2632,7 @@ function disableWebWorker(workerData) {
|
|
|
2633
2632
|
class CodecWorker {
|
|
2634
2633
|
|
|
2635
2634
|
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2636
|
-
const { options, config, streamOptions, useWebWorkers,
|
|
2635
|
+
const { options, config, streamOptions, useWebWorkers, workerURI } = workerOptions;
|
|
2637
2636
|
let { createWorker } = workerOptions;
|
|
2638
2637
|
const { signal } = streamOptions;
|
|
2639
2638
|
if (createWorkerFailed) {
|
|
@@ -2650,7 +2649,6 @@ class CodecWorker {
|
|
|
2650
2649
|
workerOptions,
|
|
2651
2650
|
workerURI,
|
|
2652
2651
|
createWorker,
|
|
2653
|
-
transferStreams,
|
|
2654
2652
|
terminate() {
|
|
2655
2653
|
return new Promise(resolve => {
|
|
2656
2654
|
const { worker, busy } = workerData;
|
|
@@ -2828,12 +2826,6 @@ const MESSAGE_ERROR_EVENT_TYPE = "messageerror";
|
|
|
2828
2826
|
const ABORT_EVENT_TYPE = "abort";
|
|
2829
2827
|
|
|
2830
2828
|
let webWorkerSource, webWorkerURI, webWorkerOptions;
|
|
2831
|
-
let transferStreamsSupported = true;
|
|
2832
|
-
try {
|
|
2833
|
-
transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
|
|
2834
|
-
} catch {
|
|
2835
|
-
// ignored
|
|
2836
|
-
}
|
|
2837
2829
|
|
|
2838
2830
|
setWebWorkerBackend(createWebWorkerInterface);
|
|
2839
2831
|
|
|
@@ -2920,14 +2912,11 @@ async function runWebWorker(workerData, config) {
|
|
|
2920
2912
|
});
|
|
2921
2913
|
const { readable, options } = workerData;
|
|
2922
2914
|
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable, workerData);
|
|
2923
|
-
let streamsTransferred;
|
|
2924
2915
|
try {
|
|
2925
|
-
|
|
2916
|
+
sendMessage({
|
|
2926
2917
|
type: MESSAGE_START,
|
|
2927
2918
|
options,
|
|
2928
|
-
config
|
|
2929
|
-
readable,
|
|
2930
|
-
writable
|
|
2919
|
+
config
|
|
2931
2920
|
}, workerData);
|
|
2932
2921
|
} catch (error) {
|
|
2933
2922
|
abortPipe();
|
|
@@ -2939,12 +2928,10 @@ async function runWebWorker(workerData, config) {
|
|
|
2939
2928
|
workerData.onTaskFinished();
|
|
2940
2929
|
throw error;
|
|
2941
2930
|
}
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2931
|
+
Object.assign(workerData, {
|
|
2932
|
+
reader: readable.getReader(),
|
|
2933
|
+
writer: writable.getWriter()
|
|
2934
|
+
});
|
|
2948
2935
|
const { workerStartupTimeout } = config;
|
|
2949
2936
|
if (!workerData.workerAlive && Number.isFinite(workerStartupTimeout) && workerStartupTimeout >= 0) {
|
|
2950
2937
|
workerData.startupTimeout = setTimeout(() => onStartupTimeout(workerData), workerStartupTimeout);
|
|
@@ -2977,7 +2964,7 @@ async function runWebWorker(workerData, config) {
|
|
|
2977
2964
|
}
|
|
2978
2965
|
|
|
2979
2966
|
async function closeWritable() {
|
|
2980
|
-
if (!
|
|
2967
|
+
if (!writable.locked) {
|
|
2981
2968
|
try {
|
|
2982
2969
|
await writable.getWriter().close();
|
|
2983
2970
|
} catch {
|
|
@@ -3168,31 +3155,14 @@ function onWorkerError(event, workerData) {
|
|
|
3168
3155
|
}
|
|
3169
3156
|
}
|
|
3170
3157
|
|
|
3171
|
-
function sendMessage(message, { worker, writer
|
|
3158
|
+
function sendMessage(message, { worker, writer }) {
|
|
3172
3159
|
try {
|
|
3173
|
-
const { value
|
|
3174
|
-
const transferables = [];
|
|
3160
|
+
const { value } = message;
|
|
3175
3161
|
if (value) {
|
|
3176
3162
|
message.value = toExactUint8Array(value);
|
|
3177
|
-
transferables.push(message.value.buffer);
|
|
3178
|
-
}
|
|
3179
|
-
if (transferStreams && transferStreamsSupported && workerAlive) {
|
|
3180
|
-
if (readable) {
|
|
3181
|
-
transferables.push(readable);
|
|
3182
|
-
}
|
|
3183
|
-
if (writable) {
|
|
3184
|
-
transferables.push(writable);
|
|
3185
|
-
}
|
|
3186
|
-
} else {
|
|
3187
|
-
message.readable = message.writable = null;
|
|
3188
|
-
}
|
|
3189
|
-
if (transferables.length) {
|
|
3190
3163
|
try {
|
|
3191
|
-
worker.postMessage(message,
|
|
3192
|
-
return true;
|
|
3164
|
+
worker.postMessage(message, [message.value.buffer]);
|
|
3193
3165
|
} catch {
|
|
3194
|
-
transferStreamsSupported = false;
|
|
3195
|
-
message.readable = message.writable = null;
|
|
3196
3166
|
worker.postMessage(message);
|
|
3197
3167
|
}
|
|
3198
3168
|
} else {
|
|
@@ -3341,7 +3311,7 @@ let indexWorker = 0;
|
|
|
3341
3311
|
|
|
3342
3312
|
async function runWorker(stream, workerOptions) {
|
|
3343
3313
|
const { options, config } = workerOptions;
|
|
3344
|
-
const {
|
|
3314
|
+
const { useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3345
3315
|
const { workerURI, createWorker, maxWorkers } = config;
|
|
3346
3316
|
if (format) {
|
|
3347
3317
|
if (codecURI) {
|
|
@@ -3349,7 +3319,6 @@ async function runWorker(stream, workerOptions) {
|
|
|
3349
3319
|
}
|
|
3350
3320
|
await ensureCodecStreams(format, options.codecURI);
|
|
3351
3321
|
}
|
|
3352
|
-
workerOptions.transferStreams = !format && (transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams));
|
|
3353
3322
|
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3354
3323
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3355
3324
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
@@ -5151,17 +5120,6 @@ class ZipReader {
|
|
|
5151
5120
|
if (filename === UNDEFINED_VALUE) {
|
|
5152
5121
|
filename = decodeText(rawFilename, rawFilenameEncoding);
|
|
5153
5122
|
}
|
|
5154
|
-
if (normalizeFilename) {
|
|
5155
|
-
const normalizedFilename = normalizeFilename(filename);
|
|
5156
|
-
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5157
|
-
filename = normalizedFilename;
|
|
5158
|
-
}
|
|
5159
|
-
}
|
|
5160
|
-
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5161
|
-
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5162
|
-
error.filename = filename;
|
|
5163
|
-
throw error;
|
|
5164
|
-
}
|
|
5165
5123
|
let comment = decode(rawComment, rawCommentEncoding, TEXT_TYPE_COMMENT);
|
|
5166
5124
|
if (comment === UNDEFINED_VALUE) {
|
|
5167
5125
|
comment = decodeText(rawComment, rawCommentEncoding);
|
|
@@ -5189,7 +5147,20 @@ class ZipReader {
|
|
|
5189
5147
|
filename,
|
|
5190
5148
|
comment
|
|
5191
5149
|
});
|
|
5192
|
-
|
|
5150
|
+
const malformedExtraField = readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
5151
|
+
filename = fileEntry.filename;
|
|
5152
|
+
if (normalizeFilename) {
|
|
5153
|
+
const normalizedFilename = normalizeFilename(filename);
|
|
5154
|
+
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5155
|
+
filename = fileEntry.filename = normalizedFilename;
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5158
|
+
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5159
|
+
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5160
|
+
error.filename = filename;
|
|
5161
|
+
throw error;
|
|
5162
|
+
}
|
|
5163
|
+
if (malformedExtraField) {
|
|
5193
5164
|
addWarning(warnings, WARNING_MALFORMED_EXTRA_FIELD, filename);
|
|
5194
5165
|
}
|
|
5195
5166
|
fileEntry.offset += prependedDataLength;
|
|
@@ -5593,7 +5564,6 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5593
5564
|
encrypted,
|
|
5594
5565
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
5595
5566
|
useCompressionStream,
|
|
5596
|
-
transferStreams: getOptionValue$1(zipEntry, options, OPTION_TRANSFER_STREAMS),
|
|
5597
5567
|
deflate64,
|
|
5598
5568
|
format: registeredCodec ? registeredCodec.format : UNDEFINED_VALUE,
|
|
5599
5569
|
codecURI: registeredCodec ? registeredCodec.codecURI : UNDEFINED_VALUE,
|
|
@@ -5823,19 +5793,17 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5823
5793
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
5824
5794
|
directory.extraFieldNTFS = extraFieldNTFS;
|
|
5825
5795
|
}
|
|
5826
|
-
const
|
|
5796
|
+
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5827
5797
|
let unixIdsRead;
|
|
5798
|
+
if (extraFieldInfoZip) {
|
|
5799
|
+
unixIdsRead = readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5800
|
+
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5801
|
+
}
|
|
5802
|
+
const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
|
|
5828
5803
|
if (extraFieldUnix) {
|
|
5829
|
-
|
|
5804
|
+
readExtraFieldUnix(extraFieldUnix, unixIdsRead ? {} : directory, false);
|
|
5830
5805
|
directory.extraFieldUnix = extraFieldUnix;
|
|
5831
5806
|
}
|
|
5832
|
-
if (!unixIdsRead) {
|
|
5833
|
-
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5834
|
-
if (extraFieldInfoZip) {
|
|
5835
|
-
readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5836
|
-
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5837
|
-
}
|
|
5838
|
-
}
|
|
5839
5807
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
5840
5808
|
if (extraFieldExtendedTimestamp) {
|
|
5841
5809
|
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
@@ -6061,19 +6029,11 @@ async function detectOverlappingEntry({
|
|
|
6061
6029
|
const zip64 = Boolean(extraFieldZip64);
|
|
6062
6030
|
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6063
6031
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6064
|
-
const
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6070
|
-
localDataDescriptor = candidate;
|
|
6071
|
-
break;
|
|
6072
|
-
}
|
|
6073
|
-
}
|
|
6074
|
-
if (!localDataDescriptor) {
|
|
6075
|
-
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6076
|
-
}
|
|
6032
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6033
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6034
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6035
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6036
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6077
6037
|
if (localDataDescriptor) {
|
|
6078
6038
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6079
6039
|
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
@@ -6730,6 +6690,7 @@ class ZipWriter {
|
|
|
6730
6690
|
rawExtraFieldExtendedTimestamp: EMPTY_UINT8_ARRAY,
|
|
6731
6691
|
rawExtraFieldNTFS: EMPTY_UINT8_ARRAY,
|
|
6732
6692
|
rawExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6693
|
+
rawCentralExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6733
6694
|
rawExtraField,
|
|
6734
6695
|
rawCentralExtraField: EMPTY_UINT8_ARRAY,
|
|
6735
6696
|
headerArray,
|
|
@@ -7298,7 +7259,6 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
7298
7259
|
const ntfsTimestamp = getOptionValue(zipWriter, options, OPTION_NTFS_TIMESTAMP);
|
|
7299
7260
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
7300
7261
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
7301
|
-
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS);
|
|
7302
7262
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
7303
7263
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
7304
7264
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
@@ -7364,7 +7324,6 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
7364
7324
|
ntfsTimestamp,
|
|
7365
7325
|
keepOrder,
|
|
7366
7326
|
useWebWorkers,
|
|
7367
|
-
transferStreams,
|
|
7368
7327
|
bufferedWrite,
|
|
7369
7328
|
createTempStream,
|
|
7370
7329
|
dataDescriptorSignature,
|
|
@@ -7423,7 +7382,7 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
|
|
|
7423
7382
|
if (reader) {
|
|
7424
7383
|
reader = new GenericReader(reader);
|
|
7425
7384
|
await initStream(reader);
|
|
7426
|
-
if (!reader.
|
|
7385
|
+
if (!reader.readUint8Array && !reader.readable) {
|
|
7427
7386
|
throw new Error(ERR_INVALID_READER);
|
|
7428
7387
|
}
|
|
7429
7388
|
({ size: contentSize } = reader);
|
|
@@ -7784,6 +7743,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7784
7743
|
extraFieldExtendedTimestampTime,
|
|
7785
7744
|
rawExtraFieldNTFS,
|
|
7786
7745
|
rawExtraFieldUnix,
|
|
7746
|
+
rawCentralExtraFieldUnix,
|
|
7787
7747
|
rawExtraFieldAES,
|
|
7788
7748
|
} = headerInfo;
|
|
7789
7749
|
const { dataDescriptorArray } = dataDescriptorInfo;
|
|
@@ -7808,7 +7768,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7808
7768
|
rawExtraField,
|
|
7809
7769
|
rawCentralExtraField,
|
|
7810
7770
|
useWebWorkers,
|
|
7811
|
-
transferStreams,
|
|
7812
7771
|
onstart,
|
|
7813
7772
|
onprogress,
|
|
7814
7773
|
onend,
|
|
@@ -7850,6 +7809,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7850
7809
|
rawExtraFieldExtendedTimestamp,
|
|
7851
7810
|
rawExtraFieldNTFS,
|
|
7852
7811
|
rawExtraFieldUnix,
|
|
7812
|
+
rawCentralExtraFieldUnix,
|
|
7853
7813
|
rawExtraFieldAES,
|
|
7854
7814
|
rawExtraField,
|
|
7855
7815
|
rawCentralExtraField,
|
|
@@ -7896,7 +7856,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7896
7856
|
encrypted: encrypted && !passThroughEncryption,
|
|
7897
7857
|
useWebWorkers,
|
|
7898
7858
|
useCompressionStream,
|
|
7899
|
-
transferStreams,
|
|
7900
7859
|
format,
|
|
7901
7860
|
codecURI,
|
|
7902
7861
|
compressionMethod
|
|
@@ -8074,6 +8033,7 @@ function getHeaderInfo(options) {
|
|
|
8074
8033
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = EMPTY_UINT8_ARRAY;
|
|
8075
8034
|
}
|
|
8076
8035
|
let rawExtraFieldUnix;
|
|
8036
|
+
let rawCentralExtraFieldUnix;
|
|
8077
8037
|
try {
|
|
8078
8038
|
const { uid, gid, unixExtraFieldType } = options;
|
|
8079
8039
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
@@ -8088,7 +8048,7 @@ function getHeaderInfo(options) {
|
|
|
8088
8048
|
extraFieldUnix.writeBytes(uidBytes);
|
|
8089
8049
|
extraFieldUnix.writeUint8(gidBytes.length);
|
|
8090
8050
|
extraFieldUnix.writeBytes(gidBytes);
|
|
8091
|
-
rawExtraFieldUnix = extraFieldUnix.array;
|
|
8051
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = extraFieldUnix.array;
|
|
8092
8052
|
} else if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
8093
8053
|
const extraFieldUnix = createRecordWriter(8);
|
|
8094
8054
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
@@ -8096,11 +8056,15 @@ function getHeaderInfo(options) {
|
|
|
8096
8056
|
extraFieldUnix.writeUint16((uid === UNDEFINED_VALUE ? 0 : uid) & MAX_16_BITS);
|
|
8097
8057
|
extraFieldUnix.writeUint16((gid === UNDEFINED_VALUE ? 0 : gid) & MAX_16_BITS);
|
|
8098
8058
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
8059
|
+
const centralExtraFieldUnix = createRecordWriter(4);
|
|
8060
|
+
centralExtraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
8061
|
+
centralExtraFieldUnix.writeUint16(0);
|
|
8062
|
+
rawCentralExtraFieldUnix = centralExtraFieldUnix.array;
|
|
8099
8063
|
} else {
|
|
8100
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8064
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8101
8065
|
}
|
|
8102
8066
|
} catch {
|
|
8103
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8067
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8104
8068
|
}
|
|
8105
8069
|
if (compressionMethod === UNDEFINED_VALUE) {
|
|
8106
8070
|
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
@@ -8192,6 +8156,7 @@ function getHeaderInfo(options) {
|
|
|
8192
8156
|
rawExtraFieldExtendedTimestamp,
|
|
8193
8157
|
rawExtraFieldNTFS,
|
|
8194
8158
|
rawExtraFieldUnix,
|
|
8159
|
+
rawCentralExtraFieldUnix,
|
|
8195
8160
|
rawExtraFieldAES,
|
|
8196
8161
|
extraFieldLength
|
|
8197
8162
|
};
|
|
@@ -8367,7 +8332,7 @@ function createDirectoryRecords(files) {
|
|
|
8367
8332
|
rawExtraFieldAES,
|
|
8368
8333
|
rawComment,
|
|
8369
8334
|
rawExtraFieldNTFS,
|
|
8370
|
-
|
|
8335
|
+
rawCentralExtraFieldUnix,
|
|
8371
8336
|
rawExtraField,
|
|
8372
8337
|
rawCentralExtraField,
|
|
8373
8338
|
extraFieldExtendedTimestampFlag,
|
|
@@ -8429,7 +8394,7 @@ function createDirectoryRecords(files) {
|
|
|
8429
8394
|
rawExtraFieldZip64,
|
|
8430
8395
|
rawExtraFieldAES,
|
|
8431
8396
|
rawExtraFieldNTFS,
|
|
8432
|
-
|
|
8397
|
+
rawCentralExtraFieldUnix,
|
|
8433
8398
|
rawExtraFieldTimestamp,
|
|
8434
8399
|
rawExtraField,
|
|
8435
8400
|
rawCentralExtraField);
|
|
@@ -8458,7 +8423,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8458
8423
|
rawExtraFieldAES,
|
|
8459
8424
|
rawExtraFieldExtendedTimestamp,
|
|
8460
8425
|
rawExtraFieldNTFS,
|
|
8461
|
-
|
|
8426
|
+
rawCentralExtraFieldUnix,
|
|
8462
8427
|
rawExtraField,
|
|
8463
8428
|
rawCentralExtraField,
|
|
8464
8429
|
rawComment,
|
|
@@ -8475,7 +8440,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8475
8440
|
uncompressedSize,
|
|
8476
8441
|
compressedSize
|
|
8477
8442
|
} = fileEntry;
|
|
8478
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS,
|
|
8443
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawCentralExtraFieldUnix, rawExtraField, rawCentralExtraField);
|
|
8479
8444
|
const directoryRecordLength = CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
8480
8445
|
if (exceedsAvailableSize(writer, offset + directoryRecordLength - directoryDiskOffset)) {
|
|
8481
8446
|
await writeData(writer, directoryArray.slice(directoryDiskOffset, offset));
|
|
@@ -8511,7 +8476,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8511
8476
|
directoryRecord.writeBytes(rawExtraFieldAES);
|
|
8512
8477
|
directoryRecord.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
8513
8478
|
directoryRecord.writeBytes(rawExtraFieldNTFS);
|
|
8514
|
-
directoryRecord.writeBytes(
|
|
8479
|
+
directoryRecord.writeBytes(rawCentralExtraFieldUnix);
|
|
8515
8480
|
directoryRecord.writeBytes(rawExtraField);
|
|
8516
8481
|
directoryRecord.writeBytes(rawCentralExtraField);
|
|
8517
8482
|
directoryRecord.writeBytes(rawComment);
|
|
@@ -9088,7 +9053,7 @@ function formatSupported(StreamClass, format) {
|
|
|
9088
9053
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9089
9054
|
*/
|
|
9090
9055
|
|
|
9091
|
-
const VERSION = "2.
|
|
9056
|
+
const VERSION = "2.19.0";
|
|
9092
9057
|
|
|
9093
9058
|
/*
|
|
9094
9059
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|