@cj-tech-master/excelts 4.2.1-canary.20260111102127.f808a37 → 4.2.1
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/THIRD_PARTY_NOTICES.md +31 -0
- package/dist/browser/index.browser.d.ts +0 -1
- package/dist/browser/index.browser.js +0 -12
- package/dist/browser/modules/archive/byte-queue.d.ts +18 -0
- package/dist/browser/modules/archive/byte-queue.js +125 -0
- package/dist/browser/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
- package/dist/browser/modules/archive/{compression/compress.browser.d.ts → compress.browser.d.ts} +8 -2
- package/dist/{esm/modules/archive/compression → browser/modules/archive}/compress.browser.js +11 -3
- package/dist/browser/modules/archive/{compression/compress.d.ts → compress.d.ts} +2 -2
- package/dist/{esm/modules/archive/compression → browser/modules/archive}/compress.js +1 -1
- package/dist/browser/modules/archive/{compression/crc32.browser.d.ts → crc32.browser.d.ts} +1 -1
- package/dist/browser/modules/archive/{compression/crc32.d.ts → crc32.d.ts} +1 -1
- package/dist/browser/modules/archive/{compression/crc32.js → crc32.js} +1 -1
- package/dist/browser/modules/archive/defaults.d.ts +0 -1
- package/dist/browser/modules/archive/defaults.js +3 -6
- package/dist/browser/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
- package/dist/browser/modules/archive/{unzip/extract.d.ts → extract.d.ts} +2 -2
- package/dist/browser/modules/archive/index.base.d.ts +4 -4
- package/dist/browser/modules/archive/index.base.js +6 -3
- package/dist/browser/modules/archive/index.browser.d.ts +4 -3
- package/dist/browser/modules/archive/index.browser.js +7 -3
- package/dist/browser/modules/archive/index.d.ts +4 -3
- package/dist/browser/modules/archive/index.js +5 -3
- package/dist/browser/modules/archive/{unzip/stream.base.d.ts → parse.base.d.ts} +2 -36
- package/dist/browser/modules/archive/parse.base.js +644 -0
- package/dist/browser/modules/archive/{unzip/stream.browser.d.ts → parse.browser.d.ts} +1 -1
- package/dist/{esm/modules/archive/unzip/stream.browser.js → browser/modules/archive/parse.browser.js} +110 -371
- package/dist/browser/modules/archive/{unzip/stream.d.ts → parse.d.ts} +2 -2
- package/dist/{esm/modules/archive/unzip/stream.js → browser/modules/archive/parse.js} +5 -6
- package/dist/browser/modules/archive/{compression/streaming-compress.browser.d.ts → streaming-compress.browser.d.ts} +2 -2
- package/dist/browser/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
- package/dist/browser/modules/archive/{compression/streaming-compress.d.ts → streaming-compress.d.ts} +2 -2
- package/dist/browser/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
- package/dist/browser/modules/archive/{zip/stream.d.ts → streaming-zip.d.ts} +5 -28
- package/dist/{esm/modules/archive/zip/stream.js → browser/modules/archive/streaming-zip.js} +48 -192
- package/dist/browser/modules/archive/utils/bytes.js +16 -16
- package/dist/browser/modules/archive/utils/parse-buffer.js +23 -21
- package/dist/browser/modules/archive/utils/timestamps.js +1 -62
- package/dist/browser/modules/archive/utils/zip-extra-fields.d.ts +1 -1
- package/dist/browser/modules/archive/utils/zip-extra-fields.js +14 -26
- package/dist/browser/modules/archive/utils/zip-extra.d.ts +18 -0
- package/dist/browser/modules/archive/utils/zip-extra.js +68 -0
- package/dist/browser/modules/archive/zip-builder.d.ts +117 -0
- package/dist/browser/modules/archive/zip-builder.js +292 -0
- package/dist/browser/modules/archive/zip-constants.d.ts +18 -0
- package/dist/browser/modules/archive/zip-constants.js +23 -0
- package/dist/{esm/modules/archive/zip → browser/modules/archive}/zip-entry-metadata.js +3 -3
- package/dist/{types/modules/archive/unzip → browser/modules/archive}/zip-parser.d.ts +1 -1
- package/dist/{esm/modules/archive/unzip → browser/modules/archive}/zip-parser.js +24 -38
- package/dist/browser/modules/archive/{zip-spec/zip-records.d.ts → zip-records.d.ts} +0 -20
- package/dist/browser/modules/archive/zip-records.js +84 -0
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +1 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +1 -1
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +6 -3
- package/dist/browser/modules/excel/xlsx/xlsx.js +1 -1
- package/dist/browser/modules/stream/streams.browser.d.ts +30 -28
- package/dist/browser/modules/stream/streams.browser.js +710 -830
- package/dist/browser/modules/stream/streams.js +58 -140
- package/dist/cjs/modules/archive/byte-queue.js +129 -0
- package/dist/cjs/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
- package/dist/cjs/modules/archive/{compression/compress.browser.js → compress.browser.js} +11 -3
- package/dist/cjs/modules/archive/{compression/compress.js → compress.js} +1 -1
- package/dist/cjs/modules/archive/{compression/crc32.js → crc32.js} +1 -1
- package/dist/cjs/modules/archive/defaults.js +4 -7
- package/dist/cjs/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
- package/dist/cjs/modules/archive/index.base.js +19 -9
- package/dist/cjs/modules/archive/index.browser.js +10 -4
- package/dist/cjs/modules/archive/index.js +8 -4
- package/dist/cjs/modules/archive/parse.base.js +666 -0
- package/dist/cjs/modules/archive/{unzip/stream.browser.js → parse.browser.js} +111 -372
- package/dist/cjs/modules/archive/{unzip/stream.js → parse.js} +8 -9
- package/dist/cjs/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
- package/dist/cjs/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
- package/dist/cjs/modules/archive/{zip/stream.js → streaming-zip.js} +50 -194
- package/dist/cjs/modules/archive/utils/bytes.js +16 -16
- package/dist/cjs/modules/archive/utils/parse-buffer.js +23 -21
- package/dist/cjs/modules/archive/utils/timestamps.js +3 -64
- package/dist/cjs/modules/archive/utils/zip-extra-fields.js +14 -26
- package/dist/cjs/modules/archive/utils/zip-extra.js +74 -0
- package/dist/cjs/modules/archive/zip-builder.js +297 -0
- package/dist/cjs/modules/archive/zip-constants.js +26 -0
- package/dist/cjs/modules/archive/{zip/zip-entry-metadata.js → zip-entry-metadata.js} +5 -5
- package/dist/cjs/modules/archive/{unzip/zip-parser.js → zip-parser.js} +33 -47
- package/dist/cjs/modules/archive/zip-records.js +90 -0
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +2 -2
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +4 -4
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +9 -6
- package/dist/cjs/modules/excel/xlsx/xlsx.js +2 -2
- package/dist/cjs/modules/stream/streams.browser.js +710 -830
- package/dist/cjs/modules/stream/streams.js +58 -140
- package/dist/esm/index.browser.js +0 -12
- package/dist/esm/modules/archive/byte-queue.js +125 -0
- package/dist/esm/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
- package/dist/{browser/modules/archive/compression → esm/modules/archive}/compress.browser.js +11 -3
- package/dist/{browser/modules/archive/compression → esm/modules/archive}/compress.js +1 -1
- package/dist/esm/modules/archive/{compression/crc32.js → crc32.js} +1 -1
- package/dist/esm/modules/archive/defaults.js +3 -6
- package/dist/esm/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
- package/dist/esm/modules/archive/index.base.js +6 -3
- package/dist/esm/modules/archive/index.browser.js +7 -3
- package/dist/esm/modules/archive/index.js +5 -3
- package/dist/esm/modules/archive/parse.base.js +644 -0
- package/dist/{browser/modules/archive/unzip/stream.browser.js → esm/modules/archive/parse.browser.js} +110 -371
- package/dist/{browser/modules/archive/unzip/stream.js → esm/modules/archive/parse.js} +5 -6
- package/dist/esm/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
- package/dist/esm/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
- package/dist/{browser/modules/archive/zip/stream.js → esm/modules/archive/streaming-zip.js} +48 -192
- package/dist/esm/modules/archive/utils/bytes.js +16 -16
- package/dist/esm/modules/archive/utils/parse-buffer.js +23 -21
- package/dist/esm/modules/archive/utils/timestamps.js +1 -62
- package/dist/esm/modules/archive/utils/zip-extra-fields.js +14 -26
- package/dist/esm/modules/archive/utils/zip-extra.js +68 -0
- package/dist/esm/modules/archive/zip-builder.js +292 -0
- package/dist/esm/modules/archive/zip-constants.js +23 -0
- package/dist/{browser/modules/archive/zip → esm/modules/archive}/zip-entry-metadata.js +3 -3
- package/dist/{browser/modules/archive/unzip → esm/modules/archive}/zip-parser.js +24 -38
- package/dist/esm/modules/archive/zip-records.js +84 -0
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +1 -1
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +1 -1
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +6 -3
- package/dist/esm/modules/excel/xlsx/xlsx.js +1 -1
- package/dist/esm/modules/stream/streams.browser.js +710 -830
- package/dist/esm/modules/stream/streams.js +58 -140
- package/dist/iife/THIRD_PARTY_NOTICES.md +31 -0
- package/dist/iife/excelts.iife.js +4425 -6215
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +31 -103
- package/dist/types/index.browser.d.ts +0 -1
- package/dist/types/modules/archive/byte-queue.d.ts +18 -0
- package/dist/types/modules/archive/{compression/compress.browser.d.ts → compress.browser.d.ts} +8 -2
- package/dist/types/modules/archive/defaults.d.ts +0 -1
- package/dist/types/modules/archive/index.base.d.ts +4 -4
- package/dist/types/modules/archive/index.browser.d.ts +4 -3
- package/dist/types/modules/archive/index.d.ts +4 -3
- package/dist/types/modules/archive/{unzip/stream.base.d.ts → parse.base.d.ts} +4 -38
- package/dist/types/modules/archive/{unzip/stream.browser.d.ts → parse.browser.d.ts} +2 -2
- package/dist/types/modules/archive/{unzip/stream.d.ts → parse.d.ts} +3 -3
- package/dist/types/modules/archive/{compression/streaming-compress.browser.d.ts → streaming-compress.browser.d.ts} +1 -1
- package/dist/types/modules/archive/{zip/stream.d.ts → streaming-zip.d.ts} +6 -29
- package/dist/types/modules/archive/utils/zip-extra-fields.d.ts +1 -1
- package/dist/types/modules/archive/utils/zip-extra.d.ts +18 -0
- package/dist/types/modules/archive/zip-builder.d.ts +117 -0
- package/dist/types/modules/archive/zip-constants.d.ts +18 -0
- package/dist/types/modules/archive/{zip/zip-entry-metadata.d.ts → zip-entry-metadata.d.ts} +1 -1
- package/dist/{browser/modules/archive/unzip → types/modules/archive}/zip-parser.d.ts +1 -1
- package/dist/types/modules/archive/{zip-spec/zip-records.d.ts → zip-records.d.ts} +0 -20
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
- package/dist/types/modules/stream/streams.browser.d.ts +30 -28
- package/package.json +1 -5
- package/dist/browser/modules/archive/internal/byte-queue.d.ts +0 -33
- package/dist/browser/modules/archive/internal/byte-queue.js +0 -407
- package/dist/browser/modules/archive/io/archive-sink.d.ts +0 -9
- package/dist/browser/modules/archive/io/archive-sink.js +0 -77
- package/dist/browser/modules/archive/io/archive-source.d.ts +0 -8
- package/dist/browser/modules/archive/io/archive-source.js +0 -107
- package/dist/browser/modules/archive/unzip/index.d.ts +0 -40
- package/dist/browser/modules/archive/unzip/index.js +0 -164
- package/dist/browser/modules/archive/unzip/stream.base.js +0 -1022
- package/dist/browser/modules/archive/utils/async-queue.d.ts +0 -7
- package/dist/browser/modules/archive/utils/async-queue.js +0 -103
- package/dist/browser/modules/archive/utils/compressibility.d.ts +0 -10
- package/dist/browser/modules/archive/utils/compressibility.js +0 -57
- package/dist/browser/modules/archive/utils/pattern-scanner.d.ts +0 -21
- package/dist/browser/modules/archive/utils/pattern-scanner.js +0 -27
- package/dist/browser/modules/archive/zip/index.d.ts +0 -42
- package/dist/browser/modules/archive/zip/index.js +0 -157
- package/dist/browser/modules/archive/zip/zip-bytes.d.ts +0 -73
- package/dist/browser/modules/archive/zip/zip-bytes.js +0 -239
- package/dist/browser/modules/archive/zip-spec/zip-records.js +0 -126
- package/dist/cjs/modules/archive/internal/byte-queue.js +0 -411
- package/dist/cjs/modules/archive/io/archive-sink.js +0 -82
- package/dist/cjs/modules/archive/io/archive-source.js +0 -114
- package/dist/cjs/modules/archive/unzip/index.js +0 -170
- package/dist/cjs/modules/archive/unzip/stream.base.js +0 -1044
- package/dist/cjs/modules/archive/utils/async-queue.js +0 -106
- package/dist/cjs/modules/archive/utils/compressibility.js +0 -60
- package/dist/cjs/modules/archive/utils/pattern-scanner.js +0 -31
- package/dist/cjs/modules/archive/zip/index.js +0 -162
- package/dist/cjs/modules/archive/zip/zip-bytes.js +0 -242
- package/dist/cjs/modules/archive/zip-spec/zip-records.js +0 -136
- package/dist/esm/modules/archive/internal/byte-queue.js +0 -407
- package/dist/esm/modules/archive/io/archive-sink.js +0 -77
- package/dist/esm/modules/archive/io/archive-source.js +0 -107
- package/dist/esm/modules/archive/unzip/index.js +0 -164
- package/dist/esm/modules/archive/unzip/stream.base.js +0 -1022
- package/dist/esm/modules/archive/utils/async-queue.js +0 -103
- package/dist/esm/modules/archive/utils/compressibility.js +0 -57
- package/dist/esm/modules/archive/utils/pattern-scanner.js +0 -27
- package/dist/esm/modules/archive/zip/index.js +0 -157
- package/dist/esm/modules/archive/zip/zip-bytes.js +0 -239
- package/dist/esm/modules/archive/zip-spec/zip-records.js +0 -126
- package/dist/types/modules/archive/internal/byte-queue.d.ts +0 -33
- package/dist/types/modules/archive/io/archive-sink.d.ts +0 -9
- package/dist/types/modules/archive/io/archive-source.d.ts +0 -8
- package/dist/types/modules/archive/unzip/index.d.ts +0 -40
- package/dist/types/modules/archive/utils/async-queue.d.ts +0 -7
- package/dist/types/modules/archive/utils/compressibility.d.ts +0 -10
- package/dist/types/modules/archive/utils/pattern-scanner.d.ts +0 -21
- package/dist/types/modules/archive/zip/index.d.ts +0 -42
- package/dist/types/modules/archive/zip/zip-bytes.d.ts +0 -73
- /package/dist/browser/modules/archive/{compression/compress.base.d.ts → compress.base.d.ts} +0 -0
- /package/dist/browser/modules/archive/{compression/crc32.base.d.ts → crc32.base.d.ts} +0 -0
- /package/dist/browser/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
- /package/dist/browser/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
- /package/dist/browser/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts} +0 -0
- /package/dist/browser/modules/archive/{unzip/extract.js → extract.js} +0 -0
- /package/dist/browser/modules/archive/{compression/streaming-compress.base.d.ts → streaming-compress.base.d.ts} +0 -0
- /package/dist/browser/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
- /package/dist/browser/modules/archive/{zip-spec/zip-entry-info.d.ts → zip-entry-info.d.ts} +0 -0
- /package/dist/browser/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
- /package/dist/browser/modules/archive/{zip/zip-entry-metadata.d.ts → zip-entry-metadata.d.ts} +0 -0
- /package/dist/cjs/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
- /package/dist/cjs/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
- /package/dist/cjs/modules/archive/{unzip/extract.js → extract.js} +0 -0
- /package/dist/cjs/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
- /package/dist/cjs/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
- /package/dist/esm/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
- /package/dist/esm/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
- /package/dist/esm/modules/archive/{unzip/extract.js → extract.js} +0 -0
- /package/dist/esm/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
- /package/dist/esm/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
- /package/dist/types/modules/archive/{compression/compress.base.d.ts → compress.base.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/compress.d.ts → compress.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/crc32.base.d.ts → crc32.base.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/crc32.browser.d.ts → crc32.browser.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/crc32.d.ts → crc32.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts} +0 -0
- /package/dist/types/modules/archive/{unzip/extract.d.ts → extract.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/streaming-compress.base.d.ts → streaming-compress.base.d.ts} +0 -0
- /package/dist/types/modules/archive/{compression/streaming-compress.d.ts → streaming-compress.d.ts} +0 -0
- /package/dist/types/modules/archive/{zip-spec/zip-entry-info.d.ts → zip-entry-info.d.ts} +0 -0
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ZIP record builders (PKWARE APPNOTE)
|
|
3
|
-
*
|
|
4
|
-
* Shared by streaming zip writer and buffer zip builder.
|
|
5
|
-
*/
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// ZIP format constants (PKWARE APPNOTE)
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Signatures
|
|
10
|
-
export const LOCAL_FILE_HEADER_SIG = 0x04034b50;
|
|
11
|
-
export const CENTRAL_DIR_HEADER_SIG = 0x02014b50;
|
|
12
|
-
export const END_OF_CENTRAL_DIR_SIG = 0x06054b50;
|
|
13
|
-
export const DATA_DESCRIPTOR_SIG = 0x08074b50;
|
|
14
|
-
export const ZIP64_END_OF_CENTRAL_DIR_SIG = 0x06064b50;
|
|
15
|
-
export const ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIG = 0x07064b50;
|
|
16
|
-
// Versions
|
|
17
|
-
export const VERSION_NEEDED = 20; // 2.0 - supports DEFLATE
|
|
18
|
-
export const VERSION_MADE_BY = 20; // 2.0
|
|
19
|
-
// Compression methods
|
|
20
|
-
export const COMPRESSION_STORE = 0;
|
|
21
|
-
export const COMPRESSION_DEFLATE = 8;
|
|
22
|
-
// General purpose bit flags
|
|
23
|
-
export const FLAG_UTF8 = 0x0800;
|
|
24
|
-
export const FLAG_DATA_DESCRIPTOR = 0x0008;
|
|
25
|
-
// ZIP64 / sentinel sizes
|
|
26
|
-
export const UINT16_MAX = 0xffff;
|
|
27
|
-
export const UINT32_MAX = 0xffffffff;
|
|
28
|
-
export const ZIP_LOCAL_FILE_HEADER_FIXED_SIZE = 30;
|
|
29
|
-
export const ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE = 46;
|
|
30
|
-
export const ZIP_END_OF_CENTRAL_DIR_FIXED_SIZE = 22;
|
|
31
|
-
export function writeLocalFileHeaderInto(out, view, offset, input) {
|
|
32
|
-
const versionNeeded = input.versionNeeded ?? VERSION_NEEDED;
|
|
33
|
-
view.setUint32(offset + 0, LOCAL_FILE_HEADER_SIG, true);
|
|
34
|
-
view.setUint16(offset + 4, versionNeeded, true);
|
|
35
|
-
view.setUint16(offset + 6, input.flags, true);
|
|
36
|
-
view.setUint16(offset + 8, input.compressionMethod, true);
|
|
37
|
-
view.setUint16(offset + 10, input.dosTime, true);
|
|
38
|
-
view.setUint16(offset + 12, input.dosDate, true);
|
|
39
|
-
view.setUint32(offset + 14, input.crc32, true);
|
|
40
|
-
view.setUint32(offset + 18, input.compressedSize, true);
|
|
41
|
-
view.setUint32(offset + 22, input.uncompressedSize, true);
|
|
42
|
-
view.setUint16(offset + 26, input.fileName.length, true);
|
|
43
|
-
view.setUint16(offset + 28, input.extraField.length, true);
|
|
44
|
-
out.set(input.fileName, offset + ZIP_LOCAL_FILE_HEADER_FIXED_SIZE);
|
|
45
|
-
if (input.extraField.length > 0) {
|
|
46
|
-
out.set(input.extraField, offset + ZIP_LOCAL_FILE_HEADER_FIXED_SIZE + input.fileName.length);
|
|
47
|
-
}
|
|
48
|
-
return ZIP_LOCAL_FILE_HEADER_FIXED_SIZE + input.fileName.length + input.extraField.length;
|
|
49
|
-
}
|
|
50
|
-
export function buildLocalFileHeader(input) {
|
|
51
|
-
const header = new Uint8Array(ZIP_LOCAL_FILE_HEADER_FIXED_SIZE + input.fileName.length + input.extraField.length);
|
|
52
|
-
const view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
53
|
-
writeLocalFileHeaderInto(header, view, 0, input);
|
|
54
|
-
return header;
|
|
55
|
-
}
|
|
56
|
-
export function writeCentralDirectoryHeaderInto(out, view, offset, input) {
|
|
57
|
-
const versionMadeBy = input.versionMadeBy ?? VERSION_MADE_BY;
|
|
58
|
-
const versionNeeded = input.versionNeeded ?? VERSION_NEEDED;
|
|
59
|
-
const externalAttributes = input.externalAttributes ?? 0;
|
|
60
|
-
view.setUint32(offset + 0, CENTRAL_DIR_HEADER_SIG, true);
|
|
61
|
-
view.setUint16(offset + 4, versionMadeBy, true);
|
|
62
|
-
view.setUint16(offset + 6, versionNeeded, true);
|
|
63
|
-
view.setUint16(offset + 8, input.flags, true);
|
|
64
|
-
view.setUint16(offset + 10, input.compressionMethod, true);
|
|
65
|
-
view.setUint16(offset + 12, input.dosTime, true);
|
|
66
|
-
view.setUint16(offset + 14, input.dosDate, true);
|
|
67
|
-
view.setUint32(offset + 16, input.crc32, true);
|
|
68
|
-
view.setUint32(offset + 20, input.compressedSize, true);
|
|
69
|
-
view.setUint32(offset + 24, input.uncompressedSize, true);
|
|
70
|
-
view.setUint16(offset + 28, input.fileName.length, true);
|
|
71
|
-
view.setUint16(offset + 30, input.extraField.length, true);
|
|
72
|
-
view.setUint16(offset + 32, input.comment.length, true);
|
|
73
|
-
view.setUint16(offset + 34, 0, true); // disk number start
|
|
74
|
-
view.setUint16(offset + 36, 0, true); // internal file attributes
|
|
75
|
-
view.setUint32(offset + 38, externalAttributes, true);
|
|
76
|
-
view.setUint32(offset + 42, input.localHeaderOffset, true);
|
|
77
|
-
out.set(input.fileName, offset + ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE);
|
|
78
|
-
if (input.extraField.length > 0) {
|
|
79
|
-
out.set(input.extraField, offset + ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE + input.fileName.length);
|
|
80
|
-
}
|
|
81
|
-
if (input.comment.length > 0) {
|
|
82
|
-
out.set(input.comment, offset + ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE + input.fileName.length + input.extraField.length);
|
|
83
|
-
}
|
|
84
|
-
return (ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE +
|
|
85
|
-
input.fileName.length +
|
|
86
|
-
input.extraField.length +
|
|
87
|
-
input.comment.length);
|
|
88
|
-
}
|
|
89
|
-
export function buildCentralDirectoryHeader(input) {
|
|
90
|
-
const header = new Uint8Array(ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE +
|
|
91
|
-
input.fileName.length +
|
|
92
|
-
input.extraField.length +
|
|
93
|
-
input.comment.length);
|
|
94
|
-
const view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
95
|
-
writeCentralDirectoryHeaderInto(header, view, 0, input);
|
|
96
|
-
return header;
|
|
97
|
-
}
|
|
98
|
-
export function writeEndOfCentralDirectoryInto(out, view, offset, input) {
|
|
99
|
-
view.setUint32(offset + 0, END_OF_CENTRAL_DIR_SIG, true);
|
|
100
|
-
view.setUint16(offset + 4, 0, true);
|
|
101
|
-
view.setUint16(offset + 6, 0, true);
|
|
102
|
-
view.setUint16(offset + 8, input.entryCount, true);
|
|
103
|
-
view.setUint16(offset + 10, input.entryCount, true);
|
|
104
|
-
view.setUint32(offset + 12, input.centralDirSize, true);
|
|
105
|
-
view.setUint32(offset + 16, input.centralDirOffset, true);
|
|
106
|
-
view.setUint16(offset + 20, input.comment.length, true);
|
|
107
|
-
if (input.comment.length > 0) {
|
|
108
|
-
out.set(input.comment, offset + ZIP_END_OF_CENTRAL_DIR_FIXED_SIZE);
|
|
109
|
-
}
|
|
110
|
-
return ZIP_END_OF_CENTRAL_DIR_FIXED_SIZE + input.comment.length;
|
|
111
|
-
}
|
|
112
|
-
export function buildEndOfCentralDirectory(input) {
|
|
113
|
-
const record = new Uint8Array(ZIP_END_OF_CENTRAL_DIR_FIXED_SIZE + input.comment.length);
|
|
114
|
-
const view = new DataView(record.buffer, record.byteOffset, record.byteLength);
|
|
115
|
-
writeEndOfCentralDirectoryInto(record, view, 0, input);
|
|
116
|
-
return record;
|
|
117
|
-
}
|
|
118
|
-
export function buildDataDescriptor(crc32, compressedSize, uncompressedSize) {
|
|
119
|
-
const descriptor = new Uint8Array(16);
|
|
120
|
-
const view = new DataView(descriptor.buffer);
|
|
121
|
-
view.setUint32(0, DATA_DESCRIPTOR_SIG, true);
|
|
122
|
-
view.setUint32(4, crc32, true);
|
|
123
|
-
view.setUint32(8, compressedSize, true);
|
|
124
|
-
view.setUint32(12, uncompressedSize, true);
|
|
125
|
-
return descriptor;
|
|
126
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare class ByteQueue {
|
|
2
|
-
private static readonly EMPTY;
|
|
3
|
-
private _chunks;
|
|
4
|
-
private _headOffset;
|
|
5
|
-
private _length;
|
|
6
|
-
private _cachedView;
|
|
7
|
-
private _cachedLength;
|
|
8
|
-
constructor(initial?: Uint8Array);
|
|
9
|
-
get length(): number;
|
|
10
|
-
isEmpty(): boolean;
|
|
11
|
-
view(): Uint8Array;
|
|
12
|
-
reset(data?: Uint8Array): void;
|
|
13
|
-
append(chunk: Uint8Array): void;
|
|
14
|
-
read(length: number): Uint8Array;
|
|
15
|
-
/**
|
|
16
|
-
* Return a list of chunk views totaling `length` bytes without consuming.
|
|
17
|
-
*
|
|
18
|
-
* This avoids materializing a contiguous buffer for streaming write paths.
|
|
19
|
-
*/
|
|
20
|
-
peekChunks(length: number): Uint8Array[];
|
|
21
|
-
discard(length: number): void;
|
|
22
|
-
/**
|
|
23
|
-
* Find the first index of `pattern` within the queue.
|
|
24
|
-
*
|
|
25
|
-
* This avoids materializing a contiguous `view()` for common small patterns
|
|
26
|
-
* (ZIP signatures are typically 2-4 bytes).
|
|
27
|
-
*/
|
|
28
|
-
indexOfPattern(pattern: Uint8Array, startIndex?: number): number;
|
|
29
|
-
/** Peek a little-endian uint32 at `offset` without consuming bytes. Returns null if not enough bytes. */
|
|
30
|
-
peekUint32LE(offset: number): number | null;
|
|
31
|
-
/** Peek a single byte at `offset` without consuming bytes. */
|
|
32
|
-
peekByte(offset: number): number;
|
|
33
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type ArchiveSink = WritableStream<Uint8Array> | {
|
|
2
|
-
write(chunk: Uint8Array): any;
|
|
3
|
-
end?(cb?: any): any;
|
|
4
|
-
on?(event: string, listener: (...args: any[]) => void): any;
|
|
5
|
-
once?(event: string, listener: (...args: any[]) => void): any;
|
|
6
|
-
};
|
|
7
|
-
export declare function isWritableStream(value: unknown): value is WritableStream<Uint8Array>;
|
|
8
|
-
export declare function pipeIterableToSink(iterable: AsyncIterable<Uint8Array>, sink: ArchiveSink): Promise<void>;
|
|
9
|
-
export declare function collect(iterable: AsyncIterable<Uint8Array>): Promise<Uint8Array>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type ArchiveSource = Uint8Array | ArrayBuffer | string | Blob | AsyncIterable<unknown> | ReadableStream<unknown> | {
|
|
2
|
-
[Symbol.asyncIterator](): AsyncIterator<unknown>;
|
|
3
|
-
};
|
|
4
|
-
export declare function isReadableStream(value: unknown): value is ReadableStream<unknown>;
|
|
5
|
-
export declare function isAsyncIterable(value: unknown): value is AsyncIterable<unknown>;
|
|
6
|
-
export declare function toUint8ArraySync(source: Uint8Array | ArrayBuffer | string): Uint8Array;
|
|
7
|
-
export declare function toUint8Array(source: Uint8Array | ArrayBuffer | string | Blob): Promise<Uint8Array>;
|
|
8
|
-
export declare function toAsyncIterable(source: ArchiveSource): AsyncIterable<Uint8Array>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ZipParser, type ZipEntryInfo } from "./zip-parser.js";
|
|
2
|
-
import { type ParseOptions, type ZipEntry as ParseZipEntry } from "./stream.js";
|
|
3
|
-
import { type ArchiveSink } from "../io/archive-sink.js";
|
|
4
|
-
import { type ArchiveSource } from "../io/archive-source.js";
|
|
5
|
-
export interface UnzipOptions {
|
|
6
|
-
decodeStrings?: boolean;
|
|
7
|
-
parse?: ParseOptions;
|
|
8
|
-
}
|
|
9
|
-
export declare class UnzipEntry {
|
|
10
|
-
readonly path: string;
|
|
11
|
-
readonly isDirectory: boolean;
|
|
12
|
-
private readonly _info?;
|
|
13
|
-
private readonly _parser?;
|
|
14
|
-
private readonly _parseEntry?;
|
|
15
|
-
constructor(args: {
|
|
16
|
-
kind: "buffer";
|
|
17
|
-
parser: ZipParser;
|
|
18
|
-
info: ZipEntryInfo;
|
|
19
|
-
} | {
|
|
20
|
-
kind: "stream";
|
|
21
|
-
entry: ParseZipEntry;
|
|
22
|
-
});
|
|
23
|
-
bytes(): Promise<Uint8Array>;
|
|
24
|
-
stream(): AsyncIterable<Uint8Array>;
|
|
25
|
-
pipeTo(sink: ArchiveSink): Promise<void>;
|
|
26
|
-
text(encoding?: string): Promise<string>;
|
|
27
|
-
discard(): void;
|
|
28
|
-
}
|
|
29
|
-
export declare class ZipReader {
|
|
30
|
-
private readonly _source;
|
|
31
|
-
private readonly _options;
|
|
32
|
-
private _bufferParser;
|
|
33
|
-
constructor(source: ArchiveSource, options?: UnzipOptions);
|
|
34
|
-
private _ensureBufferParser;
|
|
35
|
-
get(path: string): Promise<UnzipEntry | null>;
|
|
36
|
-
entries(): AsyncIterable<UnzipEntry>;
|
|
37
|
-
bytes(path: string): Promise<Uint8Array | null>;
|
|
38
|
-
close(): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
export declare function unzip(source: ArchiveSource, options?: UnzipOptions): ZipReader;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Heuristic: detect incompressible (high-entropy) data.
|
|
3
|
-
*
|
|
4
|
-
* This is a performance optimization: if data looks random, DEFLATE usually
|
|
5
|
-
* wastes CPU and may even produce slightly larger output.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isProbablyIncompressible(data: Uint8Array, options?: {
|
|
8
|
-
sampleBytes?: number;
|
|
9
|
-
minDecisionBytes?: number;
|
|
10
|
-
}): boolean;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface PatternSearchTarget {
|
|
2
|
-
indexOfPattern(pattern: Uint8Array, startIndex: number): number;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Stateful helper for incremental pattern scanning in growing buffers.
|
|
6
|
-
*
|
|
7
|
-
* The scanner tracks a `searchFrom` cursor and an `overlap` region so callers
|
|
8
|
-
* can avoid rescanning bytes that cannot start a match.
|
|
9
|
-
*/
|
|
10
|
-
export declare class PatternScanner {
|
|
11
|
-
readonly pattern: Uint8Array;
|
|
12
|
-
readonly overlap: number;
|
|
13
|
-
searchFrom: number;
|
|
14
|
-
constructor(pattern: Uint8Array);
|
|
15
|
-
/** Find the next match index starting at the current `searchFrom`. */
|
|
16
|
-
find(target: PatternSearchTarget): number;
|
|
17
|
-
/** Update `searchFrom` after consuming `consumed` bytes from the front. */
|
|
18
|
-
onConsume(consumed: number): void;
|
|
19
|
-
/** Update `searchFrom` after a no-match scan on a buffer of length `bufferLength`. */
|
|
20
|
-
onNoMatch(bufferLength: number): void;
|
|
21
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ZipTimestampMode } from "../utils/timestamps.js";
|
|
2
|
-
import { type ArchiveSink } from "../io/archive-sink.js";
|
|
3
|
-
import { type ArchiveSource } from "../io/archive-source.js";
|
|
4
|
-
export interface ZipOptions {
|
|
5
|
-
level?: number;
|
|
6
|
-
timestamps?: ZipTimestampMode;
|
|
7
|
-
comment?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Default modification time for entries that don't specify `modTime`.
|
|
10
|
-
*
|
|
11
|
-
* If you need stable output across runs, either pass this explicitly or use `reproducible: true`.
|
|
12
|
-
*/
|
|
13
|
-
modTime?: Date;
|
|
14
|
-
/**
|
|
15
|
-
* If true, bias defaults toward reproducible output:
|
|
16
|
-
* - default `modTime` becomes 1980-01-01 00:00:00 (local time)
|
|
17
|
-
* - default `timestamps` becomes "dos" (no UTC extra field)
|
|
18
|
-
*/
|
|
19
|
-
reproducible?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* If true (default), automatically STORE incompressible data.
|
|
22
|
-
* If false, always follow `level` (DEFLATE when level > 0).
|
|
23
|
-
*/
|
|
24
|
-
smartStore?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface ZipEntryOptions {
|
|
27
|
-
level?: number;
|
|
28
|
-
modTime?: Date;
|
|
29
|
-
comment?: string;
|
|
30
|
-
}
|
|
31
|
-
export declare class ZipArchive {
|
|
32
|
-
private readonly _options;
|
|
33
|
-
private readonly _entries;
|
|
34
|
-
private _sealed;
|
|
35
|
-
constructor(options?: ZipOptions);
|
|
36
|
-
add(name: string, source: ArchiveSource, options?: ZipEntryOptions): this;
|
|
37
|
-
stream(): AsyncIterable<Uint8Array>;
|
|
38
|
-
bytes(): Promise<Uint8Array>;
|
|
39
|
-
bytesSync(): Uint8Array;
|
|
40
|
-
pipeTo(sink: ArchiveSink): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
export declare function zip(options?: ZipOptions): ZipArchive;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ZIP file format encoder (single-buffer output)
|
|
3
|
-
*
|
|
4
|
-
* Implements ZIP file structure according to PKWARE's APPNOTE.TXT specification
|
|
5
|
-
* https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
|
|
6
|
-
*
|
|
7
|
-
* This module focuses on producing a complete ZIP as a single Uint8Array.
|
|
8
|
-
* For true streaming (push chunks while reading sources), use `zip()` / `ZipArchive.stream()`.
|
|
9
|
-
*/
|
|
10
|
-
import { type CompressOptions } from "../compression/compress.js";
|
|
11
|
-
import { type ZipTimestampMode } from "../utils/timestamps.js";
|
|
12
|
-
/**
|
|
13
|
-
* ZIP file entry
|
|
14
|
-
*/
|
|
15
|
-
export interface ZipEntry {
|
|
16
|
-
/** File name (can include directory path, use forward slashes) */
|
|
17
|
-
name: string;
|
|
18
|
-
/** File data (will be compressed unless level=0) */
|
|
19
|
-
data: Uint8Array;
|
|
20
|
-
/** Optional per-entry compression level override */
|
|
21
|
-
level?: number;
|
|
22
|
-
/** File modification time (optional, defaults to current time) */
|
|
23
|
-
modTime?: Date;
|
|
24
|
-
/** File comment (optional) */
|
|
25
|
-
comment?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* ZIP encoder options
|
|
29
|
-
*/
|
|
30
|
-
export interface ZipOptions extends CompressOptions {
|
|
31
|
-
/** ZIP file comment (optional) */
|
|
32
|
-
comment?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Default modification time for entries that don't specify `modTime`.
|
|
35
|
-
*
|
|
36
|
-
* If you need stable output across runs, either pass this explicitly or use `reproducible: true`.
|
|
37
|
-
*/
|
|
38
|
-
modTime?: Date;
|
|
39
|
-
/**
|
|
40
|
-
* If true, bias defaults toward reproducible output:
|
|
41
|
-
* - default `modTime` becomes 1980-01-01 00:00:00 (local time)
|
|
42
|
-
* - default `timestamps` becomes "dos" (no UTC extra field)
|
|
43
|
-
*/
|
|
44
|
-
reproducible?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Max number of entries to compress concurrently in `createZip()`.
|
|
47
|
-
* This helps avoid zlib threadpool saturation / memory spikes with many files.
|
|
48
|
-
*
|
|
49
|
-
* Defaults to 4.
|
|
50
|
-
*/
|
|
51
|
-
concurrency?: number;
|
|
52
|
-
/**
|
|
53
|
-
* If true (default), automatically STORE incompressible data.
|
|
54
|
-
* If false, always follow `level` (DEFLATE when level > 0).
|
|
55
|
-
*/
|
|
56
|
-
smartStore?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Timestamp writing strategy.
|
|
59
|
-
* - "dos": only write DOS date/time fields (smallest output)
|
|
60
|
-
* - "dos+utc": also write UTC mtime in 0x5455 extra field
|
|
61
|
-
*/
|
|
62
|
-
timestamps?: ZipTimestampMode;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Create a ZIP file from entries (async)
|
|
66
|
-
*/
|
|
67
|
-
export declare function createZip(entries: ZipEntry[], options?: ZipOptions): Promise<Uint8Array>;
|
|
68
|
-
/**
|
|
69
|
-
* Create a ZIP file from entries (sync)
|
|
70
|
-
*
|
|
71
|
-
* This is supported in both Node.js and browser builds.
|
|
72
|
-
*/
|
|
73
|
-
export declare function createZipSync(entries: ZipEntry[], options?: ZipOptions): Uint8Array;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/browser/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/browser/modules/archive/{zip/zip-entry-metadata.d.ts → zip-entry-metadata.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/modules/archive/{compression/streaming-compress.d.ts → streaming-compress.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|