UNPKG

1.02 kBTypeScriptView Raw
1/// <reference types="node" />
2export declare const HEADER_LENGTH = 8;
3export declare const TYPE: {
4 [key: string]: number;
5};
6export declare const OFFSET: {
7 Type: number;
8 Status: number;
9 Length: number;
10 SPID: number;
11 PacketID: number;
12 Window: number;
13};
14export declare class Packet {
15 buffer: Buffer;
16 constructor(typeOrBuffer: Buffer | number);
17 setLength(): void;
18 length(): number;
19 resetConnection(reset: boolean): void;
20 last(last?: boolean): boolean;
21 ignore(last: boolean): void;
22 isLast(): boolean;
23 packetId(packetId?: number): number;
24 addData(data: Buffer): this;
25 data(): Buffer;
26 type(): number;
27 statusAsString(): string;
28 headerToString(indent?: string): string;
29 dataToString(indent?: string): string;
30 toString(indent?: string): string;
31 payloadString(): string;
32}
33export declare function isPacketComplete(potentialPacketBuffer: Buffer): boolean;
34export declare function packetLength(potentialPacketBuffer: Buffer): number;