UNPKG

3.41 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3import { EventEmitter as EE } from 'events';
4import { BrotliDecompress, Unzip } from 'minizlib';
5import { Yallist } from 'yallist';
6import { TarOptions } from './options.js';
7import { Pax } from './pax.js';
8import { ReadEntry } from './read-entry.js';
9import { type WarnData, type Warner } from './warn-method.js';
10declare const STATE: unique symbol;
11declare const WRITEENTRY: unique symbol;
12declare const READENTRY: unique symbol;
13declare const NEXTENTRY: unique symbol;
14declare const PROCESSENTRY: unique symbol;
15declare const EX: unique symbol;
16declare const GEX: unique symbol;
17declare const META: unique symbol;
18declare const EMITMETA: unique symbol;
19declare const BUFFER: unique symbol;
20declare const QUEUE: unique symbol;
21declare const ENDED: unique symbol;
22declare const EMITTEDEND: unique symbol;
23declare const EMIT: unique symbol;
24declare const UNZIP: unique symbol;
25declare const CONSUMECHUNK: unique symbol;
26declare const CONSUMECHUNKSUB: unique symbol;
27declare const CONSUMEBODY: unique symbol;
28declare const CONSUMEMETA: unique symbol;
29declare const CONSUMEHEADER: unique symbol;
30declare const CONSUMING: unique symbol;
31declare const BUFFERCONCAT: unique symbol;
32declare const MAYBEEND: unique symbol;
33declare const WRITING: unique symbol;
34declare const ABORTED: unique symbol;
35declare const SAW_VALID_ENTRY: unique symbol;
36declare const SAW_NULL_BLOCK: unique symbol;
37declare const SAW_EOF: unique symbol;
38declare const CLOSESTREAM: unique symbol;
39export type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body';
40export declare class Parser extends EE implements Warner {
41 file: string;
42 strict: boolean;
43 maxMetaEntrySize: number;
44 filter: Exclude<TarOptions['filter'], undefined>;
45 brotli?: TarOptions['brotli'];
46 writable: true;
47 readable: false;
48 [QUEUE]: Yallist<ReadEntry | [string | symbol, any, any]>;
49 [BUFFER]?: Buffer;
50 [READENTRY]?: ReadEntry;
51 [WRITEENTRY]?: ReadEntry;
52 [STATE]: State;
53 [META]: string;
54 [EX]?: Pax;
55 [GEX]?: Pax;
56 [ENDED]: boolean;
57 [UNZIP]?: false | Unzip | BrotliDecompress;
58 [ABORTED]: boolean;
59 [SAW_VALID_ENTRY]?: boolean;
60 [SAW_NULL_BLOCK]: boolean;
61 [SAW_EOF]: boolean;
62 [WRITING]: boolean;
63 [CONSUMING]: boolean;
64 [EMITTEDEND]: boolean;
65 constructor(opt?: TarOptions);
66 warn(code: string, message: string | Error, data?: WarnData): void;
67 [CONSUMEHEADER](chunk: Buffer, position: number): void;
68 [CLOSESTREAM](): void;
69 [PROCESSENTRY](entry?: ReadEntry | [string | symbol, any, any]): boolean;
70 [NEXTENTRY](): void;
71 [CONSUMEBODY](chunk: Buffer, position: number): number;
72 [CONSUMEMETA](chunk: Buffer, position: number): number;
73 [EMIT](ev: string | symbol, data?: any, extra?: any): void;
74 [EMITMETA](entry: ReadEntry): void;
75 abort(error: Error): void;
76 write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
77 write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
78 [BUFFERCONCAT](c: Buffer): void;
79 [MAYBEEND](): void;
80 [CONSUMECHUNK](chunk?: Buffer): void;
81 [CONSUMECHUNKSUB](chunk: Buffer): void;
82 end(cb?: () => void): this;
83 end(data: string | Buffer, cb?: () => void): this;
84 end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
85}
86export {};
87//# sourceMappingURL=parse.d.ts.map
\No newline at end of file