@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
package/dist/zip-fs-core.js
CHANGED
|
@@ -185,7 +185,6 @@
|
|
|
185
185
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
186
186
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
187
187
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
188
|
-
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
189
188
|
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
190
189
|
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
191
190
|
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
@@ -303,7 +302,7 @@
|
|
|
303
302
|
*/
|
|
304
303
|
|
|
305
304
|
|
|
306
|
-
const DEFAULT_CHUNK_SIZE$1 =
|
|
305
|
+
const DEFAULT_CHUNK_SIZE$1 = 256 * 1024;
|
|
307
306
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
308
307
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
309
308
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
@@ -2392,7 +2391,7 @@
|
|
|
2392
2391
|
*/
|
|
2393
2392
|
|
|
2394
2393
|
|
|
2395
|
-
const DEFAULT_CHUNK_SIZE =
|
|
2394
|
+
const DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
2396
2395
|
const MESSAGE_EVENT_TYPE = "message";
|
|
2397
2396
|
const MESSAGE_START = "start";
|
|
2398
2397
|
const MESSAGE_PULL = "pull";
|
|
@@ -2598,7 +2597,7 @@
|
|
|
2598
2597
|
class CodecWorker {
|
|
2599
2598
|
|
|
2600
2599
|
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2601
|
-
const { options, config, streamOptions, useWebWorkers,
|
|
2600
|
+
const { options, config, streamOptions, useWebWorkers, workerURI } = workerOptions;
|
|
2602
2601
|
let { createWorker } = workerOptions;
|
|
2603
2602
|
const { signal } = streamOptions;
|
|
2604
2603
|
if (createWorkerFailed) {
|
|
@@ -2615,7 +2614,6 @@
|
|
|
2615
2614
|
workerOptions,
|
|
2616
2615
|
workerURI,
|
|
2617
2616
|
createWorker,
|
|
2618
|
-
transferStreams,
|
|
2619
2617
|
terminate() {
|
|
2620
2618
|
return new Promise(resolve => {
|
|
2621
2619
|
const { worker, busy } = workerData;
|
|
@@ -2793,12 +2791,6 @@
|
|
|
2793
2791
|
const ABORT_EVENT_TYPE = "abort";
|
|
2794
2792
|
|
|
2795
2793
|
let webWorkerSource, webWorkerURI, webWorkerOptions;
|
|
2796
|
-
let transferStreamsSupported = true;
|
|
2797
|
-
try {
|
|
2798
|
-
transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
|
|
2799
|
-
} catch {
|
|
2800
|
-
// ignored
|
|
2801
|
-
}
|
|
2802
2794
|
|
|
2803
2795
|
setWebWorkerBackend(createWebWorkerInterface);
|
|
2804
2796
|
|
|
@@ -2885,14 +2877,11 @@
|
|
|
2885
2877
|
});
|
|
2886
2878
|
const { readable, options } = workerData;
|
|
2887
2879
|
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable, workerData);
|
|
2888
|
-
let streamsTransferred;
|
|
2889
2880
|
try {
|
|
2890
|
-
|
|
2881
|
+
sendMessage({
|
|
2891
2882
|
type: MESSAGE_START,
|
|
2892
2883
|
options,
|
|
2893
|
-
config
|
|
2894
|
-
readable,
|
|
2895
|
-
writable
|
|
2884
|
+
config
|
|
2896
2885
|
}, workerData);
|
|
2897
2886
|
} catch (error) {
|
|
2898
2887
|
abortPipe();
|
|
@@ -2904,12 +2893,10 @@
|
|
|
2904
2893
|
workerData.onTaskFinished();
|
|
2905
2894
|
throw error;
|
|
2906
2895
|
}
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
});
|
|
2912
|
-
}
|
|
2896
|
+
Object.assign(workerData, {
|
|
2897
|
+
reader: readable.getReader(),
|
|
2898
|
+
writer: writable.getWriter()
|
|
2899
|
+
});
|
|
2913
2900
|
const { workerStartupTimeout } = config;
|
|
2914
2901
|
if (!workerData.workerAlive && Number.isFinite(workerStartupTimeout) && workerStartupTimeout >= 0) {
|
|
2915
2902
|
workerData.startupTimeout = setTimeout(() => onStartupTimeout(workerData), workerStartupTimeout);
|
|
@@ -2942,7 +2929,7 @@
|
|
|
2942
2929
|
}
|
|
2943
2930
|
|
|
2944
2931
|
async function closeWritable() {
|
|
2945
|
-
if (!
|
|
2932
|
+
if (!writable.locked) {
|
|
2946
2933
|
try {
|
|
2947
2934
|
await writable.getWriter().close();
|
|
2948
2935
|
} catch {
|
|
@@ -3133,31 +3120,14 @@
|
|
|
3133
3120
|
}
|
|
3134
3121
|
}
|
|
3135
3122
|
|
|
3136
|
-
function sendMessage(message, { worker, writer
|
|
3123
|
+
function sendMessage(message, { worker, writer }) {
|
|
3137
3124
|
try {
|
|
3138
|
-
const { value
|
|
3139
|
-
const transferables = [];
|
|
3125
|
+
const { value } = message;
|
|
3140
3126
|
if (value) {
|
|
3141
3127
|
message.value = toExactUint8Array(value);
|
|
3142
|
-
transferables.push(message.value.buffer);
|
|
3143
|
-
}
|
|
3144
|
-
if (transferStreams && transferStreamsSupported && workerAlive) {
|
|
3145
|
-
if (readable) {
|
|
3146
|
-
transferables.push(readable);
|
|
3147
|
-
}
|
|
3148
|
-
if (writable) {
|
|
3149
|
-
transferables.push(writable);
|
|
3150
|
-
}
|
|
3151
|
-
} else {
|
|
3152
|
-
message.readable = message.writable = null;
|
|
3153
|
-
}
|
|
3154
|
-
if (transferables.length) {
|
|
3155
3128
|
try {
|
|
3156
|
-
worker.postMessage(message,
|
|
3157
|
-
return true;
|
|
3129
|
+
worker.postMessage(message, [message.value.buffer]);
|
|
3158
3130
|
} catch {
|
|
3159
|
-
transferStreamsSupported = false;
|
|
3160
|
-
message.readable = message.writable = null;
|
|
3161
3131
|
worker.postMessage(message);
|
|
3162
3132
|
}
|
|
3163
3133
|
} else {
|
|
@@ -3306,7 +3276,7 @@
|
|
|
3306
3276
|
|
|
3307
3277
|
async function runWorker(stream, workerOptions) {
|
|
3308
3278
|
const { options, config } = workerOptions;
|
|
3309
|
-
const {
|
|
3279
|
+
const { useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3310
3280
|
const { workerURI, createWorker, maxWorkers } = config;
|
|
3311
3281
|
if (format) {
|
|
3312
3282
|
if (codecURI) {
|
|
@@ -3314,7 +3284,6 @@
|
|
|
3314
3284
|
}
|
|
3315
3285
|
await ensureCodecStreams(format, options.codecURI);
|
|
3316
3286
|
}
|
|
3317
|
-
workerOptions.transferStreams = !format && (transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams));
|
|
3318
3287
|
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3319
3288
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3320
3289
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
@@ -5116,17 +5085,6 @@
|
|
|
5116
5085
|
if (filename === UNDEFINED_VALUE) {
|
|
5117
5086
|
filename = decodeText(rawFilename, rawFilenameEncoding);
|
|
5118
5087
|
}
|
|
5119
|
-
if (normalizeFilename) {
|
|
5120
|
-
const normalizedFilename = normalizeFilename(filename);
|
|
5121
|
-
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5122
|
-
filename = normalizedFilename;
|
|
5123
|
-
}
|
|
5124
|
-
}
|
|
5125
|
-
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5126
|
-
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5127
|
-
error.filename = filename;
|
|
5128
|
-
throw error;
|
|
5129
|
-
}
|
|
5130
5088
|
let comment = decode(rawComment, rawCommentEncoding, TEXT_TYPE_COMMENT);
|
|
5131
5089
|
if (comment === UNDEFINED_VALUE) {
|
|
5132
5090
|
comment = decodeText(rawComment, rawCommentEncoding);
|
|
@@ -5154,7 +5112,20 @@
|
|
|
5154
5112
|
filename,
|
|
5155
5113
|
comment
|
|
5156
5114
|
});
|
|
5157
|
-
|
|
5115
|
+
const malformedExtraField = readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
5116
|
+
filename = fileEntry.filename;
|
|
5117
|
+
if (normalizeFilename) {
|
|
5118
|
+
const normalizedFilename = normalizeFilename(filename);
|
|
5119
|
+
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5120
|
+
filename = fileEntry.filename = normalizedFilename;
|
|
5121
|
+
}
|
|
5122
|
+
}
|
|
5123
|
+
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5124
|
+
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5125
|
+
error.filename = filename;
|
|
5126
|
+
throw error;
|
|
5127
|
+
}
|
|
5128
|
+
if (malformedExtraField) {
|
|
5158
5129
|
addWarning(warnings, WARNING_MALFORMED_EXTRA_FIELD, filename);
|
|
5159
5130
|
}
|
|
5160
5131
|
fileEntry.offset += prependedDataLength;
|
|
@@ -5558,7 +5529,6 @@
|
|
|
5558
5529
|
encrypted,
|
|
5559
5530
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
5560
5531
|
useCompressionStream,
|
|
5561
|
-
transferStreams: getOptionValue$1(zipEntry, options, OPTION_TRANSFER_STREAMS),
|
|
5562
5532
|
deflate64,
|
|
5563
5533
|
format: registeredCodec ? registeredCodec.format : UNDEFINED_VALUE,
|
|
5564
5534
|
codecURI: registeredCodec ? registeredCodec.codecURI : UNDEFINED_VALUE,
|
|
@@ -5788,19 +5758,17 @@
|
|
|
5788
5758
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
5789
5759
|
directory.extraFieldNTFS = extraFieldNTFS;
|
|
5790
5760
|
}
|
|
5791
|
-
const
|
|
5761
|
+
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5792
5762
|
let unixIdsRead;
|
|
5763
|
+
if (extraFieldInfoZip) {
|
|
5764
|
+
unixIdsRead = readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5765
|
+
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5766
|
+
}
|
|
5767
|
+
const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
|
|
5793
5768
|
if (extraFieldUnix) {
|
|
5794
|
-
|
|
5769
|
+
readExtraFieldUnix(extraFieldUnix, unixIdsRead ? {} : directory, false);
|
|
5795
5770
|
directory.extraFieldUnix = extraFieldUnix;
|
|
5796
5771
|
}
|
|
5797
|
-
if (!unixIdsRead) {
|
|
5798
|
-
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5799
|
-
if (extraFieldInfoZip) {
|
|
5800
|
-
readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5801
|
-
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5802
|
-
}
|
|
5803
|
-
}
|
|
5804
5772
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
5805
5773
|
if (extraFieldExtendedTimestamp) {
|
|
5806
5774
|
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
@@ -6026,19 +5994,11 @@
|
|
|
6026
5994
|
const zip64 = Boolean(extraFieldZip64);
|
|
6027
5995
|
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6028
5996
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6029
|
-
const
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6035
|
-
localDataDescriptor = candidate;
|
|
6036
|
-
break;
|
|
6037
|
-
}
|
|
6038
|
-
}
|
|
6039
|
-
if (!localDataDescriptor) {
|
|
6040
|
-
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6041
|
-
}
|
|
5997
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
5998
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
5999
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6000
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6001
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6042
6002
|
if (localDataDescriptor) {
|
|
6043
6003
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6044
6004
|
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
@@ -6695,6 +6655,7 @@
|
|
|
6695
6655
|
rawExtraFieldExtendedTimestamp: EMPTY_UINT8_ARRAY,
|
|
6696
6656
|
rawExtraFieldNTFS: EMPTY_UINT8_ARRAY,
|
|
6697
6657
|
rawExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6658
|
+
rawCentralExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6698
6659
|
rawExtraField,
|
|
6699
6660
|
rawCentralExtraField: EMPTY_UINT8_ARRAY,
|
|
6700
6661
|
headerArray,
|
|
@@ -7263,7 +7224,6 @@
|
|
|
7263
7224
|
const ntfsTimestamp = getOptionValue(zipWriter, options, OPTION_NTFS_TIMESTAMP);
|
|
7264
7225
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
7265
7226
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
7266
|
-
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS);
|
|
7267
7227
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
7268
7228
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
7269
7229
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
@@ -7329,7 +7289,6 @@
|
|
|
7329
7289
|
ntfsTimestamp,
|
|
7330
7290
|
keepOrder,
|
|
7331
7291
|
useWebWorkers,
|
|
7332
|
-
transferStreams,
|
|
7333
7292
|
bufferedWrite,
|
|
7334
7293
|
createTempStream,
|
|
7335
7294
|
dataDescriptorSignature,
|
|
@@ -7388,7 +7347,7 @@
|
|
|
7388
7347
|
if (reader) {
|
|
7389
7348
|
reader = new GenericReader(reader);
|
|
7390
7349
|
await initStream(reader);
|
|
7391
|
-
if (!reader.
|
|
7350
|
+
if (!reader.readUint8Array && !reader.readable) {
|
|
7392
7351
|
throw new Error(ERR_INVALID_READER);
|
|
7393
7352
|
}
|
|
7394
7353
|
({ size: contentSize } = reader);
|
|
@@ -7749,6 +7708,7 @@
|
|
|
7749
7708
|
extraFieldExtendedTimestampTime,
|
|
7750
7709
|
rawExtraFieldNTFS,
|
|
7751
7710
|
rawExtraFieldUnix,
|
|
7711
|
+
rawCentralExtraFieldUnix,
|
|
7752
7712
|
rawExtraFieldAES,
|
|
7753
7713
|
} = headerInfo;
|
|
7754
7714
|
const { dataDescriptorArray } = dataDescriptorInfo;
|
|
@@ -7773,7 +7733,6 @@
|
|
|
7773
7733
|
rawExtraField,
|
|
7774
7734
|
rawCentralExtraField,
|
|
7775
7735
|
useWebWorkers,
|
|
7776
|
-
transferStreams,
|
|
7777
7736
|
onstart,
|
|
7778
7737
|
onprogress,
|
|
7779
7738
|
onend,
|
|
@@ -7815,6 +7774,7 @@
|
|
|
7815
7774
|
rawExtraFieldExtendedTimestamp,
|
|
7816
7775
|
rawExtraFieldNTFS,
|
|
7817
7776
|
rawExtraFieldUnix,
|
|
7777
|
+
rawCentralExtraFieldUnix,
|
|
7818
7778
|
rawExtraFieldAES,
|
|
7819
7779
|
rawExtraField,
|
|
7820
7780
|
rawCentralExtraField,
|
|
@@ -7861,7 +7821,6 @@
|
|
|
7861
7821
|
encrypted: encrypted && !passThroughEncryption,
|
|
7862
7822
|
useWebWorkers,
|
|
7863
7823
|
useCompressionStream,
|
|
7864
|
-
transferStreams,
|
|
7865
7824
|
format,
|
|
7866
7825
|
codecURI,
|
|
7867
7826
|
compressionMethod
|
|
@@ -8039,6 +7998,7 @@
|
|
|
8039
7998
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = EMPTY_UINT8_ARRAY;
|
|
8040
7999
|
}
|
|
8041
8000
|
let rawExtraFieldUnix;
|
|
8001
|
+
let rawCentralExtraFieldUnix;
|
|
8042
8002
|
try {
|
|
8043
8003
|
const { uid, gid, unixExtraFieldType } = options;
|
|
8044
8004
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
@@ -8053,7 +8013,7 @@
|
|
|
8053
8013
|
extraFieldUnix.writeBytes(uidBytes);
|
|
8054
8014
|
extraFieldUnix.writeUint8(gidBytes.length);
|
|
8055
8015
|
extraFieldUnix.writeBytes(gidBytes);
|
|
8056
|
-
rawExtraFieldUnix = extraFieldUnix.array;
|
|
8016
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = extraFieldUnix.array;
|
|
8057
8017
|
} else if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
8058
8018
|
const extraFieldUnix = createRecordWriter(8);
|
|
8059
8019
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
@@ -8061,11 +8021,15 @@
|
|
|
8061
8021
|
extraFieldUnix.writeUint16((uid === UNDEFINED_VALUE ? 0 : uid) & MAX_16_BITS);
|
|
8062
8022
|
extraFieldUnix.writeUint16((gid === UNDEFINED_VALUE ? 0 : gid) & MAX_16_BITS);
|
|
8063
8023
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
8024
|
+
const centralExtraFieldUnix = createRecordWriter(4);
|
|
8025
|
+
centralExtraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
8026
|
+
centralExtraFieldUnix.writeUint16(0);
|
|
8027
|
+
rawCentralExtraFieldUnix = centralExtraFieldUnix.array;
|
|
8064
8028
|
} else {
|
|
8065
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8029
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8066
8030
|
}
|
|
8067
8031
|
} catch {
|
|
8068
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8032
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
8069
8033
|
}
|
|
8070
8034
|
if (compressionMethod === UNDEFINED_VALUE) {
|
|
8071
8035
|
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
@@ -8157,6 +8121,7 @@
|
|
|
8157
8121
|
rawExtraFieldExtendedTimestamp,
|
|
8158
8122
|
rawExtraFieldNTFS,
|
|
8159
8123
|
rawExtraFieldUnix,
|
|
8124
|
+
rawCentralExtraFieldUnix,
|
|
8160
8125
|
rawExtraFieldAES,
|
|
8161
8126
|
extraFieldLength
|
|
8162
8127
|
};
|
|
@@ -8332,7 +8297,7 @@
|
|
|
8332
8297
|
rawExtraFieldAES,
|
|
8333
8298
|
rawComment,
|
|
8334
8299
|
rawExtraFieldNTFS,
|
|
8335
|
-
|
|
8300
|
+
rawCentralExtraFieldUnix,
|
|
8336
8301
|
rawExtraField,
|
|
8337
8302
|
rawCentralExtraField,
|
|
8338
8303
|
extraFieldExtendedTimestampFlag,
|
|
@@ -8394,7 +8359,7 @@
|
|
|
8394
8359
|
rawExtraFieldZip64,
|
|
8395
8360
|
rawExtraFieldAES,
|
|
8396
8361
|
rawExtraFieldNTFS,
|
|
8397
|
-
|
|
8362
|
+
rawCentralExtraFieldUnix,
|
|
8398
8363
|
rawExtraFieldTimestamp,
|
|
8399
8364
|
rawExtraField,
|
|
8400
8365
|
rawCentralExtraField);
|
|
@@ -8423,7 +8388,7 @@
|
|
|
8423
8388
|
rawExtraFieldAES,
|
|
8424
8389
|
rawExtraFieldExtendedTimestamp,
|
|
8425
8390
|
rawExtraFieldNTFS,
|
|
8426
|
-
|
|
8391
|
+
rawCentralExtraFieldUnix,
|
|
8427
8392
|
rawExtraField,
|
|
8428
8393
|
rawCentralExtraField,
|
|
8429
8394
|
rawComment,
|
|
@@ -8440,7 +8405,7 @@
|
|
|
8440
8405
|
uncompressedSize,
|
|
8441
8406
|
compressedSize
|
|
8442
8407
|
} = fileEntry;
|
|
8443
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS,
|
|
8408
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawCentralExtraFieldUnix, rawExtraField, rawCentralExtraField);
|
|
8444
8409
|
const directoryRecordLength = CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
8445
8410
|
if (exceedsAvailableSize(writer, offset + directoryRecordLength - directoryDiskOffset)) {
|
|
8446
8411
|
await writeData(writer, directoryArray.slice(directoryDiskOffset, offset));
|
|
@@ -8476,7 +8441,7 @@
|
|
|
8476
8441
|
directoryRecord.writeBytes(rawExtraFieldAES);
|
|
8477
8442
|
directoryRecord.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
8478
8443
|
directoryRecord.writeBytes(rawExtraFieldNTFS);
|
|
8479
|
-
directoryRecord.writeBytes(
|
|
8444
|
+
directoryRecord.writeBytes(rawCentralExtraFieldUnix);
|
|
8480
8445
|
directoryRecord.writeBytes(rawExtraField);
|
|
8481
8446
|
directoryRecord.writeBytes(rawCentralExtraField);
|
|
8482
8447
|
directoryRecord.writeBytes(rawComment);
|
|
@@ -9053,7 +9018,7 @@
|
|
|
9053
9018
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9054
9019
|
*/
|
|
9055
9020
|
|
|
9056
|
-
const VERSION = "2.
|
|
9021
|
+
const VERSION = "2.19.0";
|
|
9057
9022
|
|
|
9058
9023
|
/*
|
|
9059
9024
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|