@helloao/cli 0.0.9 → 0.0.11
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/dist/cjs/cli.cjs +9669 -6373
- package/dist/cjs/index.cjs +16452 -0
- package/dist/esm/index.js +8102 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/types/actions.d.ts +27 -0
- package/dist/types/db.d.ts +50 -6
- package/dist/types/downloads.d.ts +1 -1
- package/dist/types/files.d.ts +13 -2
- package/dist/types/s3.d.ts +1 -1
- package/dist/types/uploads.d.ts +13 -0
- package/migrations/20241113173937_add_commentaries/migration.sql +56 -0
- package/migrations/20241204173229_add_license_notes/migration.sql +5 -0
- package/migrations/20241204182154_add_book_intro_summaries/migration.sql +2 -0
- package/migrations/20241218211246_add_profiles/migration.sql +12 -0
- package/migrations/20241218211453_add_profile_references/migration.sql +6 -0
- package/node_modules/@zip.js/zip.js/.github/workflows/publish.yml +17 -0
- package/node_modules/@zip.js/zip.js/deno.json +10 -1
- package/node_modules/@zip.js/zip.js/dist/z-worker-fflate.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/z-worker-pako.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/z-worker.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-fs-full.js +274 -133
- package/node_modules/@zip.js/zip.js/dist/zip-fs-full.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-fs.js +274 -125
- package/node_modules/@zip.js/zip.js/dist/zip-fs.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-full.js +233 -122
- package/node_modules/@zip.js/zip.js/dist/zip-full.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-no-worker-deflate.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-no-worker-inflate.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip-no-worker.min.js +1 -1
- package/node_modules/@zip.js/zip.js/dist/zip.js +233 -114
- package/node_modules/@zip.js/zip.js/dist/zip.min.js +1 -1
- package/node_modules/@zip.js/zip.js/eslint.config.mjs +49 -0
- package/node_modules/@zip.js/zip.js/index-fflate.js +2 -1
- package/node_modules/@zip.js/zip.js/index.cjs +274 -133
- package/node_modules/@zip.js/zip.js/index.d.ts +254 -34
- package/node_modules/@zip.js/zip.js/index.js +3 -1
- package/node_modules/@zip.js/zip.js/index.min.js +1 -1
- package/node_modules/@zip.js/zip.js/lib/core/codec-pool.js +3 -1
- package/node_modules/@zip.js/zip.js/lib/core/codec-worker.js +11 -8
- package/node_modules/@zip.js/zip.js/lib/core/configuration.js +2 -1
- package/node_modules/@zip.js/zip.js/lib/core/constants.js +8 -0
- package/node_modules/@zip.js/zip.js/lib/core/io.js +10 -3
- package/node_modules/@zip.js/zip.js/lib/core/streams/aes-crypto-stream.js +4 -3
- package/node_modules/@zip.js/zip.js/lib/core/streams/codecs/deflate.js +0 -4
- package/node_modules/@zip.js/zip.js/lib/core/streams/codecs/inflate.js +0 -4
- package/node_modules/@zip.js/zip.js/lib/core/streams/crc32-stream.js +1 -0
- package/node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js +4 -2
- package/node_modules/@zip.js/zip.js/lib/core/util/mime-type.js +0 -2
- package/node_modules/@zip.js/zip.js/lib/core/util/stream-codec-shim.js +4 -4
- package/node_modules/@zip.js/zip.js/lib/core/z-worker-core.js +4 -2
- package/node_modules/@zip.js/zip.js/lib/core/zip-entry.js +17 -5
- package/node_modules/@zip.js/zip.js/lib/core/zip-fs-core.js +41 -11
- package/node_modules/@zip.js/zip.js/lib/core/zip-reader.js +45 -23
- package/node_modules/@zip.js/zip.js/lib/core/zip-writer.js +147 -66
- package/node_modules/@zip.js/zip.js/lib/z-worker-inline-template.js +1 -1
- package/node_modules/@zip.js/zip.js/lib/z-worker-inline.js +1 -1
- package/node_modules/@zip.js/zip.js/lib/zip-data-uri.js +4 -1
- package/node_modules/@zip.js/zip.js/lib/zip-fs.js +2 -1
- package/node_modules/@zip.js/zip.js/lib/zip-full-fflate.js +2 -1
- package/node_modules/@zip.js/zip.js/lib/zip-full.js +2 -1
- package/node_modules/@zip.js/zip.js/lib/zip.js +2 -1
- package/node_modules/@zip.js/zip.js/package.json +121 -78
- package/package.json +16 -6
- package/prisma-gen/client.d.ts +1 -0
- package/prisma-gen/client.js +4 -0
- package/prisma-gen/default.d.ts +1 -1
- package/prisma-gen/edge.d.ts +1 -1
- package/prisma-gen/edge.js +75 -9
- package/prisma-gen/index-browser.js +70 -4
- package/prisma-gen/index.d.ts +14040 -5448
- package/prisma-gen/index.js +75 -9
- package/prisma-gen/runtime/edge-esm.js +21 -18
- package/prisma-gen/runtime/edge.js +21 -18
- package/prisma-gen/runtime/index-browser.d.ts +1 -1
- package/prisma-gen/runtime/index-browser.js +1 -1
- package/prisma-gen/runtime/library.d.ts +306 -71
- package/prisma-gen/runtime/library.js +70 -67
- package/prisma-gen/runtime/react-native.js +80 -0
- package/prisma-gen/runtime/wasm.js +22 -19
- package/prisma-gen/wasm.d.ts +1 -1
- package/prisma-gen/wasm.js +70 -4
- package/schema.prisma +108 -0
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
/* global
|
|
29
|
+
/* global Response, WritableStream, ReadableStream, TransformStream */
|
|
30
30
|
// deno-lint-ignore-file no-this-alias
|
|
31
31
|
|
|
32
32
|
import {
|
|
@@ -57,6 +57,9 @@ import {
|
|
|
57
57
|
BITFLAG_DATA_DESCRIPTOR,
|
|
58
58
|
BITFLAG_LANG_ENCODING_FLAG,
|
|
59
59
|
FILE_ATTR_MSDOS_DIR_MASK,
|
|
60
|
+
FILE_ATTR_UNIX_TYPE_MASK,
|
|
61
|
+
FILE_ATTR_UNIX_TYPE_DIR,
|
|
62
|
+
FILE_ATTR_UNIX_EXECUTABLE_MASK,
|
|
60
63
|
DIRECTORY_SIGNATURE,
|
|
61
64
|
UNDEFINED_VALUE
|
|
62
65
|
} from "./constants.js";
|
|
@@ -250,14 +253,20 @@ class ZipReader {
|
|
|
250
253
|
const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
|
|
251
254
|
const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
|
|
252
255
|
const versionMadeBy = getUint16(directoryView, offset + 4);
|
|
253
|
-
const msDosCompatible =
|
|
256
|
+
const msDosCompatible = versionMadeBy >> 8 == 0;
|
|
257
|
+
const unixCompatible = versionMadeBy >> 8 == 3;
|
|
254
258
|
const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
|
|
255
259
|
const commentLength = getUint16(directoryView, offset + 32);
|
|
256
260
|
const endOffset = commentOffset + commentLength;
|
|
257
261
|
const rawComment = directoryArray.subarray(commentOffset, endOffset);
|
|
258
262
|
const filenameUTF8 = languageEncodingFlag;
|
|
259
263
|
const commentUTF8 = languageEncodingFlag;
|
|
260
|
-
const
|
|
264
|
+
const externalFileAttributes = getUint32(directoryView, offset + 38);
|
|
265
|
+
const directory =
|
|
266
|
+
(msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK)) ||
|
|
267
|
+
(unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_DIR)) ||
|
|
268
|
+
(rawFilename.length && rawFilename[rawFilename.length - 1] == DIRECTORY_SIGNATURE.charCodeAt(0));
|
|
269
|
+
const executable = (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0));
|
|
261
270
|
const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
|
|
262
271
|
Object.assign(fileEntry, {
|
|
263
272
|
versionMadeBy,
|
|
@@ -268,13 +277,16 @@ class ZipReader {
|
|
|
268
277
|
directory,
|
|
269
278
|
offset: offsetFileEntry,
|
|
270
279
|
diskNumberStart: getUint16(directoryView, offset + 34),
|
|
271
|
-
|
|
272
|
-
|
|
280
|
+
internalFileAttributes: getUint16(directoryView, offset + 36),
|
|
281
|
+
externalFileAttributes,
|
|
273
282
|
rawFilename,
|
|
274
283
|
filenameUTF8,
|
|
275
284
|
commentUTF8,
|
|
276
|
-
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
|
|
285
|
+
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
|
|
286
|
+
executable
|
|
277
287
|
});
|
|
288
|
+
fileEntry.internalFileAttribute = fileEntry.internalFileAttributes;
|
|
289
|
+
fileEntry.externalFileAttribute = fileEntry.externalFileAttributes;
|
|
278
290
|
const decode = getOptionValue(zipReader, options, "decodeText") || decodeText;
|
|
279
291
|
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
|
|
280
292
|
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
|
|
@@ -293,7 +305,8 @@ class ZipReader {
|
|
|
293
305
|
directory: directory || filename.endsWith(DIRECTORY_SIGNATURE)
|
|
294
306
|
});
|
|
295
307
|
startOffset = Math.max(offsetFileEntry, startOffset);
|
|
296
|
-
|
|
308
|
+
readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
309
|
+
fileEntry.zipCrypto = fileEntry.encrypted && !fileEntry.extraFieldAES;
|
|
297
310
|
const entry = new Entry(fileEntry);
|
|
298
311
|
entry.getData = (writer, options) => fileEntry.getData(writer, entry, options);
|
|
299
312
|
offset = endOffset;
|
|
@@ -301,7 +314,8 @@ class ZipReader {
|
|
|
301
314
|
if (onprogress) {
|
|
302
315
|
try {
|
|
303
316
|
await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
|
|
304
|
-
|
|
317
|
+
// eslint-disable-next-line no-unused-vars
|
|
318
|
+
} catch (_) {
|
|
305
319
|
// ignored
|
|
306
320
|
}
|
|
307
321
|
}
|
|
@@ -406,6 +420,7 @@ class ZipEntry {
|
|
|
406
420
|
const dataView = getDataView(dataArray);
|
|
407
421
|
let password = getOptionValue(zipEntry, options, "password");
|
|
408
422
|
let rawPassword = getOptionValue(zipEntry, options, "rawPassword");
|
|
423
|
+
const passThrough = getOptionValue(zipEntry, options, "passThrough");
|
|
409
424
|
password = password && password.length && password;
|
|
410
425
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
411
426
|
if (extraFieldAES) {
|
|
@@ -413,7 +428,7 @@ class ZipEntry {
|
|
|
413
428
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
414
429
|
}
|
|
415
430
|
}
|
|
416
|
-
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {
|
|
431
|
+
if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) && !passThrough) {
|
|
417
432
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
418
433
|
}
|
|
419
434
|
if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
|
|
@@ -423,13 +438,16 @@ class ZipEntry {
|
|
|
423
438
|
localDirectory.rawExtraField = localDirectory.extraFieldLength ?
|
|
424
439
|
await readUint8Array(reader, offset + 30 + localDirectory.filenameLength, localDirectory.extraFieldLength, diskNumberStart) :
|
|
425
440
|
new Uint8Array();
|
|
426
|
-
|
|
441
|
+
readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
|
|
427
442
|
Object.assign(fileEntry, {
|
|
428
443
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
429
444
|
creationDate: localDirectory.creationDate
|
|
430
445
|
});
|
|
431
|
-
const encrypted = zipEntry.encrypted && localDirectory.encrypted;
|
|
446
|
+
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
|
|
432
447
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
448
|
+
if (!passThrough) {
|
|
449
|
+
fileEntry.zipCrypto = zipCrypto;
|
|
450
|
+
}
|
|
433
451
|
if (encrypted) {
|
|
434
452
|
if (!zipCrypto && extraFieldAES.strength === UNDEFINED_VALUE) {
|
|
435
453
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
@@ -451,7 +469,7 @@ class ZipEntry {
|
|
|
451
469
|
writer = new WritableStream();
|
|
452
470
|
}
|
|
453
471
|
writer = initWriter(writer);
|
|
454
|
-
await initStream(writer, uncompressedSize);
|
|
472
|
+
await initStream(writer, passThrough ? compressedSize : uncompressedSize);
|
|
455
473
|
const { writable } = writer;
|
|
456
474
|
const { onstart, onprogress, onend } = options;
|
|
457
475
|
const workerOptions = {
|
|
@@ -461,11 +479,11 @@ class ZipEntry {
|
|
|
461
479
|
rawPassword,
|
|
462
480
|
zipCrypto,
|
|
463
481
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
464
|
-
signed: getOptionValue(zipEntry, options, "checkSignature"),
|
|
482
|
+
signed: getOptionValue(zipEntry, options, "checkSignature") && !passThrough,
|
|
465
483
|
passwordVerification: zipCrypto && (bitFlag.dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
|
|
466
484
|
signature,
|
|
467
|
-
compressed: compressionMethod != 0,
|
|
468
|
-
encrypted,
|
|
485
|
+
compressed: compressionMethod != 0 && !passThrough,
|
|
486
|
+
encrypted: zipEntry.encrypted && !passThrough,
|
|
469
487
|
useWebWorkers: getOptionValue(zipEntry, options, "useWebWorkers"),
|
|
470
488
|
useCompressionStream: getOptionValue(zipEntry, options, "useCompressionStream"),
|
|
471
489
|
transferStreams: getOptionValue(zipEntry, options, "transferStreams"),
|
|
@@ -511,7 +529,7 @@ function readCommonHeader(directory, dataView, offset) {
|
|
|
511
529
|
});
|
|
512
530
|
}
|
|
513
531
|
|
|
514
|
-
|
|
532
|
+
function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) {
|
|
515
533
|
const { rawExtraField } = directory;
|
|
516
534
|
const extraField = directory.extraField = new Map();
|
|
517
535
|
const rawExtraFieldView = getDataView(new Uint8Array(rawExtraField));
|
|
@@ -526,7 +544,8 @@ async function readCommonFooter(fileEntry, directory, dataView, offset, localDir
|
|
|
526
544
|
});
|
|
527
545
|
offsetExtraField += 4 + size;
|
|
528
546
|
}
|
|
529
|
-
|
|
547
|
+
// eslint-disable-next-line no-unused-vars
|
|
548
|
+
} catch (_) {
|
|
530
549
|
// ignored
|
|
531
550
|
}
|
|
532
551
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
@@ -542,12 +561,12 @@ async function readCommonFooter(fileEntry, directory, dataView, offset, localDir
|
|
|
542
561
|
}
|
|
543
562
|
const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
|
|
544
563
|
if (extraFieldUnicodePath) {
|
|
545
|
-
|
|
564
|
+
readExtraFieldUnicode(extraFieldUnicodePath, PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, directory, fileEntry);
|
|
546
565
|
directory.extraFieldUnicodePath = extraFieldUnicodePath;
|
|
547
566
|
}
|
|
548
567
|
const extraFieldUnicodeComment = extraField.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);
|
|
549
568
|
if (extraFieldUnicodeComment) {
|
|
550
|
-
|
|
569
|
+
readExtraFieldUnicode(extraFieldUnicodeComment, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT, directory, fileEntry);
|
|
551
570
|
directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
|
|
552
571
|
}
|
|
553
572
|
const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
|
|
@@ -589,7 +608,7 @@ function readExtraFieldZip64(extraFieldZip64, directory) {
|
|
|
589
608
|
}
|
|
590
609
|
}
|
|
591
610
|
|
|
592
|
-
|
|
611
|
+
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
|
|
593
612
|
const extraFieldView = getDataView(extraFieldUnicode.data);
|
|
594
613
|
const crc32 = new Crc32();
|
|
595
614
|
crc32.append(fileEntry[rawPropertyName]);
|
|
@@ -633,7 +652,8 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
633
652
|
}
|
|
634
653
|
offsetExtraField += 4 + attributeSize;
|
|
635
654
|
}
|
|
636
|
-
|
|
655
|
+
// eslint-disable-next-line no-unused-vars
|
|
656
|
+
} catch (_) {
|
|
637
657
|
// ignored
|
|
638
658
|
}
|
|
639
659
|
try {
|
|
@@ -654,7 +674,8 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
654
674
|
Object.assign(extraFieldNTFS, extraFieldData);
|
|
655
675
|
Object.assign(directory, extraFieldData);
|
|
656
676
|
}
|
|
657
|
-
|
|
677
|
+
// eslint-disable-next-line no-unused-vars
|
|
678
|
+
} catch (_) {
|
|
658
679
|
// ignored
|
|
659
680
|
}
|
|
660
681
|
}
|
|
@@ -723,7 +744,8 @@ function getDate(timeRaw) {
|
|
|
723
744
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
|
|
724
745
|
try {
|
|
725
746
|
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
726
|
-
|
|
747
|
+
// eslint-disable-next-line no-unused-vars
|
|
748
|
+
} catch (_) {
|
|
727
749
|
// ignored
|
|
728
750
|
}
|
|
729
751
|
}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
/* global
|
|
29
|
+
/* global TransformStream, Response */
|
|
30
30
|
// deno-lint-ignore-file no-this-alias
|
|
31
31
|
|
|
32
32
|
import {
|
|
@@ -56,6 +56,9 @@ import {
|
|
|
56
56
|
BITFLAG_DATA_DESCRIPTOR,
|
|
57
57
|
BITFLAG_LANG_ENCODING_FLAG,
|
|
58
58
|
FILE_ATTR_MSDOS_DIR_MASK,
|
|
59
|
+
FILE_ATTR_UNIX_TYPE_DIR,
|
|
60
|
+
FILE_ATTR_UNIX_EXECUTABLE_MASK,
|
|
61
|
+
FILE_ATTR_UNIX_DEFAULT_MASK,
|
|
59
62
|
VERSION_DEFLATE,
|
|
60
63
|
VERSION_ZIP64,
|
|
61
64
|
VERSION_AES,
|
|
@@ -84,8 +87,16 @@ import {
|
|
|
84
87
|
PROPERTY_NAME_CREATION_DATE,
|
|
85
88
|
PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE,
|
|
86
89
|
PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
|
|
90
|
+
PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES,
|
|
91
|
+
PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES,
|
|
87
92
|
PROPERTY_NAME_MS_DOS_COMPATIBLE,
|
|
88
93
|
PROPERTY_NAME_ZIP64,
|
|
94
|
+
PROPERTY_NAME_ENCRYPTED,
|
|
95
|
+
PROPERTY_NAME_VERSION,
|
|
96
|
+
PROPERTY_NAME_VERSION_MADE_BY,
|
|
97
|
+
PROPERTY_NAME_ZIPCRYPTO,
|
|
98
|
+
PROPERTY_NAME_DIRECTORY,
|
|
99
|
+
PROPERTY_NAME_EXECUTABLE,
|
|
89
100
|
Entry
|
|
90
101
|
} from "./zip-entry.js";
|
|
91
102
|
|
|
@@ -98,6 +109,7 @@ const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
|
98
109
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535";
|
|
99
110
|
const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
|
|
100
111
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (make sure 'keepOrder' is set to 'true')";
|
|
112
|
+
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
101
113
|
|
|
102
114
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
103
115
|
|
|
@@ -118,7 +130,7 @@ class ZipWriter {
|
|
|
118
130
|
config: getConfiguration(),
|
|
119
131
|
files: new Map(),
|
|
120
132
|
filenames: new Set(),
|
|
121
|
-
offset: writer.writable.size,
|
|
133
|
+
offset: options.offset === UNDEFINED_VALUE ? writer.writable.size : options.offset,
|
|
122
134
|
pendingEntriesSize: 0,
|
|
123
135
|
pendingAddFileCalls: new Set(),
|
|
124
136
|
bufferedWrites: 0
|
|
@@ -214,15 +226,42 @@ export {
|
|
|
214
226
|
ERR_INVALID_EXTRAFIELD_TYPE,
|
|
215
227
|
ERR_INVALID_EXTRAFIELD_DATA,
|
|
216
228
|
ERR_INVALID_ENCRYPTION_STRENGTH,
|
|
217
|
-
ERR_UNSUPPORTED_FORMAT
|
|
229
|
+
ERR_UNSUPPORTED_FORMAT,
|
|
230
|
+
ERR_UNDEFINED_UNCOMPRESSED_SIZE
|
|
218
231
|
};
|
|
219
232
|
|
|
220
233
|
async function addFile(zipWriter, name, reader, options) {
|
|
221
234
|
name = name.trim();
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
235
|
+
const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
|
|
236
|
+
const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768);
|
|
237
|
+
const executable = getOptionValue(zipWriter, options, PROPERTY_NAME_EXECUTABLE);
|
|
238
|
+
if (versionMadeBy > MAX_16_BITS) {
|
|
239
|
+
throw new Error(ERR_INVALID_VERSION);
|
|
240
|
+
}
|
|
241
|
+
let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
|
|
242
|
+
if (externalFileAttributes === 0) {
|
|
243
|
+
externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
|
|
244
|
+
}
|
|
245
|
+
if (!options.directory && name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
246
|
+
options.directory = true;
|
|
247
|
+
}
|
|
248
|
+
const directory = getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
|
|
249
|
+
if (directory) {
|
|
250
|
+
if (!name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
251
|
+
name += DIRECTORY_SIGNATURE;
|
|
252
|
+
}
|
|
253
|
+
if (externalFileAttributes === 0) {
|
|
254
|
+
externalFileAttributes = FILE_ATTR_MSDOS_DIR_MASK;
|
|
255
|
+
if (!msDosCompatible) {
|
|
256
|
+
externalFileAttributes |= (FILE_ATTR_UNIX_TYPE_DIR | FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
} else if (!msDosCompatible && externalFileAttributes === 0) {
|
|
260
|
+
if (executable) {
|
|
261
|
+
externalFileAttributes = (FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
|
|
262
|
+
} else {
|
|
263
|
+
externalFileAttributes = FILE_ATTR_UNIX_DEFAULT_MASK << 16;
|
|
264
|
+
}
|
|
226
265
|
}
|
|
227
266
|
const encode = getOptionValue(zipWriter, options, "encodeText", encodeText);
|
|
228
267
|
let rawFilename = encode(name);
|
|
@@ -240,24 +279,25 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
240
279
|
if (getLength(rawComment) > MAX_16_BITS) {
|
|
241
280
|
throw new Error(ERR_INVALID_ENTRY_COMMENT);
|
|
242
281
|
}
|
|
243
|
-
const version = getOptionValue(zipWriter, options,
|
|
282
|
+
const version = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION, VERSION_DEFLATE);
|
|
244
283
|
if (version > MAX_16_BITS) {
|
|
245
284
|
throw new Error(ERR_INVALID_VERSION);
|
|
246
285
|
}
|
|
247
|
-
const versionMadeBy = getOptionValue(zipWriter, options, "versionMadeBy", 20);
|
|
248
|
-
if (versionMadeBy > MAX_16_BITS) {
|
|
249
|
-
throw new Error(ERR_INVALID_VERSION);
|
|
250
|
-
}
|
|
251
286
|
const lastModDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
|
|
252
287
|
const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
253
288
|
const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const
|
|
289
|
+
let internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
|
|
290
|
+
if (internalFileAttributes === 0) {
|
|
291
|
+
internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
|
|
292
|
+
}
|
|
293
|
+
const passThrough = getOptionValue(zipWriter, options, "passThrough");
|
|
294
|
+
let password, rawPassword;
|
|
295
|
+
if (!passThrough) {
|
|
296
|
+
password = getOptionValue(zipWriter, options, "password");
|
|
297
|
+
rawPassword = getOptionValue(zipWriter, options, "rawPassword");
|
|
298
|
+
}
|
|
259
299
|
const encryptionStrength = getOptionValue(zipWriter, options, "encryptionStrength", 3);
|
|
260
|
-
const zipCrypto = getOptionValue(zipWriter, options,
|
|
300
|
+
const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
|
|
261
301
|
const extendedTimestamp = getOptionValue(zipWriter, options, "extendedTimestamp", true);
|
|
262
302
|
const keepOrder = getOptionValue(zipWriter, options, "keepOrder", true);
|
|
263
303
|
const level = getOptionValue(zipWriter, options, "level");
|
|
@@ -265,10 +305,12 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
265
305
|
const bufferedWrite = getOptionValue(zipWriter, options, "bufferedWrite");
|
|
266
306
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, "dataDescriptorSignature", false);
|
|
267
307
|
const signal = getOptionValue(zipWriter, options, "signal");
|
|
308
|
+
const useUnicodeFileNames = getOptionValue(zipWriter, options, "useUnicodeFileNames", true);
|
|
268
309
|
const useCompressionStream = getOptionValue(zipWriter, options, "useCompressionStream");
|
|
310
|
+
const compressionMethod = getOptionValue(zipWriter, options, "compressionMethod");
|
|
269
311
|
let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor", true);
|
|
270
312
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
271
|
-
if (password !== UNDEFINED_VALUE
|
|
313
|
+
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
272
314
|
throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
|
|
273
315
|
}
|
|
274
316
|
let rawExtraField = new Uint8Array();
|
|
@@ -294,18 +336,28 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
294
336
|
let maximumCompressedSize = 0;
|
|
295
337
|
let maximumEntrySize = 0;
|
|
296
338
|
let uncompressedSize = 0;
|
|
339
|
+
if (passThrough) {
|
|
340
|
+
({ uncompressedSize } = options);
|
|
341
|
+
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
342
|
+
throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
297
345
|
const zip64Enabled = zip64 === true;
|
|
298
346
|
if (reader) {
|
|
299
347
|
reader = initReader(reader);
|
|
300
348
|
await initStream(reader);
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
zip64
|
|
305
|
-
|
|
349
|
+
if (!passThrough) {
|
|
350
|
+
if (reader.size === UNDEFINED_VALUE) {
|
|
351
|
+
dataDescriptor = true;
|
|
352
|
+
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
353
|
+
zip64 = true;
|
|
354
|
+
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
uncompressedSize = reader.size;
|
|
358
|
+
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
|
|
306
359
|
}
|
|
307
360
|
} else {
|
|
308
|
-
uncompressedSize = reader.size;
|
|
309
361
|
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
|
|
310
362
|
}
|
|
311
363
|
}
|
|
@@ -323,6 +375,8 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
323
375
|
}
|
|
324
376
|
}
|
|
325
377
|
zip64 = zip64 || false;
|
|
378
|
+
const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
|
|
379
|
+
const { signature } = options;
|
|
326
380
|
options = Object.assign({}, options, {
|
|
327
381
|
rawFilename,
|
|
328
382
|
rawComment,
|
|
@@ -346,13 +400,20 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
346
400
|
zipCrypto,
|
|
347
401
|
bufferedWrite,
|
|
348
402
|
keepOrder,
|
|
403
|
+
useUnicodeFileNames,
|
|
349
404
|
dataDescriptor,
|
|
350
405
|
dataDescriptorSignature,
|
|
351
406
|
signal,
|
|
352
407
|
msDosCompatible,
|
|
353
|
-
internalFileAttribute,
|
|
354
|
-
|
|
355
|
-
|
|
408
|
+
internalFileAttribute: internalFileAttributes,
|
|
409
|
+
internalFileAttributes,
|
|
410
|
+
externalFileAttribute: externalFileAttributes,
|
|
411
|
+
externalFileAttributes,
|
|
412
|
+
useCompressionStream,
|
|
413
|
+
passThrough,
|
|
414
|
+
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
|
|
415
|
+
signature,
|
|
416
|
+
compressionMethod
|
|
356
417
|
});
|
|
357
418
|
const headerInfo = getHeaderInfo(options);
|
|
358
419
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
@@ -468,7 +529,8 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
468
529
|
if (error) {
|
|
469
530
|
try {
|
|
470
531
|
error.corruptedEntry = true;
|
|
471
|
-
|
|
532
|
+
// eslint-disable-next-line no-unused-vars
|
|
533
|
+
} catch (_) {
|
|
472
534
|
// ignored
|
|
473
535
|
}
|
|
474
536
|
}
|
|
@@ -550,6 +612,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
550
612
|
zipCrypto,
|
|
551
613
|
dataDescriptor,
|
|
552
614
|
directory,
|
|
615
|
+
executable,
|
|
553
616
|
versionMadeBy,
|
|
554
617
|
rawComment,
|
|
555
618
|
rawExtraField,
|
|
@@ -561,15 +624,17 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
561
624
|
encryptionStrength,
|
|
562
625
|
extendedTimestamp,
|
|
563
626
|
msDosCompatible,
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
useCompressionStream
|
|
627
|
+
internalFileAttributes,
|
|
628
|
+
externalFileAttributes,
|
|
629
|
+
useCompressionStream,
|
|
630
|
+
passThrough
|
|
567
631
|
} = options;
|
|
568
632
|
const fileEntry = {
|
|
569
633
|
lock,
|
|
570
634
|
versionMadeBy,
|
|
571
635
|
zip64,
|
|
572
636
|
directory: Boolean(directory),
|
|
637
|
+
executable: Boolean(executable),
|
|
573
638
|
filenameUTF8: true,
|
|
574
639
|
rawFilename,
|
|
575
640
|
commentUTF8: true,
|
|
@@ -580,13 +645,18 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
580
645
|
rawExtraField,
|
|
581
646
|
extendedTimestamp,
|
|
582
647
|
msDosCompatible,
|
|
583
|
-
|
|
584
|
-
|
|
648
|
+
internalFileAttributes,
|
|
649
|
+
externalFileAttributes,
|
|
585
650
|
diskNumberStart
|
|
586
651
|
};
|
|
652
|
+
let {
|
|
653
|
+
signature,
|
|
654
|
+
uncompressedSize
|
|
655
|
+
} = options;
|
|
587
656
|
let compressedSize = 0;
|
|
588
|
-
|
|
589
|
-
|
|
657
|
+
if (!passThrough) {
|
|
658
|
+
uncompressedSize = 0;
|
|
659
|
+
}
|
|
590
660
|
const { writable } = writer;
|
|
591
661
|
if (reader) {
|
|
592
662
|
reader.chunkSize = getChunkSize(config);
|
|
@@ -602,9 +672,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
602
672
|
encryptionStrength,
|
|
603
673
|
zipCrypto: encrypted && zipCrypto,
|
|
604
674
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & 0xFF,
|
|
605
|
-
signed:
|
|
606
|
-
compressed,
|
|
607
|
-
encrypted,
|
|
675
|
+
signed: !passThrough,
|
|
676
|
+
compressed: compressed && !passThrough,
|
|
677
|
+
encrypted: encrypted && !passThrough,
|
|
608
678
|
useWebWorkers,
|
|
609
679
|
useCompressionStream,
|
|
610
680
|
transferStreams: false
|
|
@@ -613,9 +683,11 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
613
683
|
streamOptions: { signal, size, onstart, onprogress, onend }
|
|
614
684
|
};
|
|
615
685
|
const result = await runWorker({ readable, writable }, workerOptions);
|
|
616
|
-
uncompressedSize = result.inputSize;
|
|
617
686
|
compressedSize = result.outputSize;
|
|
618
|
-
|
|
687
|
+
if (!passThrough) {
|
|
688
|
+
uncompressedSize = result.inputSize;
|
|
689
|
+
signature = result.signature;
|
|
690
|
+
}
|
|
619
691
|
writable.size += uncompressedSize;
|
|
620
692
|
} else {
|
|
621
693
|
await writeData(writable, localHeaderArray);
|
|
@@ -658,6 +730,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
658
730
|
creationDate,
|
|
659
731
|
lastAccessDate,
|
|
660
732
|
encrypted,
|
|
733
|
+
zipCrypto,
|
|
661
734
|
size: metadataSize + compressedSize,
|
|
662
735
|
compressionMethod,
|
|
663
736
|
version,
|
|
@@ -679,20 +752,19 @@ function getHeaderInfo(options) {
|
|
|
679
752
|
lastModDate,
|
|
680
753
|
lastAccessDate,
|
|
681
754
|
creationDate,
|
|
682
|
-
rawPassword,
|
|
683
|
-
password,
|
|
684
755
|
level,
|
|
685
756
|
zip64,
|
|
686
757
|
zipCrypto,
|
|
758
|
+
useUnicodeFileNames,
|
|
687
759
|
dataDescriptor,
|
|
688
760
|
directory,
|
|
689
761
|
rawExtraField,
|
|
690
762
|
encryptionStrength,
|
|
691
|
-
extendedTimestamp
|
|
763
|
+
extendedTimestamp,
|
|
764
|
+
encrypted
|
|
692
765
|
} = options;
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
let version = options.version;
|
|
766
|
+
let { version, compressionMethod } = options;
|
|
767
|
+
const compressed = !directory && (level > 0 || (level === UNDEFINED_VALUE && compressionMethod !== 0));
|
|
696
768
|
let rawExtraFieldAES;
|
|
697
769
|
if (encrypted && !zipCrypto) {
|
|
698
770
|
rawExtraFieldAES = new Uint8Array(getLength(EXTRAFIELD_DATA_AES) + 2);
|
|
@@ -734,19 +806,33 @@ function getHeaderInfo(options) {
|
|
|
734
806
|
setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
|
|
735
807
|
setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
|
|
736
808
|
setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
|
|
737
|
-
|
|
809
|
+
// eslint-disable-next-line no-unused-vars
|
|
810
|
+
} catch (_) {
|
|
738
811
|
rawExtraFieldNTFS = new Uint8Array();
|
|
739
812
|
}
|
|
740
813
|
} else {
|
|
741
814
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array();
|
|
742
815
|
}
|
|
743
|
-
let bitFlag =
|
|
816
|
+
let bitFlag = 0;
|
|
817
|
+
if (useUnicodeFileNames) {
|
|
818
|
+
bitFlag = bitFlag | BITFLAG_LANG_ENCODING_FLAG;
|
|
819
|
+
}
|
|
744
820
|
if (dataDescriptor) {
|
|
745
821
|
bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
|
|
746
822
|
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
823
|
+
if (compressionMethod === UNDEFINED_VALUE) {
|
|
824
|
+
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
825
|
+
}
|
|
826
|
+
if (compressionMethod == COMPRESSION_METHOD_DEFLATE) {
|
|
827
|
+
if (level >= 1 && level < 3) {
|
|
828
|
+
bitFlag = bitFlag | 0b110;
|
|
829
|
+
}
|
|
830
|
+
if (level >= 3 && level < 5) {
|
|
831
|
+
bitFlag = bitFlag | 0b01;
|
|
832
|
+
}
|
|
833
|
+
if (level === 9) {
|
|
834
|
+
bitFlag = bitFlag | 0b10;
|
|
835
|
+
}
|
|
750
836
|
}
|
|
751
837
|
if (zip64) {
|
|
752
838
|
version = version > VERSION_ZIP64 ? version : VERSION_ZIP64;
|
|
@@ -755,10 +841,8 @@ function getHeaderInfo(options) {
|
|
|
755
841
|
bitFlag = bitFlag | BITFLAG_ENCRYPTED;
|
|
756
842
|
if (!zipCrypto) {
|
|
757
843
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
844
|
+
rawExtraFieldAES[9] = compressionMethod;
|
|
758
845
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
759
|
-
if (compressed) {
|
|
760
|
-
rawExtraFieldAES[9] = COMPRESSION_METHOD_DEFLATE;
|
|
761
|
-
}
|
|
762
846
|
}
|
|
763
847
|
}
|
|
764
848
|
const headerArray = new Uint8Array(26);
|
|
@@ -1011,15 +1095,13 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
1011
1095
|
rawComment,
|
|
1012
1096
|
versionMadeBy,
|
|
1013
1097
|
headerArray,
|
|
1014
|
-
directory,
|
|
1015
1098
|
zip64,
|
|
1016
1099
|
zip64UncompressedSize,
|
|
1017
1100
|
zip64CompressedSize,
|
|
1018
1101
|
zip64DiskNumberStart,
|
|
1019
1102
|
zip64Offset,
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
externalFileAttribute,
|
|
1103
|
+
internalFileAttributes,
|
|
1104
|
+
externalFileAttributes,
|
|
1023
1105
|
diskNumberStart,
|
|
1024
1106
|
uncompressedSize,
|
|
1025
1107
|
compressedSize
|
|
@@ -1038,11 +1120,9 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
1038
1120
|
setUint16(directoryView, offset + 30, extraFieldLength);
|
|
1039
1121
|
setUint16(directoryView, offset + 32, getLength(rawComment));
|
|
1040
1122
|
setUint16(directoryView, offset + 34, zip64 && zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
|
|
1041
|
-
setUint16(directoryView, offset + 36,
|
|
1042
|
-
if (
|
|
1043
|
-
setUint32(directoryView, offset + 38,
|
|
1044
|
-
} else if (directory && msDosCompatible) {
|
|
1045
|
-
setUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);
|
|
1123
|
+
setUint16(directoryView, offset + 36, internalFileAttributes);
|
|
1124
|
+
if (externalFileAttributes) {
|
|
1125
|
+
setUint32(directoryView, offset + 38, externalFileAttributes);
|
|
1046
1126
|
}
|
|
1047
1127
|
setUint32(directoryView, offset + 42, zip64 && zip64Offset ? MAX_32_BITS : fileEntryOffset);
|
|
1048
1128
|
arraySet(directoryArray, rawFilename, offset + 46);
|
|
@@ -1062,7 +1142,8 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
1062
1142
|
if (options.onprogress) {
|
|
1063
1143
|
try {
|
|
1064
1144
|
await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
|
|
1065
|
-
|
|
1145
|
+
// eslint-disable-next-line no-unused-vars
|
|
1146
|
+
} catch (_) {
|
|
1066
1147
|
// ignored
|
|
1067
1148
|
}
|
|
1068
1149
|
}
|
|
@@ -1073,7 +1154,7 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
1073
1154
|
if (availableSize < END_OF_CENTRAL_DIR_LENGTH) {
|
|
1074
1155
|
lastDiskNumber++;
|
|
1075
1156
|
}
|
|
1076
|
-
let zip64 = getOptionValue(zipWriter, options,
|
|
1157
|
+
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
1077
1158
|
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
|
|
1078
1159
|
if (zip64 === false) {
|
|
1079
1160
|
throw new Error(ERR_UNSUPPORTED_FORMAT);
|
|
@@ -35,7 +35,7 @@ export {
|
|
|
35
35
|
function configureWebWorker(configure, options = {}) {
|
|
36
36
|
// eslint-disable-next-line quotes
|
|
37
37
|
const code = `__workerCode__`;
|
|
38
|
-
const uri = options.useDataURI ?
|
|
38
|
+
const uri = () => options.useDataURI ?
|
|
39
39
|
`data:text/javascript,${encodeURIComponent(code)}` :
|
|
40
40
|
URL.createObjectURL(new Blob([code], { type: "text/javascript" }));
|
|
41
41
|
configure({ workerScripts: { inflate: [uri], deflate: [uri] } });
|