streaming 7-Zip archive extractor
0

Configure Feed

Select the types of activity you want to include in your feed.

pkg-7zip / lib / constants.ts
1.7 kB 71 lines
1/** 2 * @module 3 * 4 * constants shared across the 7z parser and decoder layers: the file 5 * signature, property tag IDs from the format specification, and the 6 * well-known coder method identifiers. 7 */ 8 9/** the 6-byte magic at the start of every 7z archive: `"7z\xbc\xaf\x27\x1c"`. */ 10export const SIGNATURE: Uint8Array<ArrayBuffer> = new Uint8Array([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c]); 11 12/** total length of the fixed-size signature header at the start of the file. */ 13export const SIGNATURE_HEADER_SIZE = 32; 14 15/** 16 * NID property tags used in the 7z header. names mirror the LZMA-SDK reference 17 * source (`CPP/7zip/Archive/7z/7zHeader.h`). 18 */ 19export const Property = { 20 additionalStreamsInfo: 0x03, 21 anti: 0x10, 22 archiveProperties: 0x02, 23 aTime: 0x13, 24 codersUnpackSize: 0x0c, 25 comment: 0x16, 26 crc: 0x0a, 27 cTime: 0x12, 28 dummy: 0x19, 29 emptyFile: 0x0f, 30 emptyStream: 0x0e, 31 encodedHeader: 0x17, 32 end: 0x00, 33 filesInfo: 0x05, 34 folder: 0x0b, 35 header: 0x01, 36 mainStreamsInfo: 0x04, 37 mTime: 0x14, 38 name: 0x11, 39 numUnpackStream: 0x0d, 40 packInfo: 0x06, 41 size: 0x09, 42 startPos: 0x18, 43 subStreamsInfo: 0x08, 44 unpackInfo: 0x07, 45 winAttributes: 0x15, 46} as const; 47 48/** 49 * well-known coder method IDs from the LZMA-SDK reference 50 * (`CPP/7zip/Archive/7z/7zHandler.cpp`). encoded big-endian as variable-length 51 * byte sequences in the archive; we treat them as JS numbers for switching. 52 */ 53export const Method = { 54 aes256Sha256: 0x06f10701, 55 arm: 0x03030501, 56 arm64: 0x0a, 57 armthumb: 0x03030701, 58 bcj: 0x03030103, 59 bcj2: 0x0303011b, 60 bzip2: 0x040202, 61 copy: 0x00, 62 deflate: 0x040108, 63 delta: 0x03, 64 ia64: 0x03030401, 65 lzma: 0x030101, 66 lzma2: 0x21, 67 powerpc: 0x03030205, 68 riscv: 0x0b, 69 sparc: 0x03030805, 70 zstd: 0x04f71101, 71} as const;