@zip.js/zip.js 2.8.46 → 2.8.48
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/deno.json +1 -1
- package/dist/zip-core-external.js +130 -35
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +140 -34
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +131 -36
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +115 -32
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +131 -36
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +145 -37
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +144 -36
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +142 -36
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +142 -36
- 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 +141 -35
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +145 -37
- package/index-native.min.js +1 -1
- package/index.cjs +144 -36
- package/index.d.cts +141 -0
- package/index.d.ts +141 -0
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +6 -3
- package/lib/core/codec-worker.js +2 -1
- package/lib/core/constants.js +2 -0
- package/lib/core/io.js +3 -23
- package/lib/core/options.js +4 -0
- package/lib/core/streams/codec-stream.js +2 -0
- package/lib/core/streams/common-crypto.js +2 -1
- package/lib/core/streams/zip-entry-stream.js +4 -2
- package/lib/core/util/blob-temp-stream.js +4 -2
- package/lib/core/util/compatible-streams.js +30 -2
- package/lib/core/util/opfs-temp-stream.js +8 -1
- package/lib/core/util/sync-access-handle-temp-stream.js +10 -2
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +3 -2
- package/lib/core/zip-reader.js +62 -9
- package/lib/core/zip-writer.js +43 -8
- package/lib/zip-core-base.js +2 -1
- package/lib/zip-core-reader.js +2 -1
- package/lib/zip-core-writer.js +10 -1
- package/package.json +2 -1
package/dist/zip-core.js
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
const SPLIT_ZIP_FILE_SIGNATURE = 0x08074b50;
|
|
48
48
|
const DATA_DESCRIPTOR_RECORD_SIGNATURE = SPLIT_ZIP_FILE_SIGNATURE;
|
|
49
49
|
const ARCHIVE_EXTRA_DATA_SIGNATURE = 0x08064b50;
|
|
50
|
+
const DIGITAL_SIGNATURE_RECORD_SIGNATURE = 0x05054b50;
|
|
50
51
|
const CENTRAL_FILE_HEADER_SIGNATURE = 0x02014b50;
|
|
51
52
|
const END_OF_CENTRAL_DIR_SIGNATURE = 0x06054b50;
|
|
52
53
|
const ZIP64_END_OF_CENTRAL_DIR_SIGNATURE = 0x06064b50;
|
|
@@ -1873,6 +1874,8 @@
|
|
|
1873
1874
|
*/
|
|
1874
1875
|
|
|
1875
1876
|
|
|
1877
|
+
const HTTP_HEADER_CONTENT_TYPE = "Content-Type";
|
|
1878
|
+
|
|
1876
1879
|
function toCompatibleReadable(readable) {
|
|
1877
1880
|
if (readable instanceof ReadableStream) {
|
|
1878
1881
|
return readable;
|
|
@@ -1893,6 +1896,29 @@
|
|
|
1893
1896
|
});
|
|
1894
1897
|
}
|
|
1895
1898
|
|
|
1899
|
+
function streamToBlob(readable, contentType) {
|
|
1900
|
+
readable = toCompatibleReadable(readable);
|
|
1901
|
+
if (responseSupportsGlobalReadable()) {
|
|
1902
|
+
const options = {};
|
|
1903
|
+
if (contentType) {
|
|
1904
|
+
options.headers = [[HTTP_HEADER_CONTENT_TYPE, contentType]];
|
|
1905
|
+
}
|
|
1906
|
+
return new Response(readable, options).blob();
|
|
1907
|
+
}
|
|
1908
|
+
const chunks = [];
|
|
1909
|
+
return readable
|
|
1910
|
+
.pipeTo(new WritableStream({
|
|
1911
|
+
write(chunk) {
|
|
1912
|
+
chunks.push(chunk);
|
|
1913
|
+
}
|
|
1914
|
+
}))
|
|
1915
|
+
.then(() => new Blob(chunks, contentType ? { type: contentType } : {}));
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
function responseSupportsGlobalReadable() {
|
|
1919
|
+
return typeof Blob.prototype.stream != FUNCTION_TYPE || new Blob([]).stream() instanceof ReadableStream;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1896
1922
|
function toCompatibleWritable(writable) {
|
|
1897
1923
|
if (writable instanceof WritableStream) {
|
|
1898
1924
|
return writable;
|
|
@@ -3232,7 +3258,6 @@
|
|
|
3232
3258
|
const HTTP_HEADER_CONTENT_RANGE = "Content-Range";
|
|
3233
3259
|
const HTTP_HEADER_ACCEPT_RANGES = "Accept-Ranges";
|
|
3234
3260
|
const HTTP_HEADER_RANGE = "Range";
|
|
3235
|
-
const HTTP_HEADER_CONTENT_TYPE = "Content-Type";
|
|
3236
3261
|
const HTTP_HEADER_ETAG = "Etag";
|
|
3237
3262
|
const HTTP_HEADER_LAST_MODIFIED = "Last-Modified";
|
|
3238
3263
|
const HTTP_METHOD_HEAD = "HEAD";
|
|
@@ -3437,10 +3462,6 @@
|
|
|
3437
3462
|
}
|
|
3438
3463
|
}
|
|
3439
3464
|
|
|
3440
|
-
function responseSupportsGlobalReadable() {
|
|
3441
|
-
return typeof Blob.prototype.stream != FUNCTION_TYPE || new Blob([]).stream() instanceof ReadableStream;
|
|
3442
|
-
}
|
|
3443
|
-
|
|
3444
3465
|
class BlobWriter extends Stream {
|
|
3445
3466
|
|
|
3446
3467
|
constructor(contentType) {
|
|
@@ -3452,22 +3473,7 @@
|
|
|
3452
3473
|
return transformStream.writable;
|
|
3453
3474
|
}
|
|
3454
3475
|
});
|
|
3455
|
-
|
|
3456
|
-
const headers = [];
|
|
3457
|
-
if (contentType) {
|
|
3458
|
-
headers.push([HTTP_HEADER_CONTENT_TYPE, contentType]);
|
|
3459
|
-
}
|
|
3460
|
-
writer.blob = new Response(transformStream.readable, { headers }).blob();
|
|
3461
|
-
} else {
|
|
3462
|
-
const chunks = [];
|
|
3463
|
-
writer.blob = transformStream.readable
|
|
3464
|
-
.pipeTo(new WritableStream({
|
|
3465
|
-
write(chunk) {
|
|
3466
|
-
chunks.push(chunk);
|
|
3467
|
-
}
|
|
3468
|
-
}))
|
|
3469
|
-
.then(() => new Blob(chunks, { type: contentType }));
|
|
3470
|
-
}
|
|
3476
|
+
writer.blob = streamToBlob(transformStream.readable, contentType);
|
|
3471
3477
|
writer.blob.catch(() => { });
|
|
3472
3478
|
}
|
|
3473
3479
|
|
|
@@ -4454,6 +4460,8 @@
|
|
|
4454
4460
|
const OPTION_LOCAL_EXTRA_FIELD = "localExtraField";
|
|
4455
4461
|
const OPTION_STRICTNESS = "strictness";
|
|
4456
4462
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
4463
|
+
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
4464
|
+
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
4457
4465
|
const STRICTNESS_STRICT = "strict";
|
|
4458
4466
|
const STRICTNESS_BALANCED = "balanced";
|
|
4459
4467
|
const STRICTNESS_TOLERANT = "tolerant";
|
|
@@ -4539,7 +4547,7 @@
|
|
|
4539
4547
|
const { config } = zipReader;
|
|
4540
4548
|
await initStream(reader);
|
|
4541
4549
|
if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) {
|
|
4542
|
-
reader = new BlobReader(await
|
|
4550
|
+
reader = new BlobReader(await streamToBlob(reader.readable));
|
|
4543
4551
|
await initStream(reader);
|
|
4544
4552
|
}
|
|
4545
4553
|
if (reader.size < END_OF_CENTRAL_DIR_LENGTH) {
|
|
@@ -4579,6 +4587,7 @@
|
|
|
4579
4587
|
let startOffset;
|
|
4580
4588
|
let zip64EndOfDirectory;
|
|
4581
4589
|
let zip64EndOfDirectoryVersion2;
|
|
4590
|
+
let directoryEncryptionInfo;
|
|
4582
4591
|
const requiresZip64 = directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS || diskNumber == MAX_16_BITS;
|
|
4583
4592
|
if (directoryDataOffset != MAX_32_BITS && diskNumber != MAX_16_BITS) {
|
|
4584
4593
|
directoryDataOffset += getDiskOffset$1(reader, diskNumber);
|
|
@@ -4609,6 +4618,15 @@
|
|
|
4609
4618
|
}
|
|
4610
4619
|
zip64EndOfDirectory = true;
|
|
4611
4620
|
zip64EndOfDirectoryVersion2 = getBigUint64(endOfDirectoryView, 4) > ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12;
|
|
4621
|
+
if (zip64EndOfDirectoryVersion2) {
|
|
4622
|
+
const extensibleDataLength = Math.min(
|
|
4623
|
+
Number(getBigUint64(endOfDirectoryView, 4)) - (ZIP64_END_OF_CENTRAL_DIR_LENGTH - 12),
|
|
4624
|
+
reader.size - directoryDataOffset - ZIP64_END_OF_CENTRAL_DIR_LENGTH);
|
|
4625
|
+
if (extensibleDataLength > 0) {
|
|
4626
|
+
const rawExtensibleData = await readUint8Array(reader, directoryDataOffset + ZIP64_END_OF_CENTRAL_DIR_LENGTH, extensibleDataLength);
|
|
4627
|
+
directoryEncryptionInfo = getDirectoryEncryptionInfo(rawExtensibleData);
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4612
4630
|
if (lastDiskNumber == MAX_16_BITS) {
|
|
4613
4631
|
lastDiskNumber = getUint32(endOfDirectoryView, 16);
|
|
4614
4632
|
} else if (checkAmbiguity && lastDiskNumber != getUint32(endOfDirectoryView, 16)) {
|
|
@@ -4632,7 +4650,7 @@
|
|
|
4632
4650
|
directoryDataOffset = getDiskOffset$1(reader, diskNumber) + getBigUint64(endOfDirectoryView, 48) + prependedDataLength;
|
|
4633
4651
|
}
|
|
4634
4652
|
}
|
|
4635
|
-
|
|
4653
|
+
let declaredDirectoryDataLength = directoryDataLength;
|
|
4636
4654
|
const centralDirectoryEndOffset = endOfDirectoryInfo.offset -
|
|
4637
4655
|
(zip64EndOfDirectory ? ZIP64_END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH : 0);
|
|
4638
4656
|
if (directoryDataOffset >= reader.size) {
|
|
@@ -4680,6 +4698,18 @@
|
|
|
4680
4698
|
if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
|
|
4681
4699
|
throw new Error(ERR_BAD_FORMAT);
|
|
4682
4700
|
}
|
|
4701
|
+
zipReader.directoryOffset = directoryDataOffset;
|
|
4702
|
+
zipReader.directoryLength = declaredDirectoryDataLength;
|
|
4703
|
+
const decryptCentralDirectory = getOptionValue$1(zipReader, options, OPTION_DECRYPT_CENTRAL_DIRECTORY);
|
|
4704
|
+
let decryptedDirectory;
|
|
4705
|
+
if (decryptCentralDirectory && filesLength && directoryArray.length >= 4 &&
|
|
4706
|
+
getUint32(directoryView, 0) != CENTRAL_FILE_HEADER_SIGNATURE &&
|
|
4707
|
+
(zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4708
|
+
directoryArray = await decryptCentralDirectory(directoryArray, directoryEncryptionInfo);
|
|
4709
|
+
directoryView = getDataView(directoryArray);
|
|
4710
|
+
declaredDirectoryDataLength = directoryArray.length;
|
|
4711
|
+
decryptedDirectory = true;
|
|
4712
|
+
}
|
|
4683
4713
|
startOffset = directoryDataOffset;
|
|
4684
4714
|
const filenameEncoding = getOptionValue$1(zipReader, options, OPTION_FILENAME_ENCODING);
|
|
4685
4715
|
const commentEncoding = getOptionValue$1(zipReader, options, OPTION_COMMENT_ENCODING);
|
|
@@ -4688,7 +4718,7 @@
|
|
|
4688
4718
|
for (let indexFile = 0; indexFile < filesLength; indexFile++) {
|
|
4689
4719
|
const fileEntry = new ZipEntry(reader, config, zipReader.options);
|
|
4690
4720
|
if (offset + CENTRAL_FILE_HEADER_LENGTH > directoryArray.length || getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {
|
|
4691
|
-
if (indexFile == 0 && (zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4721
|
+
if (indexFile == 0 && !decryptedDirectory && (zip64EndOfDirectoryVersion2 || detectEncryptedCentralDirectory(directoryView))) {
|
|
4692
4722
|
throw new Error(ERR_ENCRYPTED_CENTRAL_DIRECTORY);
|
|
4693
4723
|
}
|
|
4694
4724
|
throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);
|
|
@@ -4786,7 +4816,7 @@
|
|
|
4786
4816
|
entry.arrayBuffer = async options => {
|
|
4787
4817
|
const writer = new TransformStream();
|
|
4788
4818
|
const [arrayBuffer] = await Promise.all([
|
|
4789
|
-
|
|
4819
|
+
streamToBlob(writer.readable).then(blob => blob.arrayBuffer()),
|
|
4790
4820
|
fileEntry.getData(writer, entry, zipReader.readRanges, options)]);
|
|
4791
4821
|
return arrayBuffer;
|
|
4792
4822
|
};
|
|
@@ -4801,7 +4831,15 @@
|
|
|
4801
4831
|
}
|
|
4802
4832
|
yield entry;
|
|
4803
4833
|
}
|
|
4804
|
-
|
|
4834
|
+
let offsetAfterSignature = offset;
|
|
4835
|
+
if (offset + 6 <= directoryArray.length && getUint32(directoryView, offset) == DIGITAL_SIGNATURE_RECORD_SIGNATURE) {
|
|
4836
|
+
const signatureDataLength = getUint16(directoryView, offset + 4);
|
|
4837
|
+
if (offset + 6 + signatureDataLength <= directoryArray.length) {
|
|
4838
|
+
zipReader.digitalSignature = directoryArray.subarray(offset + 6, offset + 6 + signatureDataLength);
|
|
4839
|
+
offsetAfterSignature = offset + 6 + signatureDataLength;
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
if (checkAmbiguity && offset != declaredDirectoryDataLength && offsetAfterSignature != declaredDirectoryDataLength) {
|
|
4805
4843
|
throwAmbiguousArchive("trailing central directory data");
|
|
4806
4844
|
}
|
|
4807
4845
|
if (duplicateFilename) {
|
|
@@ -5073,6 +5111,25 @@
|
|
|
5073
5111
|
return false;
|
|
5074
5112
|
}
|
|
5075
5113
|
|
|
5114
|
+
function getDirectoryEncryptionInfo(rawExtensibleData) {
|
|
5115
|
+
const directoryEncryptionInfo = { rawExtensibleData };
|
|
5116
|
+
if (rawExtensibleData.length >= 28) {
|
|
5117
|
+
const extensibleDataView = getDataView(rawExtensibleData);
|
|
5118
|
+
const hashDataLength = getUint16(extensibleDataView, 26);
|
|
5119
|
+
Object.assign(directoryEncryptionInfo, {
|
|
5120
|
+
compressionMethod: getUint16(extensibleDataView, 0),
|
|
5121
|
+
compressedSize: Number(getBigUint64(extensibleDataView, 2)),
|
|
5122
|
+
uncompressedSize: Number(getBigUint64(extensibleDataView, 10)),
|
|
5123
|
+
encryptionAlgorithm: getUint16(extensibleDataView, 18),
|
|
5124
|
+
bitLength: getUint16(extensibleDataView, 20),
|
|
5125
|
+
flags: getUint16(extensibleDataView, 22),
|
|
5126
|
+
hashAlgorithm: getUint16(extensibleDataView, 24),
|
|
5127
|
+
hashData: rawExtensibleData.subarray(28, 28 + hashDataLength)
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5130
|
+
return directoryEncryptionInfo;
|
|
5131
|
+
}
|
|
5132
|
+
|
|
5076
5133
|
function readCommonHeader(directory, dataView, offset) {
|
|
5077
5134
|
const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);
|
|
5078
5135
|
const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
|
|
@@ -5624,6 +5681,7 @@
|
|
|
5624
5681
|
ERR_SPLIT_ZIP_FILE: ERR_SPLIT_ZIP_FILE,
|
|
5625
5682
|
ERR_UNSUPPORTED_COMPRESSION: ERR_UNSUPPORTED_COMPRESSION$1,
|
|
5626
5683
|
ERR_UNSUPPORTED_ENCRYPTION: ERR_UNSUPPORTED_ENCRYPTION,
|
|
5684
|
+
ERR_WORKER_STARTUP_TIMEOUT: ERR_WORKER_STARTUP_TIMEOUT,
|
|
5627
5685
|
ZipReader: ZipReader,
|
|
5628
5686
|
ZipReaderStream: ZipReaderStream
|
|
5629
5687
|
});
|
|
@@ -5682,6 +5740,7 @@
|
|
|
5682
5740
|
const ERR_INVALID_UNIX_ID_SIZE = "uid/gid must be 0..65535 for unixExtraFieldType 'unix' (use 'infozip' for larger ids)";
|
|
5683
5741
|
const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be integer 0..255)";
|
|
5684
5742
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
5743
|
+
const ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
5685
5744
|
|
|
5686
5745
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
5687
5746
|
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
@@ -7041,8 +7100,9 @@
|
|
|
7041
7100
|
|
|
7042
7101
|
async function closeFile(zipWriter, comment, options) {
|
|
7043
7102
|
const directoryDataLength = createDirectoryRecords(zipWriter.files);
|
|
7044
|
-
const directoryStart = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7045
|
-
await
|
|
7103
|
+
const { directoryStart, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7104
|
+
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7105
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryDataLength, signatureLength });
|
|
7046
7106
|
}
|
|
7047
7107
|
|
|
7048
7108
|
function createDirectoryRecords(files) {
|
|
@@ -7199,12 +7259,33 @@
|
|
|
7199
7259
|
}
|
|
7200
7260
|
}
|
|
7201
7261
|
await writeData(writer, directoryDiskOffset ? directoryArray.slice(directoryDiskOffset) : directoryArray);
|
|
7202
|
-
return {
|
|
7262
|
+
return {
|
|
7263
|
+
directoryStart: { diskNumber: directoryStartDiskNumber, diskOffset: directoryStartDiskOffset },
|
|
7264
|
+
directoryArray
|
|
7265
|
+
};
|
|
7266
|
+
}
|
|
7267
|
+
|
|
7268
|
+
async function writeDigitalSignatureRecord(zipWriter, directoryArray, options) {
|
|
7269
|
+
const signCentralDirectory = getOptionValue(zipWriter, options, OPTION_SIGN_CENTRAL_DIRECTORY);
|
|
7270
|
+
if (signCentralDirectory) {
|
|
7271
|
+
const signatureData = await signCentralDirectory(directoryArray);
|
|
7272
|
+
const signatureDataLength = getLength(signatureData);
|
|
7273
|
+
if (signatureDataLength > MAX_16_BITS) {
|
|
7274
|
+
throw new Error(ERR_INVALID_SIGNATURE_DATA);
|
|
7275
|
+
}
|
|
7276
|
+
const signatureRecord = createRecordWriter(6 + signatureDataLength);
|
|
7277
|
+
signatureRecord.uint32(DIGITAL_SIGNATURE_RECORD_SIGNATURE);
|
|
7278
|
+
signatureRecord.uint16(signatureDataLength);
|
|
7279
|
+
signatureRecord.bytes(signatureData);
|
|
7280
|
+
await writeData(zipWriter.writer, signatureRecord.array);
|
|
7281
|
+
return 6 + signatureDataLength;
|
|
7282
|
+
}
|
|
7283
|
+
return 0;
|
|
7203
7284
|
}
|
|
7204
7285
|
|
|
7205
7286
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
7206
7287
|
const { writer } = zipWriter;
|
|
7207
|
-
const { directoryStart } = cdInfo;
|
|
7288
|
+
const { directoryStart, signatureLength } = cdInfo;
|
|
7208
7289
|
let { directoryDataLength } = cdInfo;
|
|
7209
7290
|
let filesLength = zipWriter.files.size;
|
|
7210
7291
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -7243,7 +7324,7 @@
|
|
|
7243
7324
|
endOfdirectoryRecord.uint64(directoryOffset);
|
|
7244
7325
|
endOfdirectoryRecord.uint32(ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);
|
|
7245
7326
|
endOfdirectoryRecord.uint32(lastDiskNumber);
|
|
7246
|
-
endOfdirectoryRecord.uint64(BigInt(getSegmentOffset(zipWriter, writer)) + BigInt(directoryDataLength));
|
|
7327
|
+
endOfdirectoryRecord.uint64(BigInt(getSegmentOffset(zipWriter, writer)) + BigInt(directoryDataLength) + BigInt(signatureLength));
|
|
7247
7328
|
endOfdirectoryRecord.uint32(lastDiskNumber + 1);
|
|
7248
7329
|
const supportZip64SplitFile = getOptionValue(zipWriter, options, OPTION_SUPPORT_ZIP64_SPLIT_FILE, true);
|
|
7249
7330
|
if (supportZip64SplitFile) {
|
|
@@ -7543,7 +7624,7 @@
|
|
|
7543
7624
|
|
|
7544
7625
|
async function spillToFile() {
|
|
7545
7626
|
const directoryHandle = await getTempDirectory();
|
|
7546
|
-
fileName =
|
|
7627
|
+
fileName = getRandomFileName$1();
|
|
7547
7628
|
fileHandle = await directoryHandle.getFileHandle(fileName, { create: true });
|
|
7548
7629
|
fileWriter = (await fileHandle.createWritable()).getWriter();
|
|
7549
7630
|
spilled = true;
|
|
@@ -7624,6 +7705,13 @@
|
|
|
7624
7705
|
};
|
|
7625
7706
|
}
|
|
7626
7707
|
|
|
7708
|
+
function getRandomFileName$1() {
|
|
7709
|
+
if (crypto.randomUUID) {
|
|
7710
|
+
return crypto.randomUUID();
|
|
7711
|
+
}
|
|
7712
|
+
return Array.from(crypto.getRandomValues(new Uint8Array(16)), byteValue => byteValue.toString(16).padStart(2, "0")).join("");
|
|
7713
|
+
}
|
|
7714
|
+
|
|
7627
7715
|
/*
|
|
7628
7716
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
7629
7717
|
|
|
@@ -7667,7 +7755,7 @@
|
|
|
7667
7755
|
|
|
7668
7756
|
async function spillToBlob() {
|
|
7669
7757
|
const transformStream = new TransformStream();
|
|
7670
|
-
blobPromise =
|
|
7758
|
+
blobPromise = streamToBlob(transformStream.readable);
|
|
7671
7759
|
blobWriter = transformStream.writable.getWriter();
|
|
7672
7760
|
spilled = true;
|
|
7673
7761
|
for (const chunk of memoryChunks) {
|
|
@@ -7807,7 +7895,7 @@
|
|
|
7807
7895
|
|
|
7808
7896
|
async function spillToFile() {
|
|
7809
7897
|
const directoryHandle = await getTempDirectory();
|
|
7810
|
-
fileName =
|
|
7898
|
+
fileName = getRandomFileName();
|
|
7811
7899
|
const fileHandle = await directoryHandle.getFileHandle(fileName, { create: true });
|
|
7812
7900
|
accessHandle = await fileHandle.createSyncAccessHandle();
|
|
7813
7901
|
spilled = true;
|
|
@@ -7887,6 +7975,13 @@
|
|
|
7887
7975
|
};
|
|
7888
7976
|
}
|
|
7889
7977
|
|
|
7978
|
+
function getRandomFileName() {
|
|
7979
|
+
if (crypto.randomUUID) {
|
|
7980
|
+
return crypto.randomUUID();
|
|
7981
|
+
}
|
|
7982
|
+
return Array.from(crypto.getRandomValues(new Uint8Array(16)), byteValue => byteValue.toString(16).padStart(2, "0")).join("");
|
|
7983
|
+
}
|
|
7984
|
+
|
|
7890
7985
|
/*
|
|
7891
7986
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
7892
7987
|
|
|
@@ -7948,9 +8043,17 @@
|
|
|
7948
8043
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|
|
7949
8044
|
exports.ERR_INVALID_EXTRAFIELD_DATA = ERR_INVALID_EXTRAFIELD_DATA;
|
|
7950
8045
|
exports.ERR_INVALID_EXTRAFIELD_TYPE = ERR_INVALID_EXTRAFIELD_TYPE;
|
|
8046
|
+
exports.ERR_INVALID_GID = ERR_INVALID_GID;
|
|
8047
|
+
exports.ERR_INVALID_MSDOS_ATTRIBUTES = ERR_INVALID_MSDOS_ATTRIBUTES;
|
|
8048
|
+
exports.ERR_INVALID_MSDOS_DATA = ERR_INVALID_MSDOS_DATA;
|
|
7951
8049
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
7952
8050
|
exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
|
|
8051
|
+
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
8052
|
+
exports.ERR_INVALID_UID = ERR_INVALID_UID;
|
|
7953
8053
|
exports.ERR_INVALID_UNCOMPRESSED_SIZE = ERR_INVALID_UNCOMPRESSED_SIZE;
|
|
8054
|
+
exports.ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = ERR_INVALID_UNIX_EXTRA_FIELD_TYPE;
|
|
8055
|
+
exports.ERR_INVALID_UNIX_ID_SIZE = ERR_INVALID_UNIX_ID_SIZE;
|
|
8056
|
+
exports.ERR_INVALID_UNIX_MODE = ERR_INVALID_UNIX_MODE;
|
|
7954
8057
|
exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
|
|
7955
8058
|
exports.ERR_ITERATOR_COMPLETED_TOO_SOON = ERR_ITERATOR_COMPLETED_TOO_SOON;
|
|
7956
8059
|
exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
|
|
@@ -7960,9 +8063,12 @@
|
|
|
7960
8063
|
exports.ERR_UNDEFINED_READER = ERR_UNDEFINED_READER;
|
|
7961
8064
|
exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
|
|
7962
8065
|
exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION$1;
|
|
8066
|
+
exports.ERR_UNSUPPORTED_CONTEXT = ERR_UNSUPPORTED_CONTEXT;
|
|
8067
|
+
exports.ERR_UNSUPPORTED_CRYPTO_API = ERR_UNSUPPORTED_CRYPTO_API;
|
|
7963
8068
|
exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
|
|
7964
8069
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
7965
8070
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
8071
|
+
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
7966
8072
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
7967
8073
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|
|
7968
8074
|
exports.HttpRangeReader = HttpRangeReader;
|