node/typings/internalBinding/http_parser.d.ts
Michaël Zasso af452b8119
typings: improve internal binding types
- Add typings for `async_context_frame`, `icu`, and `sea` bindings
- Add a few missing exports on other bindings
- Add a few missing primordials

PR-URL: https://github.com/nodejs/node/pull/59176
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-08-02 05:43:00 +00:00

56 lines
1.3 KiB
TypeScript

declare namespace InternalHttpParserBinding {
type Buffer = Uint8Array;
type Stream = object;
class ConnectionsList {
constructor();
all(): HTTPParser[];
idle(): HTTPParser[];
active(): HTTPParser[];
expired(): HTTPParser[];
}
class HTTPParser {
static REQUEST: 1;
static RESPONSE: 2;
static kOnMessageBegin: 0;
static kOnHeaders: 1;
static kOnHeadersComplete: 2;
static kOnBody: 3;
static kOnMessageComplete: 4;
static kOnExecute: 5;
static kOnTimeout: 6;
static kLenientNone: number;
static kLenientHeaders: number;
static kLenientChunkedLength: number;
static kLenientKeepAlive: number;
static kLenientAll: number;
close(): void;
free(): void;
execute(buffer: Buffer): Error | Buffer;
finish(): Error | Buffer;
initialize(
type: number,
resource: object,
maxHeaderSize?: number,
lenient?: number,
headersTimeout?: number,
): void;
pause(): void;
resume(): void;
consume(stream: Stream): void;
unconsume(): void;
getCurrentBuffer(): Buffer;
}
}
export interface HttpParserBinding {
ConnectionsList: typeof InternalHttpParserBinding.ConnectionsList;
HTTPParser: typeof InternalHttpParserBinding.HTTPParser;
allMethods: string[];
methods: string[];
}