Commit e11c97e9 authored by KangMin An's avatar KangMin An
Browse files

Delete: Untracked Files-nodemodules & package.json

parent 9d3019a3
declare module 'http2' {
import EventEmitter = require('events');
import * as fs from 'fs';
import * as net from 'net';
import * as stream from 'stream';
import * as tls from 'tls';
import * as url from 'url';
import {
IncomingHttpHeaders as Http1IncomingHttpHeaders,
OutgoingHttpHeaders,
IncomingMessage,
ServerResponse,
} from 'http';
export { OutgoingHttpHeaders } from 'http';
export interface IncomingHttpStatusHeader {
":status"?: number;
}
export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
":path"?: string;
":method"?: string;
":authority"?: string;
":scheme"?: string;
}
// Http2Stream
export interface StreamPriorityOptions {
exclusive?: boolean;
parent?: number;
weight?: number;
silent?: boolean;
}
export interface StreamState {
localWindowSize?: number;
state?: number;
localClose?: number;
remoteClose?: number;
sumDependencyWeight?: number;
weight?: number;
}
export interface ServerStreamResponseOptions {
endStream?: boolean;
waitForTrailers?: boolean;
}
export interface StatOptions {
offset: number;
length: number;
}
export interface ServerStreamFileResponseOptions {
statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
waitForTrailers?: boolean;
offset?: number;
length?: number;
}
export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
onError?(err: NodeJS.ErrnoException): void;
}
export interface Http2Stream extends stream.Duplex {
readonly aborted: boolean;
readonly bufferSize: number;
readonly closed: boolean;
readonly destroyed: boolean;
/**
* Set the true if the END_STREAM flag was set in the request or response HEADERS frame received,
* indicating that no additional data should be received and the readable side of the Http2Stream will be closed.
*/
readonly endAfterHeaders: boolean;
readonly id?: number;
readonly pending: boolean;
readonly rstCode: number;
readonly sentHeaders: OutgoingHttpHeaders;
readonly sentInfoHeaders?: OutgoingHttpHeaders[];
readonly sentTrailers?: OutgoingHttpHeaders;
readonly session: Http2Session;
readonly state: StreamState;
close(code?: number, callback?: () => void): void;
priority(options: StreamPriorityOptions): void;
setTimeout(msecs: number, callback?: () => void): void;
sendTrailers(headers: OutgoingHttpHeaders): void;
addListener(event: "aborted", listener: () => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
addListener(event: "streamClosed", listener: (code: number) => void): this;
addListener(event: "timeout", listener: () => void): this;
addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "wantTrailers", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "aborted"): boolean;
emit(event: "close"): boolean;
emit(event: "data", chunk: Buffer | string): boolean;
emit(event: "drain"): boolean;
emit(event: "end"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "finish"): boolean;
emit(event: "frameError", frameType: number, errorCode: number): boolean;
emit(event: "pipe", src: stream.Readable): boolean;
emit(event: "unpipe", src: stream.Readable): boolean;
emit(event: "streamClosed", code: number): boolean;
emit(event: "timeout"): boolean;
emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "wantTrailers"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "aborted", listener: () => void): this;
on(event: "close", listener: () => void): this;
on(event: "data", listener: (chunk: Buffer | string) => void): this;
on(event: "drain", listener: () => void): this;
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
on(event: "pipe", listener: (src: stream.Readable) => void): this;
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
on(event: "streamClosed", listener: (code: number) => void): this;
on(event: "timeout", listener: () => void): this;
on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "wantTrailers", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "aborted", listener: () => void): this;
once(event: "close", listener: () => void): this;
once(event: "data", listener: (chunk: Buffer | string) => void): this;
once(event: "drain", listener: () => void): this;
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
once(event: "pipe", listener: (src: stream.Readable) => void): this;
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
once(event: "streamClosed", listener: (code: number) => void): this;
once(event: "timeout", listener: () => void): this;
once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "wantTrailers", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "aborted", listener: () => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "streamClosed", listener: (code: number) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "wantTrailers", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "aborted", listener: () => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "streamClosed", listener: (code: number) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "wantTrailers", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface ClientHttp2Stream extends Http2Stream {
addListener(event: "continue", listener: () => {}): this;
addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "continue"): boolean;
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "continue", listener: () => {}): this;
on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "continue", listener: () => {}): this;
once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "continue", listener: () => {}): this;
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "continue", listener: () => {}): this;
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface ServerHttp2Stream extends Http2Stream {
readonly headersSent: boolean;
readonly pushAllowed: boolean;
additionalHeaders(headers: OutgoingHttpHeaders): void;
pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void;
respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void;
}
// Http2Session
export interface Settings {
headerTableSize?: number;
enablePush?: boolean;
initialWindowSize?: number;
maxFrameSize?: number;
maxConcurrentStreams?: number;
maxHeaderListSize?: number;
enableConnectProtocol?: boolean;
}
export interface ClientSessionRequestOptions {
endStream?: boolean;
exclusive?: boolean;
parent?: number;
weight?: number;
waitForTrailers?: boolean;
}
export interface SessionState {
effectiveLocalWindowSize?: number;
effectiveRecvDataLength?: number;
nextStreamID?: number;
localWindowSize?: number;
lastProcStreamID?: number;
remoteWindowSize?: number;
outboundQueueSize?: number;
deflateDynamicTableSize?: number;
inflateDynamicTableSize?: number;
}
export interface Http2Session extends EventEmitter {
readonly alpnProtocol?: string;
readonly closed: boolean;
readonly connecting: boolean;
readonly destroyed: boolean;
readonly encrypted?: boolean;
readonly localSettings: Settings;
readonly originSet?: string[];
readonly pendingSettingsAck: boolean;
readonly remoteSettings: Settings;
readonly socket: net.Socket | tls.TLSSocket;
readonly state: SessionState;
readonly type: number;
close(callback?: () => void): void;
destroy(error?: Error, code?: number): void;
goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
ref(): void;
setLocalWindowSize(windowSize: number): void;
setTimeout(msecs: number, callback?: () => void): void;
settings(settings: Settings): void;
unref(): void;
addListener(event: "close", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
addListener(event: "localSettings", listener: (settings: Settings) => void): this;
addListener(event: "ping", listener: () => void): this;
addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
addListener(event: "timeout", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean;
emit(event: "localSettings", settings: Settings): boolean;
emit(event: "ping"): boolean;
emit(event: "remoteSettings", settings: Settings): boolean;
emit(event: "timeout"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
on(event: "localSettings", listener: (settings: Settings) => void): this;
on(event: "ping", listener: () => void): this;
on(event: "remoteSettings", listener: (settings: Settings) => void): this;
on(event: "timeout", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
once(event: "localSettings", listener: (settings: Settings) => void): this;
once(event: "ping", listener: () => void): this;
once(event: "remoteSettings", listener: (settings: Settings) => void): this;
once(event: "timeout", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
prependListener(event: "ping", listener: () => void): this;
prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
prependOnceListener(event: "ping", listener: () => void): this;
prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface ClientHttp2Session extends Http2Session {
request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
addListener(event: "origin", listener: (origins: string[]) => void): this;
addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
emit(event: "origin", origins: ReadonlyArray<string>): boolean;
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
on(event: "origin", listener: (origins: string[]) => void): this;
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
once(event: "origin", listener: (origins: string[]) => void): this;
once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependListener(event: "origin", listener: (origins: string[]) => void): this;
prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface AlternativeServiceOptions {
origin: number | string | url.URL;
}
export interface ServerHttp2Session extends Http2Session {
readonly server: Http2Server | Http2SecureServer;
altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
origin(...args: Array<string | url.URL | { origin: string }>): void;
addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
// Http2Server
export interface SessionOptions {
maxDeflateDynamicTableSize?: number;
maxSessionMemory?: number;
maxHeaderListPairs?: number;
maxOutstandingPings?: number;
maxSendHeaderBlockLength?: number;
paddingStrategy?: number;
peerMaxConcurrentStreams?: number;
settings?: Settings;
/**
* Specifies a timeout in milliseconds that
* a server should wait when an [`'unknownProtocol'`][] is emitted. If the
* socket has not been destroyed by that time the server will destroy it.
* @default 100000
*/
unknownProtocolTimeout?: number;
selectPadding?(frameLen: number, maxFrameLen: number): number;
createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
}
export interface ClientSessionOptions extends SessionOptions {
maxReservedRemoteStreams?: number;
createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex;
protocol?: 'http:' | 'https:';
}
export interface ServerSessionOptions extends SessionOptions {
Http1IncomingMessage?: typeof IncomingMessage;
Http1ServerResponse?: typeof ServerResponse;
Http2ServerRequest?: typeof Http2ServerRequest;
Http2ServerResponse?: typeof Http2ServerResponse;
}
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { }
export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { }
export interface ServerOptions extends ServerSessionOptions { }
export interface SecureServerOptions extends SecureServerSessionOptions {
allowHTTP1?: boolean;
origins?: string[];
}
interface HTTP2ServerCommon {
setTimeout(msec?: number, callback?: () => void): this;
/**
* Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
* Throws ERR_INVALID_ARG_TYPE for invalid settings argument.
*/
updateSettings(settings: Settings): void;
}
export interface Http2Server extends net.Server, HTTP2ServerCommon {
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
addListener(event: "sessionError", listener: (err: Error) => void): this;
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "timeout", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
emit(event: "session", session: ServerHttp2Session): boolean;
emit(event: "sessionError", err: Error): boolean;
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "timeout"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
on(event: "sessionError", listener: (err: Error) => void): this;
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "timeout", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
once(event: "sessionError", listener: (err: Error) => void): this;
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "timeout", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
prependListener(event: "sessionError", listener: (err: Error) => void): this;
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon {
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
addListener(event: "sessionError", listener: (err: Error) => void): this;
addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "timeout", listener: () => void): this;
addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
emit(event: "session", session: ServerHttp2Session): boolean;
emit(event: "sessionError", err: Error): boolean;
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "timeout"): boolean;
emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
on(event: "sessionError", listener: (err: Error) => void): this;
on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "timeout", listener: () => void): this;
on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
once(event: "sessionError", listener: (err: Error) => void): this;
once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "timeout", listener: () => void): this;
once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
prependListener(event: "sessionError", listener: (err: Error) => void): this;
prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export class Http2ServerRequest extends stream.Readable {
constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray<string>);
readonly aborted: boolean;
readonly authority: string;
readonly connection: net.Socket | tls.TLSSocket;
readonly complete: boolean;
readonly headers: IncomingHttpHeaders;
readonly httpVersion: string;
readonly httpVersionMinor: number;
readonly httpVersionMajor: number;
readonly method: string;
readonly rawHeaders: string[];
readonly rawTrailers: string[];
readonly scheme: string;
readonly socket: net.Socket | tls.TLSSocket;
readonly stream: ServerHttp2Stream;
readonly trailers: IncomingHttpHeaders;
readonly url: string;
setTimeout(msecs: number, callback?: () => void): void;
read(size?: number): Buffer | string | null;
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "readable", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "aborted", hadError: boolean, code: number): boolean;
emit(event: "close"): boolean;
emit(event: "data", chunk: Buffer | string): boolean;
emit(event: "end"): boolean;
emit(event: "readable"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
on(event: "close", listener: () => void): this;
on(event: "data", listener: (chunk: Buffer | string) => void): this;
on(event: "end", listener: () => void): this;
on(event: "readable", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
once(event: "close", listener: () => void): this;
once(event: "data", listener: (chunk: Buffer | string) => void): this;
once(event: "end", listener: () => void): this;
once(event: "readable", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "readable", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "readable", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export class Http2ServerResponse extends stream.Writable {
constructor(stream: ServerHttp2Stream);
readonly connection: net.Socket | tls.TLSSocket;
readonly finished: boolean;
readonly headersSent: boolean;
readonly socket: net.Socket | tls.TLSSocket;
readonly stream: ServerHttp2Stream;
sendDate: boolean;
statusCode: number;
statusMessage: '';
addTrailers(trailers: OutgoingHttpHeaders): void;
end(callback?: () => void): void;
end(data: string | Uint8Array, callback?: () => void): void;
end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): void;
getHeader(name: string): string;
getHeaderNames(): string[];
getHeaders(): OutgoingHttpHeaders;
hasHeader(name: string): boolean;
removeHeader(name: string): void;
setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
setTimeout(msecs: number, callback?: () => void): void;
write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean;
writeContinue(): void;
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void;
addListener(event: "close", listener: () => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "drain"): boolean;
emit(event: "error", error: Error): boolean;
emit(event: "finish"): boolean;
emit(event: "pipe", src: stream.Readable): boolean;
emit(event: "unpipe", src: stream.Readable): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (error: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "pipe", listener: (src: stream.Readable) => void): this;
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "drain", listener: () => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "pipe", listener: (src: stream.Readable) => void): this;
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "error", listener: (error: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "error", listener: (error: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
// Public API
export namespace constants {
const NGHTTP2_SESSION_SERVER: number;
const NGHTTP2_SESSION_CLIENT: number;
const NGHTTP2_STREAM_STATE_IDLE: number;
const NGHTTP2_STREAM_STATE_OPEN: number;
const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number;
const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number;
const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number;
const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number;
const NGHTTP2_STREAM_STATE_CLOSED: number;
const NGHTTP2_NO_ERROR: number;
const NGHTTP2_PROTOCOL_ERROR: number;
const NGHTTP2_INTERNAL_ERROR: number;
const NGHTTP2_FLOW_CONTROL_ERROR: number;
const NGHTTP2_SETTINGS_TIMEOUT: number;
const NGHTTP2_STREAM_CLOSED: number;
const NGHTTP2_FRAME_SIZE_ERROR: number;
const NGHTTP2_REFUSED_STREAM: number;
const NGHTTP2_CANCEL: number;
const NGHTTP2_COMPRESSION_ERROR: number;
const NGHTTP2_CONNECT_ERROR: number;
const NGHTTP2_ENHANCE_YOUR_CALM: number;
const NGHTTP2_INADEQUATE_SECURITY: number;
const NGHTTP2_HTTP_1_1_REQUIRED: number;
const NGHTTP2_ERR_FRAME_SIZE_ERROR: number;
const NGHTTP2_FLAG_NONE: number;
const NGHTTP2_FLAG_END_STREAM: number;
const NGHTTP2_FLAG_END_HEADERS: number;
const NGHTTP2_FLAG_ACK: number;
const NGHTTP2_FLAG_PADDED: number;
const NGHTTP2_FLAG_PRIORITY: number;
const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number;
const DEFAULT_SETTINGS_ENABLE_PUSH: number;
const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number;
const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number;
const MAX_MAX_FRAME_SIZE: number;
const MIN_MAX_FRAME_SIZE: number;
const MAX_INITIAL_WINDOW_SIZE: number;
const NGHTTP2_DEFAULT_WEIGHT: number;
const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number;
const NGHTTP2_SETTINGS_ENABLE_PUSH: number;
const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number;
const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number;
const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number;
const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number;
const PADDING_STRATEGY_NONE: number;
const PADDING_STRATEGY_MAX: number;
const PADDING_STRATEGY_CALLBACK: number;
const HTTP2_HEADER_STATUS: string;
const HTTP2_HEADER_METHOD: string;
const HTTP2_HEADER_AUTHORITY: string;
const HTTP2_HEADER_SCHEME: string;
const HTTP2_HEADER_PATH: string;
const HTTP2_HEADER_ACCEPT_CHARSET: string;
const HTTP2_HEADER_ACCEPT_ENCODING: string;
const HTTP2_HEADER_ACCEPT_LANGUAGE: string;
const HTTP2_HEADER_ACCEPT_RANGES: string;
const HTTP2_HEADER_ACCEPT: string;
const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string;
const HTTP2_HEADER_AGE: string;
const HTTP2_HEADER_ALLOW: string;
const HTTP2_HEADER_AUTHORIZATION: string;
const HTTP2_HEADER_CACHE_CONTROL: string;
const HTTP2_HEADER_CONNECTION: string;
const HTTP2_HEADER_CONTENT_DISPOSITION: string;
const HTTP2_HEADER_CONTENT_ENCODING: string;
const HTTP2_HEADER_CONTENT_LANGUAGE: string;
const HTTP2_HEADER_CONTENT_LENGTH: string;
const HTTP2_HEADER_CONTENT_LOCATION: string;
const HTTP2_HEADER_CONTENT_MD5: string;
const HTTP2_HEADER_CONTENT_RANGE: string;
const HTTP2_HEADER_CONTENT_TYPE: string;
const HTTP2_HEADER_COOKIE: string;
const HTTP2_HEADER_DATE: string;
const HTTP2_HEADER_ETAG: string;
const HTTP2_HEADER_EXPECT: string;
const HTTP2_HEADER_EXPIRES: string;
const HTTP2_HEADER_FROM: string;
const HTTP2_HEADER_HOST: string;
const HTTP2_HEADER_IF_MATCH: string;
const HTTP2_HEADER_IF_MODIFIED_SINCE: string;
const HTTP2_HEADER_IF_NONE_MATCH: string;
const HTTP2_HEADER_IF_RANGE: string;
const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string;
const HTTP2_HEADER_LAST_MODIFIED: string;
const HTTP2_HEADER_LINK: string;
const HTTP2_HEADER_LOCATION: string;
const HTTP2_HEADER_MAX_FORWARDS: string;
const HTTP2_HEADER_PREFER: string;
const HTTP2_HEADER_PROXY_AUTHENTICATE: string;
const HTTP2_HEADER_PROXY_AUTHORIZATION: string;
const HTTP2_HEADER_RANGE: string;
const HTTP2_HEADER_REFERER: string;
const HTTP2_HEADER_REFRESH: string;
const HTTP2_HEADER_RETRY_AFTER: string;
const HTTP2_HEADER_SERVER: string;
const HTTP2_HEADER_SET_COOKIE: string;
const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string;
const HTTP2_HEADER_TRANSFER_ENCODING: string;
const HTTP2_HEADER_TE: string;
const HTTP2_HEADER_UPGRADE: string;
const HTTP2_HEADER_USER_AGENT: string;
const HTTP2_HEADER_VARY: string;
const HTTP2_HEADER_VIA: string;
const HTTP2_HEADER_WWW_AUTHENTICATE: string;
const HTTP2_HEADER_HTTP2_SETTINGS: string;
const HTTP2_HEADER_KEEP_ALIVE: string;
const HTTP2_HEADER_PROXY_CONNECTION: string;
const HTTP2_METHOD_ACL: string;
const HTTP2_METHOD_BASELINE_CONTROL: string;
const HTTP2_METHOD_BIND: string;
const HTTP2_METHOD_CHECKIN: string;
const HTTP2_METHOD_CHECKOUT: string;
const HTTP2_METHOD_CONNECT: string;
const HTTP2_METHOD_COPY: string;
const HTTP2_METHOD_DELETE: string;
const HTTP2_METHOD_GET: string;
const HTTP2_METHOD_HEAD: string;
const HTTP2_METHOD_LABEL: string;
const HTTP2_METHOD_LINK: string;
const HTTP2_METHOD_LOCK: string;
const HTTP2_METHOD_MERGE: string;
const HTTP2_METHOD_MKACTIVITY: string;
const HTTP2_METHOD_MKCALENDAR: string;
const HTTP2_METHOD_MKCOL: string;
const HTTP2_METHOD_MKREDIRECTREF: string;
const HTTP2_METHOD_MKWORKSPACE: string;
const HTTP2_METHOD_MOVE: string;
const HTTP2_METHOD_OPTIONS: string;
const HTTP2_METHOD_ORDERPATCH: string;
const HTTP2_METHOD_PATCH: string;
const HTTP2_METHOD_POST: string;
const HTTP2_METHOD_PRI: string;
const HTTP2_METHOD_PROPFIND: string;
const HTTP2_METHOD_PROPPATCH: string;
const HTTP2_METHOD_PUT: string;
const HTTP2_METHOD_REBIND: string;
const HTTP2_METHOD_REPORT: string;
const HTTP2_METHOD_SEARCH: string;
const HTTP2_METHOD_TRACE: string;
const HTTP2_METHOD_UNBIND: string;
const HTTP2_METHOD_UNCHECKOUT: string;
const HTTP2_METHOD_UNLINK: string;
const HTTP2_METHOD_UNLOCK: string;
const HTTP2_METHOD_UPDATE: string;
const HTTP2_METHOD_UPDATEREDIRECTREF: string;
const HTTP2_METHOD_VERSION_CONTROL: string;
const HTTP_STATUS_CONTINUE: number;
const HTTP_STATUS_SWITCHING_PROTOCOLS: number;
const HTTP_STATUS_PROCESSING: number;
const HTTP_STATUS_OK: number;
const HTTP_STATUS_CREATED: number;
const HTTP_STATUS_ACCEPTED: number;
const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number;
const HTTP_STATUS_NO_CONTENT: number;
const HTTP_STATUS_RESET_CONTENT: number;
const HTTP_STATUS_PARTIAL_CONTENT: number;
const HTTP_STATUS_MULTI_STATUS: number;
const HTTP_STATUS_ALREADY_REPORTED: number;
const HTTP_STATUS_IM_USED: number;
const HTTP_STATUS_MULTIPLE_CHOICES: number;
const HTTP_STATUS_MOVED_PERMANENTLY: number;
const HTTP_STATUS_FOUND: number;
const HTTP_STATUS_SEE_OTHER: number;
const HTTP_STATUS_NOT_MODIFIED: number;
const HTTP_STATUS_USE_PROXY: number;
const HTTP_STATUS_TEMPORARY_REDIRECT: number;
const HTTP_STATUS_PERMANENT_REDIRECT: number;
const HTTP_STATUS_BAD_REQUEST: number;
const HTTP_STATUS_UNAUTHORIZED: number;
const HTTP_STATUS_PAYMENT_REQUIRED: number;
const HTTP_STATUS_FORBIDDEN: number;
const HTTP_STATUS_NOT_FOUND: number;
const HTTP_STATUS_METHOD_NOT_ALLOWED: number;
const HTTP_STATUS_NOT_ACCEPTABLE: number;
const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number;
const HTTP_STATUS_REQUEST_TIMEOUT: number;
const HTTP_STATUS_CONFLICT: number;
const HTTP_STATUS_GONE: number;
const HTTP_STATUS_LENGTH_REQUIRED: number;
const HTTP_STATUS_PRECONDITION_FAILED: number;
const HTTP_STATUS_PAYLOAD_TOO_LARGE: number;
const HTTP_STATUS_URI_TOO_LONG: number;
const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number;
const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number;
const HTTP_STATUS_EXPECTATION_FAILED: number;
const HTTP_STATUS_TEAPOT: number;
const HTTP_STATUS_MISDIRECTED_REQUEST: number;
const HTTP_STATUS_UNPROCESSABLE_ENTITY: number;
const HTTP_STATUS_LOCKED: number;
const HTTP_STATUS_FAILED_DEPENDENCY: number;
const HTTP_STATUS_UNORDERED_COLLECTION: number;
const HTTP_STATUS_UPGRADE_REQUIRED: number;
const HTTP_STATUS_PRECONDITION_REQUIRED: number;
const HTTP_STATUS_TOO_MANY_REQUESTS: number;
const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number;
const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number;
const HTTP_STATUS_INTERNAL_SERVER_ERROR: number;
const HTTP_STATUS_NOT_IMPLEMENTED: number;
const HTTP_STATUS_BAD_GATEWAY: number;
const HTTP_STATUS_SERVICE_UNAVAILABLE: number;
const HTTP_STATUS_GATEWAY_TIMEOUT: number;
const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number;
const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number;
const HTTP_STATUS_INSUFFICIENT_STORAGE: number;
const HTTP_STATUS_LOOP_DETECTED: number;
const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number;
const HTTP_STATUS_NOT_EXTENDED: number;
const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number;
}
/**
* This symbol can be set as a property on the HTTP/2 headers object with
* an array value in order to provide a list of headers considered sensitive.
*/
export const sensitiveHeaders: symbol;
export function getDefaultSettings(): Settings;
export function getPackedSettings(settings: Settings): Buffer;
export function getUnpackedSettings(buf: Uint8Array): Settings;
export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer;
export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer;
export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session;
export function connect(
authority: string | url.URL,
options?: ClientSessionOptions | SecureClientSessionOptions,
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void
): ClientHttp2Session;
}
declare module 'https' {
import * as tls from 'tls';
import * as http from 'http';
import { URL } from 'url';
type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
type RequestOptions = http.RequestOptions & tls.SecureContextOptions & {
rejectUnauthorized?: boolean; // Defaults to true
servername?: string; // SNI TLS Extension
};
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
rejectUnauthorized?: boolean;
maxCachedSessions?: number;
}
class Agent extends http.Agent {
constructor(options?: AgentOptions);
options: AgentOptions;
}
interface Server extends http.HttpBase {}
class Server extends tls.Server {
constructor(requestListener?: http.RequestListener);
constructor(options: ServerOptions, requestListener?: http.RequestListener);
}
function createServer(requestListener?: http.RequestListener): Server;
function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
let globalAgent: Agent;
}
// Type definitions for non-npm package Node.js 15.12
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>
// Alberto Schiabel <https://github.com/jkomyno>
// Alvis HT Tang <https://github.com/alvis>
// Andrew Makarov <https://github.com/r3nya>
// Benjamin Toueg <https://github.com/btoueg>
// Chigozirim C. <https://github.com/smac89>
// David Junger <https://github.com/touffy>
// Deividas Bakanas <https://github.com/DeividasBakanas>
// Eugene Y. Q. Shen <https://github.com/eyqs>
// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Huw <https://github.com/hoo29>
// Kelvin Jin <https://github.com/kjin>
// Klaus Meinhardt <https://github.com/ajafff>
// Lishude <https://github.com/islishude>
// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
// Mohsen Azimi <https://github.com/mohsen1>
// Nicolas Even <https://github.com/n-e>
// Nikita Galkin <https://github.com/galkin>
// Parambir Singh <https://github.com/parambirs>
// Sebastian Silbermann <https://github.com/eps1lon>
// Simon Schick <https://github.com/SimonSchick>
// Thomas den Hollander <https://github.com/ThomasdenH>
// Wilco Bakker <https://github.com/WilcoBakker>
// wwwy3y3 <https://github.com/wwwy3y3>
// Samuel Ainsworth <https://github.com/samuela>
// Kyle Uehlein <https://github.com/kuehlein>
// Thanik Bhongbhibhat <https://github.com/bhongy>
// Marcin Kopacz <https://github.com/chyzwar>
// Trivikram Kamat <https://github.com/trivikr>
// Minh Son Nguyen <https://github.com/nguymin4>
// Junxiao Shi <https://github.com/yoursunny>
// Ilia Baryshnikov <https://github.com/qwelias>
// ExE Boss <https://github.com/ExE-Boss>
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Anna Henningsen <https://github.com/addaleax>
// Jason Kwok <https://github.com/JasonHK>
// Victor Perin <https://github.com/victorperin>
// Yongsheng Zhang <https://github.com/ZYSzys>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// NOTE: These definitions support NodeJS and TypeScript 3.7.
// Typically type modifications should be made in base.d.ts instead of here
/// <reference path="base.d.ts" />
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
// - ~/index.d.ts - Definitions specific to TypeScript 3.7
// - ~/ts3.6/index.d.ts - Definitions specific to TypeScript 3.6
// NOTE: Augmentations for TypeScript 3.6 and later should use individual files for overrides
// within the respective ~/ts3.6 (or later) folder. However, this is disallowed for versions
// prior to TypeScript 3.6, so the older definitions will be found here.
// tslint:disable-next-line:dt-header
// Type definitions for inspector
// These definitions are auto-generated.
// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330
// for more information.
// tslint:disable:max-line-length
/**
* The inspector module provides an API for interacting with the V8 inspector.
*/
declare module 'inspector' {
import EventEmitter = require('events');
interface InspectorNotification<T> {
method: string;
params: T;
}
namespace Schema {
/**
* Description of the protocol domain.
*/
interface Domain {
/**
* Domain name.
*/
name: string;
/**
* Domain version.
*/
version: string;
}
interface GetDomainsReturnType {
/**
* List of supported domains.
*/
domains: Domain[];
}
}
namespace Runtime {
/**
* Unique script identifier.
*/
type ScriptId = string;
/**
* Unique object identifier.
*/
type RemoteObjectId = string;
/**
* Primitive value which cannot be JSON-stringified.
*/
type UnserializableValue = string;
/**
* Mirror object referencing original JavaScript object.
*/
interface RemoteObject {
/**
* Object type.
*/
type: string;
/**
* Object subtype hint. Specified for <code>object</code> type values only.
*/
subtype?: string;
/**
* Object class (constructor) name. Specified for <code>object</code> type values only.
*/
className?: string;
/**
* Remote object value in case of primitive values or JSON values (if it was requested).
*/
value?: any;
/**
* Primitive value which can not be JSON-stringified does not have <code>value</code>, but gets this property.
*/
unserializableValue?: UnserializableValue;
/**
* String representation of the object.
*/
description?: string;
/**
* Unique object identifier (for non-primitive values).
*/
objectId?: RemoteObjectId;
/**
* Preview containing abbreviated property values. Specified for <code>object</code> type values only.
* @experimental
*/
preview?: ObjectPreview;
/**
* @experimental
*/
customPreview?: CustomPreview;
}
/**
* @experimental
*/
interface CustomPreview {
header: string;
hasBody: boolean;
formatterObjectId: RemoteObjectId;
bindRemoteObjectFunctionId: RemoteObjectId;
configObjectId?: RemoteObjectId;
}
/**
* Object containing abbreviated remote object value.
* @experimental
*/
interface ObjectPreview {
/**
* Object type.
*/
type: string;
/**
* Object subtype hint. Specified for <code>object</code> type values only.
*/
subtype?: string;
/**
* String representation of the object.
*/
description?: string;
/**
* True iff some of the properties or entries of the original object did not fit.
*/
overflow: boolean;
/**
* List of the properties.
*/
properties: PropertyPreview[];
/**
* List of the entries. Specified for <code>map</code> and <code>set</code> subtype values only.
*/
entries?: EntryPreview[];
}
/**
* @experimental
*/
interface PropertyPreview {
/**
* Property name.
*/
name: string;
/**
* Object type. Accessor means that the property itself is an accessor property.
*/
type: string;
/**
* User-friendly property value string.
*/
value?: string;
/**
* Nested value preview.
*/
valuePreview?: ObjectPreview;
/**
* Object subtype hint. Specified for <code>object</code> type values only.
*/
subtype?: string;
}
/**
* @experimental
*/
interface EntryPreview {
/**
* Preview of the key. Specified for map-like collection entries.
*/
key?: ObjectPreview;
/**
* Preview of the value.
*/
value: ObjectPreview;
}
/**
* Object property descriptor.
*/
interface PropertyDescriptor {
/**
* Property name or symbol description.
*/
name: string;
/**
* The value associated with the property.
*/
value?: RemoteObject;
/**
* True if the value associated with the property may be changed (data descriptors only).
*/
writable?: boolean;
/**
* A function which serves as a getter for the property, or <code>undefined</code> if there is no getter (accessor descriptors only).
*/
get?: RemoteObject;
/**
* A function which serves as a setter for the property, or <code>undefined</code> if there is no setter (accessor descriptors only).
*/
set?: RemoteObject;
/**
* True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
*/
configurable: boolean;
/**
* True if this property shows up during enumeration of the properties on the corresponding object.
*/
enumerable: boolean;
/**
* True if the result was thrown during the evaluation.
*/
wasThrown?: boolean;
/**
* True if the property is owned for the object.
*/
isOwn?: boolean;
/**
* Property symbol object, if the property is of the <code>symbol</code> type.
*/
symbol?: RemoteObject;
}
/**
* Object internal property descriptor. This property isn't normally visible in JavaScript code.
*/
interface InternalPropertyDescriptor {
/**
* Conventional property name.
*/
name: string;
/**
* The value associated with the property.
*/
value?: RemoteObject;
}
/**
* Represents function call argument. Either remote object id <code>objectId</code>, primitive <code>value</code>, unserializable primitive value or neither of (for undefined) them should be specified.
*/
interface CallArgument {
/**
* Primitive value or serializable javascript object.
*/
value?: any;
/**
* Primitive value which can not be JSON-stringified.
*/
unserializableValue?: UnserializableValue;
/**
* Remote object handle.
*/
objectId?: RemoteObjectId;
}
/**
* Id of an execution context.
*/
type ExecutionContextId = number;
/**
* Description of an isolated world.
*/
interface ExecutionContextDescription {
/**
* Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
*/
id: ExecutionContextId;
/**
* Execution context origin.
*/
origin: string;
/**
* Human readable name describing given context.
*/
name: string;
/**
* Embedder-specific auxiliary data.
*/
auxData?: {};
}
/**
* Detailed information about exception (or error) that was thrown during script compilation or execution.
*/
interface ExceptionDetails {
/**
* Exception id.
*/
exceptionId: number;
/**
* Exception text, which should be used together with exception object when available.
*/
text: string;
/**
* Line number of the exception location (0-based).
*/
lineNumber: number;
/**
* Column number of the exception location (0-based).
*/
columnNumber: number;
/**
* Script ID of the exception location.
*/
scriptId?: ScriptId;
/**
* URL of the exception location, to be used when the script was not reported.
*/
url?: string;
/**
* JavaScript stack trace if available.
*/
stackTrace?: StackTrace;
/**
* Exception object if available.
*/
exception?: RemoteObject;
/**
* Identifier of the context where exception happened.
*/
executionContextId?: ExecutionContextId;
}
/**
* Number of milliseconds since epoch.
*/
type Timestamp = number;
/**
* Stack entry for runtime errors and assertions.
*/
interface CallFrame {
/**
* JavaScript function name.
*/
functionName: string;
/**
* JavaScript script id.
*/
scriptId: ScriptId;
/**
* JavaScript script name or url.
*/
url: string;
/**
* JavaScript script line number (0-based).
*/
lineNumber: number;
/**
* JavaScript script column number (0-based).
*/
columnNumber: number;
}
/**
* Call frames for assertions or error messages.
*/
interface StackTrace {
/**
* String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
*/
description?: string;
/**
* JavaScript function name.
*/
callFrames: CallFrame[];
/**
* Asynchronous JavaScript stack trace that preceded this stack, if available.
*/
parent?: StackTrace;
/**
* Asynchronous JavaScript stack trace that preceded this stack, if available.
* @experimental
*/
parentId?: StackTraceId;
}
/**
* Unique identifier of current debugger.
* @experimental
*/
type UniqueDebuggerId = string;
/**
* If <code>debuggerId</code> is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See <code>Runtime.StackTrace</code> and <code>Debugger.paused</code> for usages.
* @experimental
*/
interface StackTraceId {
id: string;
debuggerId?: UniqueDebuggerId;
}
interface EvaluateParameterType {
/**
* Expression to evaluate.
*/
expression: string;
/**
* Symbolic group name that can be used to release multiple objects.
*/
objectGroup?: string;
/**
* Determines whether Command Line API should be available during the evaluation.
*/
includeCommandLineAPI?: boolean;
/**
* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
*/
silent?: boolean;
/**
* Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
*/
contextId?: ExecutionContextId;
/**
* Whether the result is expected to be a JSON object that should be sent by value.
*/
returnByValue?: boolean;
/**
* Whether preview should be generated for the result.
* @experimental
*/
generatePreview?: boolean;
/**
* Whether execution should be treated as initiated by user in the UI.
*/
userGesture?: boolean;
/**
* Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
*/
awaitPromise?: boolean;
}
interface AwaitPromiseParameterType {
/**
* Identifier of the promise.
*/
promiseObjectId: RemoteObjectId;
/**
* Whether the result is expected to be a JSON object that should be sent by value.
*/
returnByValue?: boolean;
/**
* Whether preview should be generated for the result.
*/
generatePreview?: boolean;
}
interface CallFunctionOnParameterType {
/**
* Declaration of the function to call.
*/
functionDeclaration: string;
/**
* Identifier of the object to call function on. Either objectId or executionContextId should be specified.
*/
objectId?: RemoteObjectId;
/**
* Call arguments. All call arguments must belong to the same JavaScript world as the target object.
*/
arguments?: CallArgument[];
/**
* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
*/
silent?: boolean;
/**
* Whether the result is expected to be a JSON object which should be sent by value.
*/
returnByValue?: boolean;
/**
* Whether preview should be generated for the result.
* @experimental
*/
generatePreview?: boolean;
/**
* Whether execution should be treated as initiated by user in the UI.
*/
userGesture?: boolean;
/**
* Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
*/
awaitPromise?: boolean;
/**
* Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
*/
executionContextId?: ExecutionContextId;
/**
* Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
*/
objectGroup?: string;
}
interface GetPropertiesParameterType {
/**
* Identifier of the object to return properties for.
*/
objectId: RemoteObjectId;
/**
* If true, returns properties belonging only to the element itself, not to its prototype chain.
*/
ownProperties?: boolean;
/**
* If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
* @experimental
*/
accessorPropertiesOnly?: boolean;
/**
* Whether preview should be generated for the results.
* @experimental
*/
generatePreview?: boolean;
}
interface ReleaseObjectParameterType {
/**
* Identifier of the object to release.
*/
objectId: RemoteObjectId;
}
interface ReleaseObjectGroupParameterType {
/**
* Symbolic object group name.
*/
objectGroup: string;
}
interface SetCustomObjectFormatterEnabledParameterType {
enabled: boolean;
}
interface CompileScriptParameterType {
/**
* Expression to compile.
*/
expression: string;
/**
* Source url to be set for the script.
*/
sourceURL: string;
/**
* Specifies whether the compiled script should be persisted.
*/
persistScript: boolean;
/**
* Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
*/
executionContextId?: ExecutionContextId;
}
interface RunScriptParameterType {
/**
* Id of the script to run.
*/
scriptId: ScriptId;
/**
* Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
*/
executionContextId?: ExecutionContextId;
/**
* Symbolic group name that can be used to release multiple objects.
*/
objectGroup?: string;
/**
* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
*/
silent?: boolean;
/**
* Determines whether Command Line API should be available during the evaluation.
*/
includeCommandLineAPI?: boolean;
/**
* Whether the result is expected to be a JSON object which should be sent by value.
*/
returnByValue?: boolean;
/**
* Whether preview should be generated for the result.
*/
generatePreview?: boolean;
/**
* Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
*/
awaitPromise?: boolean;
}
interface QueryObjectsParameterType {
/**
* Identifier of the prototype to return objects for.
*/
prototypeObjectId: RemoteObjectId;
}
interface GlobalLexicalScopeNamesParameterType {
/**
* Specifies in which execution context to lookup global scope variables.
*/
executionContextId?: ExecutionContextId;
}
interface EvaluateReturnType {
/**
* Evaluation result.
*/
result: RemoteObject;
/**
* Exception details.
*/
exceptionDetails?: ExceptionDetails;
}
interface AwaitPromiseReturnType {
/**
* Promise result. Will contain rejected value if promise was rejected.
*/
result: RemoteObject;
/**
* Exception details if stack strace is available.
*/
exceptionDetails?: ExceptionDetails;
}
interface CallFunctionOnReturnType {
/**
* Call result.
*/
result: RemoteObject;
/**
* Exception details.
*/
exceptionDetails?: ExceptionDetails;
}
interface GetPropertiesReturnType {
/**
* Object properties.
*/
result: PropertyDescriptor[];
/**
* Internal object properties (only of the element itself).
*/
internalProperties?: InternalPropertyDescriptor[];
/**
* Exception details.
*/
exceptionDetails?: ExceptionDetails;
}
interface CompileScriptReturnType {
/**
* Id of the script.
*/
scriptId?: ScriptId;
/**
* Exception details.
*/
exceptionDetails?: ExceptionDetails;
}
interface RunScriptReturnType {
/**
* Run result.
*/
result: RemoteObject;
/**
* Exception details.
*/
exceptionDetails?: ExceptionDetails;
}
interface QueryObjectsReturnType {
/**
* Array with objects.
*/
objects: RemoteObject;
}
interface GlobalLexicalScopeNamesReturnType {
names: string[];
}
interface ExecutionContextCreatedEventDataType {
/**
* A newly created execution context.
*/
context: ExecutionContextDescription;
}
interface ExecutionContextDestroyedEventDataType {
/**
* Id of the destroyed context
*/
executionContextId: ExecutionContextId;
}
interface ExceptionThrownEventDataType {
/**
* Timestamp of the exception.
*/
timestamp: Timestamp;
exceptionDetails: ExceptionDetails;
}
interface ExceptionRevokedEventDataType {
/**
* Reason describing why exception was revoked.
*/
reason: string;
/**
* The id of revoked exception, as reported in <code>exceptionThrown</code>.
*/
exceptionId: number;
}
interface ConsoleAPICalledEventDataType {
/**
* Type of the call.
*/
type: string;
/**
* Call arguments.
*/
args: RemoteObject[];
/**
* Identifier of the context where the call was made.
*/
executionContextId: ExecutionContextId;
/**
* Call timestamp.
*/
timestamp: Timestamp;
/**
* Stack trace captured when the call was made.
*/
stackTrace?: StackTrace;
/**
* Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
* @experimental
*/
context?: string;
}
interface InspectRequestedEventDataType {
object: RemoteObject;
hints: {};
}
}
namespace Debugger {
/**
* Breakpoint identifier.
*/
type BreakpointId = string;
/**
* Call frame identifier.
*/
type CallFrameId = string;
/**
* Location in the source code.
*/
interface Location {
/**
* Script identifier as reported in the <code>Debugger.scriptParsed</code>.
*/
scriptId: Runtime.ScriptId;
/**
* Line number in the script (0-based).
*/
lineNumber: number;
/**
* Column number in the script (0-based).
*/
columnNumber?: number;
}
/**
* Location in the source code.
* @experimental
*/
interface ScriptPosition {
lineNumber: number;
columnNumber: number;
}
/**
* JavaScript call frame. Array of call frames form the call stack.
*/
interface CallFrame {
/**
* Call frame identifier. This identifier is only valid while the virtual machine is paused.
*/
callFrameId: CallFrameId;
/**
* Name of the JavaScript function called on this call frame.
*/
functionName: string;
/**
* Location in the source code.
*/
functionLocation?: Location;
/**
* Location in the source code.
*/
location: Location;
/**
* JavaScript script name or url.
*/
url: string;
/**
* Scope chain for this call frame.
*/
scopeChain: Scope[];
/**
* <code>this</code> object for this call frame.
*/
this: Runtime.RemoteObject;
/**
* The value being returned, if the function is at return point.
*/
returnValue?: Runtime.RemoteObject;
}
/**
* Scope description.
*/
interface Scope {
/**
* Scope type.
*/
type: string;
/**
* Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
*/
object: Runtime.RemoteObject;
name?: string;
/**
* Location in the source code where scope starts
*/
startLocation?: Location;
/**
* Location in the source code where scope ends
*/
endLocation?: Location;
}
/**
* Search match for resource.
*/
interface SearchMatch {
/**
* Line number in resource content.
*/
lineNumber: number;
/**
* Line with match content.
*/
lineContent: string;
}
interface BreakLocation {
/**
* Script identifier as reported in the <code>Debugger.scriptParsed</code>.
*/
scriptId: Runtime.ScriptId;
/**
* Line number in the script (0-based).
*/
lineNumber: number;
/**
* Column number in the script (0-based).
*/
columnNumber?: number;
type?: string;
}
interface SetBreakpointsActiveParameterType {
/**
* New value for breakpoints active state.
*/
active: boolean;
}
interface SetSkipAllPausesParameterType {
/**
* New value for skip pauses state.
*/
skip: boolean;
}
interface SetBreakpointByUrlParameterType {
/**
* Line number to set breakpoint at.
*/
lineNumber: number;
/**
* URL of the resources to set breakpoint on.
*/
url?: string;
/**
* Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified.
*/
urlRegex?: string;
/**
* Script hash of the resources to set breakpoint on.
*/
scriptHash?: string;
/**
* Offset in the line to set breakpoint at.
*/
columnNumber?: number;
/**
* Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
*/
condition?: string;
}
interface SetBreakpointParameterType {
/**
* Location to set breakpoint in.
*/
location: Location;
/**
* Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
*/
condition?: string;
}
interface RemoveBreakpointParameterType {
breakpointId: BreakpointId;
}
interface GetPossibleBreakpointsParameterType {
/**
* Start of range to search possible breakpoint locations in.
*/
start: Location;
/**
* End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
*/
end?: Location;
/**
* Only consider locations which are in the same (non-nested) function as start.
*/
restrictToFunction?: boolean;
}
interface ContinueToLocationParameterType {
/**
* Location to continue to.
*/
location: Location;
targetCallFrames?: string;
}
interface PauseOnAsyncCallParameterType {
/**
* Debugger will pause when async call with given stack trace is started.
*/
parentStackTraceId: Runtime.StackTraceId;
}
interface StepIntoParameterType {
/**
* Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause.
* @experimental
*/
breakOnAsyncCall?: boolean;
}
interface GetStackTraceParameterType {
stackTraceId: Runtime.StackTraceId;
}
interface SearchInContentParameterType {
/**
* Id of the script to search in.
*/
scriptId: Runtime.ScriptId;
/**
* String to search for.
*/
query: string;
/**
* If true, search is case sensitive.
*/
caseSensitive?: boolean;
/**
* If true, treats string parameter as regex.
*/
isRegex?: boolean;
}
interface SetScriptSourceParameterType {
/**
* Id of the script to edit.
*/
scriptId: Runtime.ScriptId;
/**
* New content of the script.
*/
scriptSource: string;
/**
* If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
*/
dryRun?: boolean;
}
interface RestartFrameParameterType {
/**
* Call frame identifier to evaluate on.
*/
callFrameId: CallFrameId;
}
interface GetScriptSourceParameterType {
/**
* Id of the script to get source for.
*/
scriptId: Runtime.ScriptId;
}
interface SetPauseOnExceptionsParameterType {
/**
* Pause on exceptions mode.
*/
state: string;
}
interface EvaluateOnCallFrameParameterType {
/**
* Call frame identifier to evaluate on.
*/
callFrameId: CallFrameId;
/**
* Expression to evaluate.
*/
expression: string;
/**
* String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>).
*/
objectGroup?: string;
/**
* Specifies whether command line API should be available to the evaluated expression, defaults to false.
*/
includeCommandLineAPI?: boolean;
/**
* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
*/
silent?: boolean;
/**
* Whether the result is expected to be a JSON object that should be sent by value.
*/
returnByValue?: boolean;
/**
* Whether preview should be generated for the result.
* @experimental
*/
generatePreview?: boolean;
/**
* Whether to throw an exception if side effect cannot be ruled out during evaluation.
*/
throwOnSideEffect?: boolean;
}
interface SetVariableValueParameterType {
/**
* 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
*/
scopeNumber: number;
/**
* Variable name.
*/
variableName: string;
/**
* New variable value.
*/
newValue: Runtime.CallArgument;
/**
* Id of callframe that holds variable.
*/
callFrameId: CallFrameId;
}
interface SetReturnValueParameterType {
/**
* New return value.
*/
newValue: Runtime.CallArgument;
}
interface SetAsyncCallStackDepthParameterType {
/**
* Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default).
*/
maxDepth: number;
}
interface SetBlackboxPatternsParameterType {
/**
* Array of regexps that will be used to check script url for blackbox state.
*/
patterns: string[];
}
interface SetBlackboxedRangesParameterType {
/**
* Id of the script.
*/
scriptId: Runtime.ScriptId;
positions: ScriptPosition[];
}
interface EnableReturnType {
/**
* Unique identifier of the debugger.
* @experimental
*/
debuggerId: Runtime.UniqueDebuggerId;
}
interface SetBreakpointByUrlReturnType {
/**
* Id of the created breakpoint for further reference.
*/
breakpointId: BreakpointId;
/**
* List of the locations this breakpoint resolved into upon addition.
*/
locations: Location[];
}
interface SetBreakpointReturnType {
/**
* Id of the created breakpoint for further reference.
*/
breakpointId: BreakpointId;
/**
* Location this breakpoint resolved into.
*/
actualLocation: Location;
}
interface GetPossibleBreakpointsReturnType {
/**
* List of the possible breakpoint locations.
*/
locations: BreakLocation[];
}
interface GetStackTraceReturnType {
stackTrace: Runtime.StackTrace;
}
interface SearchInContentReturnType {
/**
* List of search matches.
*/
result: SearchMatch[];
}
interface SetScriptSourceReturnType {
/**
* New stack trace in case editing has happened while VM was stopped.
*/
callFrames?: CallFrame[];
/**
* Whether current call stack was modified after applying the changes.
*/
stackChanged?: boolean;
/**
* Async stack trace, if any.
*/
asyncStackTrace?: Runtime.StackTrace;
/**
* Async stack trace, if any.
* @experimental
*/
asyncStackTraceId?: Runtime.StackTraceId;
/**
* Exception details if any.
*/
exceptionDetails?: Runtime.ExceptionDetails;
}
interface RestartFrameReturnType {
/**
* New stack trace.
*/
callFrames: CallFrame[];
/**
* Async stack trace, if any.
*/
asyncStackTrace?: Runtime.StackTrace;
/**
* Async stack trace, if any.
* @experimental
*/
asyncStackTraceId?: Runtime.StackTraceId;
}
interface GetScriptSourceReturnType {
/**
* Script source.
*/
scriptSource: string;
}
interface EvaluateOnCallFrameReturnType {
/**
* Object wrapper for the evaluation result.
*/
result: Runtime.RemoteObject;
/**
* Exception details.
*/
exceptionDetails?: Runtime.ExceptionDetails;
}
interface ScriptParsedEventDataType {
/**
* Identifier of the script parsed.
*/
scriptId: Runtime.ScriptId;
/**
* URL or name of the script parsed (if any).
*/
url: string;
/**
* Line offset of the script within the resource with given URL (for script tags).
*/
startLine: number;
/**
* Column offset of the script within the resource with given URL.
*/
startColumn: number;
/**
* Last line of the script.
*/
endLine: number;
/**
* Length of the last line of the script.
*/
endColumn: number;
/**
* Specifies script creation context.
*/
executionContextId: Runtime.ExecutionContextId;
/**
* Content hash of the script.
*/
hash: string;
/**
* Embedder-specific auxiliary data.
*/
executionContextAuxData?: {};
/**
* True, if this script is generated as a result of the live edit operation.
* @experimental
*/
isLiveEdit?: boolean;
/**
* URL of source map associated with script (if any).
*/
sourceMapURL?: string;
/**
* True, if this script has sourceURL.
*/
hasSourceURL?: boolean;
/**
* True, if this script is ES6 module.
*/
isModule?: boolean;
/**
* This script length.
*/
length?: number;
/**
* JavaScript top stack frame of where the script parsed event was triggered if available.
* @experimental
*/
stackTrace?: Runtime.StackTrace;
}
interface ScriptFailedToParseEventDataType {
/**
* Identifier of the script parsed.
*/
scriptId: Runtime.ScriptId;
/**
* URL or name of the script parsed (if any).
*/
url: string;
/**
* Line offset of the script within the resource with given URL (for script tags).
*/
startLine: number;
/**
* Column offset of the script within the resource with given URL.
*/
startColumn: number;
/**
* Last line of the script.
*/
endLine: number;
/**
* Length of the last line of the script.
*/
endColumn: number;
/**
* Specifies script creation context.
*/
executionContextId: Runtime.ExecutionContextId;
/**
* Content hash of the script.
*/
hash: string;
/**
* Embedder-specific auxiliary data.
*/
executionContextAuxData?: {};
/**
* URL of source map associated with script (if any).
*/
sourceMapURL?: string;
/**
* True, if this script has sourceURL.
*/
hasSourceURL?: boolean;
/**
* True, if this script is ES6 module.
*/
isModule?: boolean;
/**
* This script length.
*/
length?: number;
/**
* JavaScript top stack frame of where the script parsed event was triggered if available.
* @experimental
*/
stackTrace?: Runtime.StackTrace;
}
interface BreakpointResolvedEventDataType {
/**
* Breakpoint unique identifier.
*/
breakpointId: BreakpointId;
/**
* Actual breakpoint location.
*/
location: Location;
}
interface PausedEventDataType {
/**
* Call stack the virtual machine stopped on.
*/
callFrames: CallFrame[];
/**
* Pause reason.
*/
reason: string;
/**
* Object containing break-specific auxiliary properties.
*/
data?: {};
/**
* Hit breakpoints IDs
*/
hitBreakpoints?: string[];
/**
* Async stack trace, if any.
*/
asyncStackTrace?: Runtime.StackTrace;
/**
* Async stack trace, if any.
* @experimental
*/
asyncStackTraceId?: Runtime.StackTraceId;
/**
* Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after <code>Debugger.stepInto</code> call with <code>breakOnAsynCall</code> flag.
* @experimental
*/
asyncCallStackTraceId?: Runtime.StackTraceId;
}
}
namespace Console {
/**
* Console message.
*/
interface ConsoleMessage {
/**
* Message source.
*/
source: string;
/**
* Message severity.
*/
level: string;
/**
* Message text.
*/
text: string;
/**
* URL of the message origin.
*/
url?: string;
/**
* Line number in the resource that generated this message (1-based).
*/
line?: number;
/**
* Column number in the resource that generated this message (1-based).
*/
column?: number;
}
interface MessageAddedEventDataType {
/**
* Console message that has been added.
*/
message: ConsoleMessage;
}
}
namespace Profiler {
/**
* Profile node. Holds callsite information, execution statistics and child nodes.
*/
interface ProfileNode {
/**
* Unique id of the node.
*/
id: number;
/**
* Function location.
*/
callFrame: Runtime.CallFrame;
/**
* Number of samples where this node was on top of the call stack.
*/
hitCount?: number;
/**
* Child node ids.
*/
children?: number[];
/**
* The reason of being not optimized. The function may be deoptimized or marked as don't optimize.
*/
deoptReason?: string;
/**
* An array of source position ticks.
*/
positionTicks?: PositionTickInfo[];
}
/**
* Profile.
*/
interface Profile {
/**
* The list of profile nodes. First item is the root node.
*/
nodes: ProfileNode[];
/**
* Profiling start timestamp in microseconds.
*/
startTime: number;
/**
* Profiling end timestamp in microseconds.
*/
endTime: number;
/**
* Ids of samples top nodes.
*/
samples?: number[];
/**
* Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime.
*/
timeDeltas?: number[];
}
/**
* Specifies a number of samples attributed to a certain source position.
*/
interface PositionTickInfo {
/**
* Source line number (1-based).
*/
line: number;
/**
* Number of samples attributed to the source line.
*/
ticks: number;
}
/**
* Coverage data for a source range.
*/
interface CoverageRange {
/**
* JavaScript script source offset for the range start.
*/
startOffset: number;
/**
* JavaScript script source offset for the range end.
*/
endOffset: number;
/**
* Collected execution count of the source range.
*/
count: number;
}
/**
* Coverage data for a JavaScript function.
*/
interface FunctionCoverage {
/**
* JavaScript function name.
*/
functionName: string;
/**
* Source ranges inside the function with coverage data.
*/
ranges: CoverageRange[];
/**
* Whether coverage data for this function has block granularity.
*/
isBlockCoverage: boolean;
}
/**
* Coverage data for a JavaScript script.
*/
interface ScriptCoverage {
/**
* JavaScript script id.
*/
scriptId: Runtime.ScriptId;
/**
* JavaScript script name or url.
*/
url: string;
/**
* Functions contained in the script that has coverage data.
*/
functions: FunctionCoverage[];
}
/**
* Describes a type collected during runtime.
* @experimental
*/
interface TypeObject {
/**
* Name of a type collected with type profiling.
*/
name: string;
}
/**
* Source offset and types for a parameter or return value.
* @experimental
*/
interface TypeProfileEntry {
/**
* Source offset of the parameter or end of function for return values.
*/
offset: number;
/**
* The types for this parameter or return value.
*/
types: TypeObject[];
}
/**
* Type profile data collected during runtime for a JavaScript script.
* @experimental
*/
interface ScriptTypeProfile {
/**
* JavaScript script id.
*/
scriptId: Runtime.ScriptId;
/**
* JavaScript script name or url.
*/
url: string;
/**
* Type profile entries for parameters and return values of the functions in the script.
*/
entries: TypeProfileEntry[];
}
interface SetSamplingIntervalParameterType {
/**
* New sampling interval in microseconds.
*/
interval: number;
}
interface StartPreciseCoverageParameterType {
/**
* Collect accurate call counts beyond simple 'covered' or 'not covered'.
*/
callCount?: boolean;
/**
* Collect block-based coverage.
*/
detailed?: boolean;
}
interface StopReturnType {
/**
* Recorded profile.
*/
profile: Profile;
}
interface TakePreciseCoverageReturnType {
/**
* Coverage data for the current isolate.
*/
result: ScriptCoverage[];
}
interface GetBestEffortCoverageReturnType {
/**
* Coverage data for the current isolate.
*/
result: ScriptCoverage[];
}
interface TakeTypeProfileReturnType {
/**
* Type profile for all scripts since startTypeProfile() was turned on.
*/
result: ScriptTypeProfile[];
}
interface ConsoleProfileStartedEventDataType {
id: string;
/**
* Location of console.profile().
*/
location: Debugger.Location;
/**
* Profile title passed as an argument to console.profile().
*/
title?: string;
}
interface ConsoleProfileFinishedEventDataType {
id: string;
/**
* Location of console.profileEnd().
*/
location: Debugger.Location;
profile: Profile;
/**
* Profile title passed as an argument to console.profile().
*/
title?: string;
}
}
namespace HeapProfiler {
/**
* Heap snapshot object id.
*/
type HeapSnapshotObjectId = string;
/**
* Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.
*/
interface SamplingHeapProfileNode {
/**
* Function location.
*/
callFrame: Runtime.CallFrame;
/**
* Allocations size in bytes for the node excluding children.
*/
selfSize: number;
/**
* Child nodes.
*/
children: SamplingHeapProfileNode[];
}
/**
* Profile.
*/
interface SamplingHeapProfile {
head: SamplingHeapProfileNode;
}
interface StartTrackingHeapObjectsParameterType {
trackAllocations?: boolean;
}
interface StopTrackingHeapObjectsParameterType {
/**
* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
*/
reportProgress?: boolean;
}
interface TakeHeapSnapshotParameterType {
/**
* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
*/
reportProgress?: boolean;
}
interface GetObjectByHeapObjectIdParameterType {
objectId: HeapSnapshotObjectId;
/**
* Symbolic group name that can be used to release multiple objects.
*/
objectGroup?: string;
}
interface AddInspectedHeapObjectParameterType {
/**
* Heap snapshot object id to be accessible by means of $x command line API.
*/
heapObjectId: HeapSnapshotObjectId;
}
interface GetHeapObjectIdParameterType {
/**
* Identifier of the object to get heap object id for.
*/
objectId: Runtime.RemoteObjectId;
}
interface StartSamplingParameterType {
/**
* Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
*/
samplingInterval?: number;
}
interface GetObjectByHeapObjectIdReturnType {
/**
* Evaluation result.
*/
result: Runtime.RemoteObject;
}
interface GetHeapObjectIdReturnType {
/**
* Id of the heap snapshot object corresponding to the passed remote object id.
*/
heapSnapshotObjectId: HeapSnapshotObjectId;
}
interface StopSamplingReturnType {
/**
* Recorded sampling heap profile.
*/
profile: SamplingHeapProfile;
}
interface GetSamplingProfileReturnType {
/**
* Return the sampling profile being collected.
*/
profile: SamplingHeapProfile;
}
interface AddHeapSnapshotChunkEventDataType {
chunk: string;
}
interface ReportHeapSnapshotProgressEventDataType {
done: number;
total: number;
finished?: boolean;
}
interface LastSeenObjectIdEventDataType {
lastSeenObjectId: number;
timestamp: number;
}
interface HeapStatsUpdateEventDataType {
/**
* An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
*/
statsUpdate: number[];
}
}
namespace NodeTracing {
interface TraceConfig {
/**
* Controls how the trace buffer stores data.
*/
recordMode?: string;
/**
* Included category filters.
*/
includedCategories: string[];
}
interface StartParameterType {
traceConfig: TraceConfig;
}
interface GetCategoriesReturnType {
/**
* A list of supported tracing categories.
*/
categories: string[];
}
interface DataCollectedEventDataType {
value: Array<{}>;
}
}
namespace NodeWorker {
type WorkerID = string;
/**
* Unique identifier of attached debugging session.
*/
type SessionID = string;
interface WorkerInfo {
workerId: WorkerID;
type: string;
title: string;
url: string;
}
interface SendMessageToWorkerParameterType {
message: string;
/**
* Identifier of the session.
*/
sessionId: SessionID;
}
interface EnableParameterType {
/**
* Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger`
* message to run them.
*/
waitForDebuggerOnStart: boolean;
}
interface DetachParameterType {
sessionId: SessionID;
}
interface AttachedToWorkerEventDataType {
/**
* Identifier assigned to the session used to send/receive messages.
*/
sessionId: SessionID;
workerInfo: WorkerInfo;
waitingForDebugger: boolean;
}
interface DetachedFromWorkerEventDataType {
/**
* Detached session identifier.
*/
sessionId: SessionID;
}
interface ReceivedMessageFromWorkerEventDataType {
/**
* Identifier of a session which sends a message.
*/
sessionId: SessionID;
message: string;
}
}
namespace NodeRuntime {
interface NotifyWhenWaitingForDisconnectParameterType {
enabled: boolean;
}
}
/**
* The inspector.Session is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications.
*/
class Session extends EventEmitter {
/**
* Create a new instance of the inspector.Session class.
* The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend.
*/
constructor();
/**
* Connects a session to the inspector back-end.
* An exception will be thrown if there is already a connected session established either
* through the API or by a front-end connected to the Inspector WebSocket port.
*/
connect(): void;
/**
* Immediately close the session. All pending message callbacks will be called with an error.
* session.connect() will need to be called to be able to send messages again.
* Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
*/
disconnect(): void;
/**
* Posts a message to the inspector back-end. callback will be notified when a response is received.
* callback is a function that accepts two optional arguments - error and message-specific result.
*/
post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void;
post(method: string, callback?: (err: Error | null, params?: {}) => void): void;
/**
* Returns supported domains.
*/
post(method: "Schema.getDomains", callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void;
/**
* Evaluates expression on global object.
*/
post(method: "Runtime.evaluate", params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void;
post(method: "Runtime.evaluate", callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void;
/**
* Add handler to promise with given promise object id.
*/
post(method: "Runtime.awaitPromise", params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void;
post(method: "Runtime.awaitPromise", callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void;
/**
* Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
*/
post(method: "Runtime.callFunctionOn", params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void;
post(method: "Runtime.callFunctionOn", callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void;
/**
* Returns properties of a given object. Object group of the result is inherited from the target object.
*/
post(method: "Runtime.getProperties", params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void;
post(method: "Runtime.getProperties", callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void;
/**
* Releases remote object with given id.
*/
post(method: "Runtime.releaseObject", params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void;
post(method: "Runtime.releaseObject", callback?: (err: Error | null) => void): void;
/**
* Releases all remote objects that belong to a given group.
*/
post(method: "Runtime.releaseObjectGroup", params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void;
post(method: "Runtime.releaseObjectGroup", callback?: (err: Error | null) => void): void;
/**
* Tells inspected instance to run if it was waiting for debugger to attach.
*/
post(method: "Runtime.runIfWaitingForDebugger", callback?: (err: Error | null) => void): void;
/**
* Enables reporting of execution contexts creation by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context.
*/
post(method: "Runtime.enable", callback?: (err: Error | null) => void): void;
/**
* Disables reporting of execution contexts creation.
*/
post(method: "Runtime.disable", callback?: (err: Error | null) => void): void;
/**
* Discards collected exceptions and console API calls.
*/
post(method: "Runtime.discardConsoleEntries", callback?: (err: Error | null) => void): void;
/**
* @experimental
*/
post(method: "Runtime.setCustomObjectFormatterEnabled", params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void;
post(method: "Runtime.setCustomObjectFormatterEnabled", callback?: (err: Error | null) => void): void;
/**
* Compiles expression.
*/
post(method: "Runtime.compileScript", params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void;
post(method: "Runtime.compileScript", callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void;
/**
* Runs script with given id in a given context.
*/
post(method: "Runtime.runScript", params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void;
post(method: "Runtime.runScript", callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void;
post(method: "Runtime.queryObjects", params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void;
post(method: "Runtime.queryObjects", callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void;
/**
* Returns all let, const and class variables from global scope.
*/
post(
method: "Runtime.globalLexicalScopeNames",
params?: Runtime.GlobalLexicalScopeNamesParameterType,
callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void
): void;
post(method: "Runtime.globalLexicalScopeNames", callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void;
/**
* Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
*/
post(method: "Debugger.enable", callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void;
/**
* Disables debugger for given page.
*/
post(method: "Debugger.disable", callback?: (err: Error | null) => void): void;
/**
* Activates / deactivates all breakpoints on the page.
*/
post(method: "Debugger.setBreakpointsActive", params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setBreakpointsActive", callback?: (err: Error | null) => void): void;
/**
* Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
*/
post(method: "Debugger.setSkipAllPauses", params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setSkipAllPauses", callback?: (err: Error | null) => void): void;
/**
* Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads.
*/
post(method: "Debugger.setBreakpointByUrl", params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void;
post(method: "Debugger.setBreakpointByUrl", callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void;
/**
* Sets JavaScript breakpoint at a given location.
*/
post(method: "Debugger.setBreakpoint", params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void;
post(method: "Debugger.setBreakpoint", callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void;
/**
* Removes JavaScript breakpoint.
*/
post(method: "Debugger.removeBreakpoint", params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.removeBreakpoint", callback?: (err: Error | null) => void): void;
/**
* Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
*/
post(
method: "Debugger.getPossibleBreakpoints",
params?: Debugger.GetPossibleBreakpointsParameterType,
callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void
): void;
post(method: "Debugger.getPossibleBreakpoints", callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void;
/**
* Continues execution until specific location is reached.
*/
post(method: "Debugger.continueToLocation", params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.continueToLocation", callback?: (err: Error | null) => void): void;
/**
* @experimental
*/
post(method: "Debugger.pauseOnAsyncCall", params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.pauseOnAsyncCall", callback?: (err: Error | null) => void): void;
/**
* Steps over the statement.
*/
post(method: "Debugger.stepOver", callback?: (err: Error | null) => void): void;
/**
* Steps into the function call.
*/
post(method: "Debugger.stepInto", params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.stepInto", callback?: (err: Error | null) => void): void;
/**
* Steps out of the function call.
*/
post(method: "Debugger.stepOut", callback?: (err: Error | null) => void): void;
/**
* Stops on the next JavaScript statement.
*/
post(method: "Debugger.pause", callback?: (err: Error | null) => void): void;
/**
* This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called.
* @experimental
*/
post(method: "Debugger.scheduleStepIntoAsync", callback?: (err: Error | null) => void): void;
/**
* Resumes JavaScript execution.
*/
post(method: "Debugger.resume", callback?: (err: Error | null) => void): void;
/**
* Returns stack trace with given <code>stackTraceId</code>.
* @experimental
*/
post(method: "Debugger.getStackTrace", params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void;
post(method: "Debugger.getStackTrace", callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void;
/**
* Searches for given string in script content.
*/
post(method: "Debugger.searchInContent", params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void;
post(method: "Debugger.searchInContent", callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void;
/**
* Edits JavaScript source live.
*/
post(method: "Debugger.setScriptSource", params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void;
post(method: "Debugger.setScriptSource", callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void;
/**
* Restarts particular call frame from the beginning.
*/
post(method: "Debugger.restartFrame", params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void;
post(method: "Debugger.restartFrame", callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void;
/**
* Returns source for the script with given id.
*/
post(method: "Debugger.getScriptSource", params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void;
post(method: "Debugger.getScriptSource", callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void;
/**
* Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is <code>none</code>.
*/
post(method: "Debugger.setPauseOnExceptions", params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setPauseOnExceptions", callback?: (err: Error | null) => void): void;
/**
* Evaluates expression on a given call frame.
*/
post(method: "Debugger.evaluateOnCallFrame", params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void;
post(method: "Debugger.evaluateOnCallFrame", callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void;
/**
* Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
*/
post(method: "Debugger.setVariableValue", params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setVariableValue", callback?: (err: Error | null) => void): void;
/**
* Changes return value in top frame. Available only at return break position.
* @experimental
*/
post(method: "Debugger.setReturnValue", params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setReturnValue", callback?: (err: Error | null) => void): void;
/**
* Enables or disables async call stacks tracking.
*/
post(method: "Debugger.setAsyncCallStackDepth", params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setAsyncCallStackDepth", callback?: (err: Error | null) => void): void;
/**
* Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
* @experimental
*/
post(method: "Debugger.setBlackboxPatterns", params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setBlackboxPatterns", callback?: (err: Error | null) => void): void;
/**
* Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
* @experimental
*/
post(method: "Debugger.setBlackboxedRanges", params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void;
post(method: "Debugger.setBlackboxedRanges", callback?: (err: Error | null) => void): void;
/**
* Enables console domain, sends the messages collected so far to the client by means of the <code>messageAdded</code> notification.
*/
post(method: "Console.enable", callback?: (err: Error | null) => void): void;
/**
* Disables console domain, prevents further console messages from being reported to the client.
*/
post(method: "Console.disable", callback?: (err: Error | null) => void): void;
/**
* Does nothing.
*/
post(method: "Console.clearMessages", callback?: (err: Error | null) => void): void;
post(method: "Profiler.enable", callback?: (err: Error | null) => void): void;
post(method: "Profiler.disable", callback?: (err: Error | null) => void): void;
/**
* Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.
*/
post(method: "Profiler.setSamplingInterval", params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void;
post(method: "Profiler.setSamplingInterval", callback?: (err: Error | null) => void): void;
post(method: "Profiler.start", callback?: (err: Error | null) => void): void;
post(method: "Profiler.stop", callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void;
/**
* Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.
*/
post(method: "Profiler.startPreciseCoverage", params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void;
post(method: "Profiler.startPreciseCoverage", callback?: (err: Error | null) => void): void;
/**
* Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.
*/
post(method: "Profiler.stopPreciseCoverage", callback?: (err: Error | null) => void): void;
/**
* Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.
*/
post(method: "Profiler.takePreciseCoverage", callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void;
/**
* Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.
*/
post(method: "Profiler.getBestEffortCoverage", callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void;
/**
* Enable type profile.
* @experimental
*/
post(method: "Profiler.startTypeProfile", callback?: (err: Error | null) => void): void;
/**
* Disable type profile. Disabling releases type profile data collected so far.
* @experimental
*/
post(method: "Profiler.stopTypeProfile", callback?: (err: Error | null) => void): void;
/**
* Collect type profile.
* @experimental
*/
post(method: "Profiler.takeTypeProfile", callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void;
post(method: "HeapProfiler.enable", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.disable", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.startTrackingHeapObjects", params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.startTrackingHeapObjects", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.stopTrackingHeapObjects", params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.stopTrackingHeapObjects", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.takeHeapSnapshot", params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.takeHeapSnapshot", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.collectGarbage", callback?: (err: Error | null) => void): void;
post(
method: "HeapProfiler.getObjectByHeapObjectId",
params?: HeapProfiler.GetObjectByHeapObjectIdParameterType,
callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void
): void;
post(method: "HeapProfiler.getObjectByHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void;
/**
* Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
*/
post(method: "HeapProfiler.addInspectedHeapObject", params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.addInspectedHeapObject", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.getHeapObjectId", params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void;
post(method: "HeapProfiler.getHeapObjectId", callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void;
post(method: "HeapProfiler.startSampling", params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.startSampling", callback?: (err: Error | null) => void): void;
post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void;
post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void;
/**
* Gets supported tracing categories.
*/
post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void;
/**
* Start trace events collection.
*/
post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void;
post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void;
/**
* Stop trace events collection. Remaining collected events will be sent as a sequence of
* dataCollected events followed by tracingComplete event.
*/
post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void;
/**
* Sends protocol message over session with given id.
*/
post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void;
post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void;
/**
* Instructs the inspector to attach to running workers. Will also attach to new workers
* as they start
*/
post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void;
post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void;
/**
* Detaches from all running workers and disables attaching to new workers as they are started.
*/
post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void;
/**
* Detached from the worker with given sessionId.
*/
post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void;
post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void;
/**
* Enable the `NodeRuntime.waitingForDisconnect`.
*/
post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void;
post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void;
// Events
addListener(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
*/
addListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this;
/**
* Issued when new execution context is created.
*/
addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>) => void): this;
/**
* Issued when execution context is destroyed.
*/
addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>) => void): this;
/**
* Issued when all executionContexts were cleared in browser
*/
addListener(event: "Runtime.executionContextsCleared", listener: () => void): this;
/**
* Issued when exception was thrown and unhandled.
*/
addListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification<Runtime.ExceptionThrownEventDataType>) => void): this;
/**
* Issued when unhandled exception was revoked.
*/
addListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>) => void): this;
/**
* Issued when console API was called.
*/
addListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>) => void): this;
/**
* Issued when object should be inspected (for example, as a result of inspect() command line API call).
*/
addListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
/**
* Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
*/
addListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification<Debugger.ScriptParsedEventDataType>) => void): this;
/**
* Fired when virtual machine fails to parse the script.
*/
addListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>) => void): this;
/**
* Fired when breakpoint is resolved to an actual script and location.
*/
addListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>) => void): this;
/**
* Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
*/
addListener(event: "Debugger.paused", listener: (message: InspectorNotification<Debugger.PausedEventDataType>) => void): this;
/**
* Fired when the virtual machine resumed execution.
*/
addListener(event: "Debugger.resumed", listener: () => void): this;
/**
* Issued when new console message is added.
*/
addListener(event: "Console.messageAdded", listener: (message: InspectorNotification<Console.MessageAddedEventDataType>) => void): this;
/**
* Sent when new profile recording is started using console.profile() call.
*/
addListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>) => void): this;
addListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>) => void): this;
addListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>) => void): this;
addListener(event: "HeapProfiler.resetProfiles", listener: () => void): this;
addListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
*/
addListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend may send update for one or more fragments
*/
addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>) => void): this;
/**
* Contains an bucket of collected trace events.
*/
addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
/**
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
* delivered via dataCollected events.
*/
addListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
/**
* Issued when attached to a worker.
*/
addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
/**
* Issued when detached from the worker.
*/
addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
/**
* Notifies about a new protocol message received from the session
* (session ID is provided in attachedToWorker notification).
*/
addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
* It is fired when the Node process finished all code execution and is
* waiting for all frontends to disconnect.
*/
addListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "inspectorNotification", message: InspectorNotification<{}>): boolean;
emit(event: "Runtime.executionContextCreated", message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>): boolean;
emit(event: "Runtime.executionContextDestroyed", message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>): boolean;
emit(event: "Runtime.executionContextsCleared"): boolean;
emit(event: "Runtime.exceptionThrown", message: InspectorNotification<Runtime.ExceptionThrownEventDataType>): boolean;
emit(event: "Runtime.exceptionRevoked", message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>): boolean;
emit(event: "Runtime.consoleAPICalled", message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>): boolean;
emit(event: "Runtime.inspectRequested", message: InspectorNotification<Runtime.InspectRequestedEventDataType>): boolean;
emit(event: "Debugger.scriptParsed", message: InspectorNotification<Debugger.ScriptParsedEventDataType>): boolean;
emit(event: "Debugger.scriptFailedToParse", message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>): boolean;
emit(event: "Debugger.breakpointResolved", message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>): boolean;
emit(event: "Debugger.paused", message: InspectorNotification<Debugger.PausedEventDataType>): boolean;
emit(event: "Debugger.resumed"): boolean;
emit(event: "Console.messageAdded", message: InspectorNotification<Console.MessageAddedEventDataType>): boolean;
emit(event: "Profiler.consoleProfileStarted", message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>): boolean;
emit(event: "Profiler.consoleProfileFinished", message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>): boolean;
emit(event: "HeapProfiler.addHeapSnapshotChunk", message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>): boolean;
emit(event: "HeapProfiler.resetProfiles"): boolean;
emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>): boolean;
emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>): boolean;
emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>): boolean;
emit(event: "NodeTracing.dataCollected", message: InspectorNotification<NodeTracing.DataCollectedEventDataType>): boolean;
emit(event: "NodeTracing.tracingComplete"): boolean;
emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
emit(event: "NodeRuntime.waitingForDisconnect"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
*/
on(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this;
/**
* Issued when new execution context is created.
*/
on(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>) => void): this;
/**
* Issued when execution context is destroyed.
*/
on(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>) => void): this;
/**
* Issued when all executionContexts were cleared in browser
*/
on(event: "Runtime.executionContextsCleared", listener: () => void): this;
/**
* Issued when exception was thrown and unhandled.
*/
on(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification<Runtime.ExceptionThrownEventDataType>) => void): this;
/**
* Issued when unhandled exception was revoked.
*/
on(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>) => void): this;
/**
* Issued when console API was called.
*/
on(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>) => void): this;
/**
* Issued when object should be inspected (for example, as a result of inspect() command line API call).
*/
on(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
/**
* Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
*/
on(event: "Debugger.scriptParsed", listener: (message: InspectorNotification<Debugger.ScriptParsedEventDataType>) => void): this;
/**
* Fired when virtual machine fails to parse the script.
*/
on(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>) => void): this;
/**
* Fired when breakpoint is resolved to an actual script and location.
*/
on(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>) => void): this;
/**
* Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
*/
on(event: "Debugger.paused", listener: (message: InspectorNotification<Debugger.PausedEventDataType>) => void): this;
/**
* Fired when the virtual machine resumed execution.
*/
on(event: "Debugger.resumed", listener: () => void): this;
/**
* Issued when new console message is added.
*/
on(event: "Console.messageAdded", listener: (message: InspectorNotification<Console.MessageAddedEventDataType>) => void): this;
/**
* Sent when new profile recording is started using console.profile() call.
*/
on(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>) => void): this;
on(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>) => void): this;
on(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>) => void): this;
on(event: "HeapProfiler.resetProfiles", listener: () => void): this;
on(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
*/
on(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend may send update for one or more fragments
*/
on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>) => void): this;
/**
* Contains an bucket of collected trace events.
*/
on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
/**
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
* delivered via dataCollected events.
*/
on(event: "NodeTracing.tracingComplete", listener: () => void): this;
/**
* Issued when attached to a worker.
*/
on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
/**
* Issued when detached from the worker.
*/
on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
/**
* Notifies about a new protocol message received from the session
* (session ID is provided in attachedToWorker notification).
*/
on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
* It is fired when the Node process finished all code execution and is
* waiting for all frontends to disconnect.
*/
on(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
*/
once(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this;
/**
* Issued when new execution context is created.
*/
once(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>) => void): this;
/**
* Issued when execution context is destroyed.
*/
once(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>) => void): this;
/**
* Issued when all executionContexts were cleared in browser
*/
once(event: "Runtime.executionContextsCleared", listener: () => void): this;
/**
* Issued when exception was thrown and unhandled.
*/
once(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification<Runtime.ExceptionThrownEventDataType>) => void): this;
/**
* Issued when unhandled exception was revoked.
*/
once(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>) => void): this;
/**
* Issued when console API was called.
*/
once(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>) => void): this;
/**
* Issued when object should be inspected (for example, as a result of inspect() command line API call).
*/
once(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
/**
* Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
*/
once(event: "Debugger.scriptParsed", listener: (message: InspectorNotification<Debugger.ScriptParsedEventDataType>) => void): this;
/**
* Fired when virtual machine fails to parse the script.
*/
once(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>) => void): this;
/**
* Fired when breakpoint is resolved to an actual script and location.
*/
once(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>) => void): this;
/**
* Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
*/
once(event: "Debugger.paused", listener: (message: InspectorNotification<Debugger.PausedEventDataType>) => void): this;
/**
* Fired when the virtual machine resumed execution.
*/
once(event: "Debugger.resumed", listener: () => void): this;
/**
* Issued when new console message is added.
*/
once(event: "Console.messageAdded", listener: (message: InspectorNotification<Console.MessageAddedEventDataType>) => void): this;
/**
* Sent when new profile recording is started using console.profile() call.
*/
once(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>) => void): this;
once(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>) => void): this;
once(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>) => void): this;
once(event: "HeapProfiler.resetProfiles", listener: () => void): this;
once(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
*/
once(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend may send update for one or more fragments
*/
once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>) => void): this;
/**
* Contains an bucket of collected trace events.
*/
once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
/**
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
* delivered via dataCollected events.
*/
once(event: "NodeTracing.tracingComplete", listener: () => void): this;
/**
* Issued when attached to a worker.
*/
once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
/**
* Issued when detached from the worker.
*/
once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
/**
* Notifies about a new protocol message received from the session
* (session ID is provided in attachedToWorker notification).
*/
once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
* It is fired when the Node process finished all code execution and is
* waiting for all frontends to disconnect.
*/
once(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
*/
prependListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this;
/**
* Issued when new execution context is created.
*/
prependListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>) => void): this;
/**
* Issued when execution context is destroyed.
*/
prependListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>) => void): this;
/**
* Issued when all executionContexts were cleared in browser
*/
prependListener(event: "Runtime.executionContextsCleared", listener: () => void): this;
/**
* Issued when exception was thrown and unhandled.
*/
prependListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification<Runtime.ExceptionThrownEventDataType>) => void): this;
/**
* Issued when unhandled exception was revoked.
*/
prependListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>) => void): this;
/**
* Issued when console API was called.
*/
prependListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>) => void): this;
/**
* Issued when object should be inspected (for example, as a result of inspect() command line API call).
*/
prependListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
/**
* Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
*/
prependListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification<Debugger.ScriptParsedEventDataType>) => void): this;
/**
* Fired when virtual machine fails to parse the script.
*/
prependListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>) => void): this;
/**
* Fired when breakpoint is resolved to an actual script and location.
*/
prependListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>) => void): this;
/**
* Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
*/
prependListener(event: "Debugger.paused", listener: (message: InspectorNotification<Debugger.PausedEventDataType>) => void): this;
/**
* Fired when the virtual machine resumed execution.
*/
prependListener(event: "Debugger.resumed", listener: () => void): this;
/**
* Issued when new console message is added.
*/
prependListener(event: "Console.messageAdded", listener: (message: InspectorNotification<Console.MessageAddedEventDataType>) => void): this;
/**
* Sent when new profile recording is started using console.profile() call.
*/
prependListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>) => void): this;
prependListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>) => void): this;
prependListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>) => void): this;
prependListener(event: "HeapProfiler.resetProfiles", listener: () => void): this;
prependListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
*/
prependListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend may send update for one or more fragments
*/
prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>) => void): this;
/**
* Contains an bucket of collected trace events.
*/
prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
/**
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
* delivered via dataCollected events.
*/
prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
/**
* Issued when attached to a worker.
*/
prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
/**
* Issued when detached from the worker.
*/
prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
/**
* Notifies about a new protocol message received from the session
* (session ID is provided in attachedToWorker notification).
*/
prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
* It is fired when the Node process finished all code execution and is
* waiting for all frontends to disconnect.
*/
prependListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
*/
prependOnceListener(event: "inspectorNotification", listener: (message: InspectorNotification<{}>) => void): this;
/**
* Issued when new execution context is created.
*/
prependOnceListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>) => void): this;
/**
* Issued when execution context is destroyed.
*/
prependOnceListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification<Runtime.ExecutionContextDestroyedEventDataType>) => void): this;
/**
* Issued when all executionContexts were cleared in browser
*/
prependOnceListener(event: "Runtime.executionContextsCleared", listener: () => void): this;
/**
* Issued when exception was thrown and unhandled.
*/
prependOnceListener(event: "Runtime.exceptionThrown", listener: (message: InspectorNotification<Runtime.ExceptionThrownEventDataType>) => void): this;
/**
* Issued when unhandled exception was revoked.
*/
prependOnceListener(event: "Runtime.exceptionRevoked", listener: (message: InspectorNotification<Runtime.ExceptionRevokedEventDataType>) => void): this;
/**
* Issued when console API was called.
*/
prependOnceListener(event: "Runtime.consoleAPICalled", listener: (message: InspectorNotification<Runtime.ConsoleAPICalledEventDataType>) => void): this;
/**
* Issued when object should be inspected (for example, as a result of inspect() command line API call).
*/
prependOnceListener(event: "Runtime.inspectRequested", listener: (message: InspectorNotification<Runtime.InspectRequestedEventDataType>) => void): this;
/**
* Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
*/
prependOnceListener(event: "Debugger.scriptParsed", listener: (message: InspectorNotification<Debugger.ScriptParsedEventDataType>) => void): this;
/**
* Fired when virtual machine fails to parse the script.
*/
prependOnceListener(event: "Debugger.scriptFailedToParse", listener: (message: InspectorNotification<Debugger.ScriptFailedToParseEventDataType>) => void): this;
/**
* Fired when breakpoint is resolved to an actual script and location.
*/
prependOnceListener(event: "Debugger.breakpointResolved", listener: (message: InspectorNotification<Debugger.BreakpointResolvedEventDataType>) => void): this;
/**
* Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
*/
prependOnceListener(event: "Debugger.paused", listener: (message: InspectorNotification<Debugger.PausedEventDataType>) => void): this;
/**
* Fired when the virtual machine resumed execution.
*/
prependOnceListener(event: "Debugger.resumed", listener: () => void): this;
/**
* Issued when new console message is added.
*/
prependOnceListener(event: "Console.messageAdded", listener: (message: InspectorNotification<Console.MessageAddedEventDataType>) => void): this;
/**
* Sent when new profile recording is started using console.profile() call.
*/
prependOnceListener(event: "Profiler.consoleProfileStarted", listener: (message: InspectorNotification<Profiler.ConsoleProfileStartedEventDataType>) => void): this;
prependOnceListener(event: "Profiler.consoleProfileFinished", listener: (message: InspectorNotification<Profiler.ConsoleProfileFinishedEventDataType>) => void): this;
prependOnceListener(event: "HeapProfiler.addHeapSnapshotChunk", listener: (message: InspectorNotification<HeapProfiler.AddHeapSnapshotChunkEventDataType>) => void): this;
prependOnceListener(event: "HeapProfiler.resetProfiles", listener: () => void): this;
prependOnceListener(event: "HeapProfiler.reportHeapSnapshotProgress", listener: (message: InspectorNotification<HeapProfiler.ReportHeapSnapshotProgressEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
*/
prependOnceListener(event: "HeapProfiler.lastSeenObjectId", listener: (message: InspectorNotification<HeapProfiler.LastSeenObjectIdEventDataType>) => void): this;
/**
* If heap objects tracking has been started then backend may send update for one or more fragments
*/
prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification<HeapProfiler.HeapStatsUpdateEventDataType>) => void): this;
/**
* Contains an bucket of collected trace events.
*/
prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification<NodeTracing.DataCollectedEventDataType>) => void): this;
/**
* Signals that tracing is stopped and there is no trace buffers pending flush, all data were
* delivered via dataCollected events.
*/
prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this;
/**
* Issued when attached to a worker.
*/
prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>) => void): this;
/**
* Issued when detached from the worker.
*/
prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>) => void): this;
/**
* Notifies about a new protocol message received from the session
* (session ID is provided in attachedToWorker notification).
*/
prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
* It is fired when the Node process finished all code execution and is
* waiting for all frontends to disconnect.
*/
prependOnceListener(event: "NodeRuntime.waitingForDisconnect", listener: () => void): this;
}
// Top Level API
/**
* Activate inspector on host and port. Equivalent to node --inspect=[[host:]port], but can be done programatically after node has started.
* If wait is true, will block until a client has connected to the inspect port and flow control has been passed to the debugger client.
* @param port Port to listen on for inspector connections. Optional, defaults to what was specified on the CLI.
* @param host Host to listen on for inspector connections. Optional, defaults to what was specified on the CLI.
* @param wait Block until a client has connected. Optional, defaults to false.
*/
function open(port?: number, host?: string, wait?: boolean): void;
/**
* Deactivate the inspector. Blocks until there are no active connections.
*/
function close(): void;
/**
* Return the URL of the active inspector, or `undefined` if there is none.
*/
function url(): string | undefined;
/**
* Blocks until a client (existing or connected later) has sent
* `Runtime.runIfWaitingForDebugger` command.
* An exception will be thrown if there is no active inspector.
*/
function waitForDebugger(): void;
}
declare module 'module' {
import { URL } from 'url';
namespace Module {
/**
* Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports.
* It does not add or remove exported names from the ES Modules.
*/
function syncBuiltinESMExports(): void;
function findSourceMap(path: string, error?: Error): SourceMap;
interface SourceMapPayload {
file: string;
version: number;
sources: string[];
sourcesContent: string[];
names: string[];
mappings: string;
sourceRoot: string;
}
interface SourceMapping {
generatedLine: number;
generatedColumn: number;
originalSource: string;
originalLine: number;
originalColumn: number;
}
class SourceMap {
readonly payload: SourceMapPayload;
constructor(payload: SourceMapPayload);
findEntry(line: number, column: number): SourceMapping;
}
}
interface Module extends NodeModule {}
class Module {
static runMain(): void;
static wrap(code: string): string;
/**
* @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
*/
static createRequireFromPath(path: string): NodeRequire;
static createRequire(path: string | URL): NodeRequire;
static builtinModules: string[];
static Module: typeof Module;
constructor(id: string, parent?: Module);
}
export = Module;
}
declare module 'net' {
import * as stream from 'stream';
import { Abortable, EventEmitter } from 'events';
import * as dns from 'dns';
type LookupFunction = (
hostname: string,
options: dns.LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
) => void;
interface AddressInfo {
address: string;
family: string;
port: number;
}
interface SocketConstructorOpts {
fd?: number;
allowHalfOpen?: boolean;
readable?: boolean;
writable?: boolean;
}
interface OnReadOpts {
buffer: Uint8Array | (() => Uint8Array);
/**
* This function is called for every chunk of incoming data.
* Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
* Return false from this function to implicitly pause() the socket.
*/
callback(bytesWritten: number, buf: Uint8Array): boolean;
}
interface ConnectOpts {
/**
* If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
* Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
* still be emitted as normal and methods like pause() and resume() will also behave as expected.
*/
onread?: OnReadOpts;
}
interface TcpSocketConnectOpts extends ConnectOpts {
port: number;
host?: string;
localAddress?: string;
localPort?: number;
hints?: number;
family?: number;
lookup?: LookupFunction;
}
interface IpcSocketConnectOpts extends ConnectOpts {
path: string;
}
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
class Socket extends stream.Duplex {
constructor(options?: SocketConstructorOpts);
// Extended base methods
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
connect(options: SocketConnectOpts, connectionListener?: () => void): this;
connect(port: number, host: string, connectionListener?: () => void): this;
connect(port: number, connectionListener?: () => void): this;
connect(path: string, connectionListener?: () => void): this;
setEncoding(encoding?: BufferEncoding): this;
pause(): this;
resume(): this;
setTimeout(timeout: number, callback?: () => void): this;
setNoDelay(noDelay?: boolean): this;
setKeepAlive(enable?: boolean, initialDelay?: number): this;
address(): AddressInfo | {};
unref(): this;
ref(): this;
/** @deprecated since v14.6.0 - Use `writableLength` instead. */
readonly bufferSize: number;
readonly bytesRead: number;
readonly bytesWritten: number;
readonly connecting: boolean;
readonly destroyed: boolean;
readonly localAddress: string;
readonly localPort: number;
readonly remoteAddress?: string;
readonly remoteFamily?: string;
readonly remotePort?: number;
// Extended base methods
end(cb?: () => void): void;
end(buffer: Uint8Array | string, cb?: () => void): void;
end(str: Uint8Array | string, encoding?: BufferEncoding, cb?: () => void): void;
/**
* events.EventEmitter
* 1. close
* 2. connect
* 3. data
* 4. drain
* 5. end
* 6. error
* 7. lookup
* 8. timeout
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: (had_error: boolean) => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "data", listener: (data: Buffer) => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
addListener(event: "timeout", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close", had_error: boolean): boolean;
emit(event: "connect"): boolean;
emit(event: "data", data: Buffer): boolean;
emit(event: "drain"): boolean;
emit(event: "end"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean;
emit(event: "timeout"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: (had_error: boolean) => void): this;
on(event: "connect", listener: () => void): this;
on(event: "data", listener: (data: Buffer) => void): this;
on(event: "drain", listener: () => void): this;
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
on(event: "timeout", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: (had_error: boolean) => void): this;
once(event: "connect", listener: () => void): this;
once(event: "data", listener: (data: Buffer) => void): this;
once(event: "drain", listener: () => void): this;
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
once(event: "timeout", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: (had_error: boolean) => void): this;
prependListener(event: "connect", listener: () => void): this;
prependListener(event: "data", listener: (data: Buffer) => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: (had_error: boolean) => void): this;
prependOnceListener(event: "connect", listener: () => void): this;
prependOnceListener(event: "data", listener: (data: Buffer) => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
}
interface ListenOptions extends Abortable {
port?: number;
host?: string;
backlog?: number;
path?: string;
exclusive?: boolean;
readableAll?: boolean;
writableAll?: boolean;
/**
* @default false
*/
ipv6Only?: boolean;
}
interface ServerOpts {
/**
* Indicates whether half-opened TCP connections are allowed.
* @default false
*/
allowHalfOpen?: boolean;
/**
* Indicates whether the socket should be paused on incoming connections.
* @default false
*/
pauseOnConnect?: boolean;
}
// https://github.com/nodejs/node/blob/master/lib/net.js
class Server extends EventEmitter {
constructor(connectionListener?: (socket: Socket) => void);
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
listen(port?: number, backlog?: number, listeningListener?: () => void): this;
listen(port?: number, listeningListener?: () => void): this;
listen(path: string, backlog?: number, listeningListener?: () => void): this;
listen(path: string, listeningListener?: () => void): this;
listen(options: ListenOptions, listeningListener?: () => void): this;
listen(handle: any, backlog?: number, listeningListener?: () => void): this;
listen(handle: any, listeningListener?: () => void): this;
close(callback?: (err?: Error) => void): this;
address(): AddressInfo | string | null;
getConnections(cb: (error: Error | null, count: number) => void): void;
ref(): this;
unref(): this;
maxConnections: number;
connections: number;
listening: boolean;
/**
* events.EventEmitter
* 1. close
* 2. connection
* 3. error
* 4. listening
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Socket) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Socket): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Socket) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Socket) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Socket) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
}
type IPVersion = 'ipv4' | 'ipv6';
class BlockList {
/**
* Adds a rule to block the given IP address.
*
* @param address An IPv4 or IPv6 address.
* @param type Either 'ipv4' or 'ipv6'. Default: 'ipv4'.
*/
addAddress(address: string, type?: IPVersion): void;
/**
* Adds a rule to block a range of IP addresses from start (inclusive) to end (inclusive).
*
* @param start The starting IPv4 or IPv6 address in the range.
* @param end The ending IPv4 or IPv6 address in the range.
* @param type Either 'ipv4' or 'ipv6'. Default: 'ipv4'.
*/
addRange(start: string, end: string, type?: IPVersion): void;
/**
* Adds a rule to block a range of IP addresses specified as a subnet mask.
*
* @param net The network IPv4 or IPv6 address.
* @param prefix The number of CIDR prefix bits.
* For IPv4, this must be a value between 0 and 32. For IPv6, this must be between 0 and 128.
* @param type Either 'ipv4' or 'ipv6'. Default: 'ipv4'.
*/
addSubnet(net: string, prefix: number, type?: IPVersion): void;
/**
* Returns `true` if the given IP address matches any of the rules added to the `BlockList`.
*
* @param address The IP address to check
* @param type Either 'ipv4' or 'ipv6'. Default: 'ipv4'.
*/
check(address: string, type?: IPVersion): boolean;
}
interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
timeout?: number;
}
interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
timeout?: number;
}
type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
function createServer(connectionListener?: (socket: Socket) => void): Server;
function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
function connect(port: number, host?: string, connectionListener?: () => void): Socket;
function connect(path: string, connectionListener?: () => void): Socket;
function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
function createConnection(path: string, connectionListener?: () => void): Socket;
function isIP(input: string): number;
function isIPv4(input: string): boolean;
function isIPv6(input: string): boolean;
}
declare module 'os' {
interface CpuInfo {
model: string;
speed: number;
times: {
user: number;
nice: number;
sys: number;
idle: number;
irq: number;
};
}
interface NetworkInterfaceBase {
address: string;
netmask: string;
mac: string;
internal: boolean;
cidr: string | null;
}
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
family: "IPv4";
}
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
family: "IPv6";
scopeid: number;
}
interface UserInfo<T> {
username: T;
uid: number;
gid: number;
shell: T;
homedir: T;
}
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
function hostname(): string;
function loadavg(): number[];
function uptime(): number;
function freemem(): number;
function totalmem(): number;
function cpus(): CpuInfo[];
function type(): string;
function release(): string;
function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
function homedir(): string;
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
type SignalConstants = {
[key in NodeJS.Signals]: number;
};
namespace constants {
const UV_UDP_REUSEADDR: number;
namespace signals {}
const signals: SignalConstants;
namespace errno {
const E2BIG: number;
const EACCES: number;
const EADDRINUSE: number;
const EADDRNOTAVAIL: number;
const EAFNOSUPPORT: number;
const EAGAIN: number;
const EALREADY: number;
const EBADF: number;
const EBADMSG: number;
const EBUSY: number;
const ECANCELED: number;
const ECHILD: number;
const ECONNABORTED: number;
const ECONNREFUSED: number;
const ECONNRESET: number;
const EDEADLK: number;
const EDESTADDRREQ: number;
const EDOM: number;
const EDQUOT: number;
const EEXIST: number;
const EFAULT: number;
const EFBIG: number;
const EHOSTUNREACH: number;
const EIDRM: number;
const EILSEQ: number;
const EINPROGRESS: number;
const EINTR: number;
const EINVAL: number;
const EIO: number;
const EISCONN: number;
const EISDIR: number;
const ELOOP: number;
const EMFILE: number;
const EMLINK: number;
const EMSGSIZE: number;
const EMULTIHOP: number;
const ENAMETOOLONG: number;
const ENETDOWN: number;
const ENETRESET: number;
const ENETUNREACH: number;
const ENFILE: number;
const ENOBUFS: number;
const ENODATA: number;
const ENODEV: number;
const ENOENT: number;
const ENOEXEC: number;
const ENOLCK: number;
const ENOLINK: number;
const ENOMEM: number;
const ENOMSG: number;
const ENOPROTOOPT: number;
const ENOSPC: number;
const ENOSR: number;
const ENOSTR: number;
const ENOSYS: number;
const ENOTCONN: number;
const ENOTDIR: number;
const ENOTEMPTY: number;
const ENOTSOCK: number;
const ENOTSUP: number;
const ENOTTY: number;
const ENXIO: number;
const EOPNOTSUPP: number;
const EOVERFLOW: number;
const EPERM: number;
const EPIPE: number;
const EPROTO: number;
const EPROTONOSUPPORT: number;
const EPROTOTYPE: number;
const ERANGE: number;
const EROFS: number;
const ESPIPE: number;
const ESRCH: number;
const ESTALE: number;
const ETIME: number;
const ETIMEDOUT: number;
const ETXTBSY: number;
const EWOULDBLOCK: number;
const EXDEV: number;
const WSAEINTR: number;
const WSAEBADF: number;
const WSAEACCES: number;
const WSAEFAULT: number;
const WSAEINVAL: number;
const WSAEMFILE: number;
const WSAEWOULDBLOCK: number;
const WSAEINPROGRESS: number;
const WSAEALREADY: number;
const WSAENOTSOCK: number;
const WSAEDESTADDRREQ: number;
const WSAEMSGSIZE: number;
const WSAEPROTOTYPE: number;
const WSAENOPROTOOPT: number;
const WSAEPROTONOSUPPORT: number;
const WSAESOCKTNOSUPPORT: number;
const WSAEOPNOTSUPP: number;
const WSAEPFNOSUPPORT: number;
const WSAEAFNOSUPPORT: number;
const WSAEADDRINUSE: number;
const WSAEADDRNOTAVAIL: number;
const WSAENETDOWN: number;
const WSAENETUNREACH: number;
const WSAENETRESET: number;
const WSAECONNABORTED: number;
const WSAECONNRESET: number;
const WSAENOBUFS: number;
const WSAEISCONN: number;
const WSAENOTCONN: number;
const WSAESHUTDOWN: number;
const WSAETOOMANYREFS: number;
const WSAETIMEDOUT: number;
const WSAECONNREFUSED: number;
const WSAELOOP: number;
const WSAENAMETOOLONG: number;
const WSAEHOSTDOWN: number;
const WSAEHOSTUNREACH: number;
const WSAENOTEMPTY: number;
const WSAEPROCLIM: number;
const WSAEUSERS: number;
const WSAEDQUOT: number;
const WSAESTALE: number;
const WSAEREMOTE: number;
const WSASYSNOTREADY: number;
const WSAVERNOTSUPPORTED: number;
const WSANOTINITIALISED: number;
const WSAEDISCON: number;
const WSAENOMORE: number;
const WSAECANCELLED: number;
const WSAEINVALIDPROCTABLE: number;
const WSAEINVALIDPROVIDER: number;
const WSAEPROVIDERFAILEDINIT: number;
const WSASYSCALLFAILURE: number;
const WSASERVICE_NOT_FOUND: number;
const WSATYPE_NOT_FOUND: number;
const WSA_E_NO_MORE: number;
const WSA_E_CANCELLED: number;
const WSAEREFUSED: number;
}
namespace priority {
const PRIORITY_LOW: number;
const PRIORITY_BELOW_NORMAL: number;
const PRIORITY_NORMAL: number;
const PRIORITY_ABOVE_NORMAL: number;
const PRIORITY_HIGH: number;
const PRIORITY_HIGHEST: number;
}
}
function arch(): string;
/**
* Returns a string identifying the kernel version.
* On POSIX systems, the operating system release is determined by calling
* uname(3). On Windows, `pRtlGetVersion` is used, and if it is not available,
* `GetVersionExW()` will be used. See
* https://en.wikipedia.org/wiki/Uname#Examples for more information.
*/
function version(): string;
function platform(): NodeJS.Platform;
function tmpdir(): string;
const EOL: string;
function endianness(): "BE" | "LE";
/**
* Gets the priority of a process.
* Defaults to current process.
*/
function getPriority(pid?: number): number;
/**
* Sets the priority of the current process.
* @param priority Must be in range of -20 to 19
*/
function setPriority(priority: number): void;
/**
* Sets the priority of the process specified process.
* @param priority Must be in range of -20 to 19
*/
function setPriority(pid: number, priority: number): void;
}
{
"name": "@types/node",
"version": "15.12.5",
"description": "TypeScript definitions for Node.js",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
"contributors": [
{
"name": "Microsoft TypeScript",
"url": "https://github.com/Microsoft",
"githubUsername": "Microsoft"
},
{
"name": "DefinitelyTyped",
"url": "https://github.com/DefinitelyTyped",
"githubUsername": "DefinitelyTyped"
},
{
"name": "Alberto Schiabel",
"url": "https://github.com/jkomyno",
"githubUsername": "jkomyno"
},
{
"name": "Alvis HT Tang",
"url": "https://github.com/alvis",
"githubUsername": "alvis"
},
{
"name": "Andrew Makarov",
"url": "https://github.com/r3nya",
"githubUsername": "r3nya"
},
{
"name": "Benjamin Toueg",
"url": "https://github.com/btoueg",
"githubUsername": "btoueg"
},
{
"name": "Chigozirim C.",
"url": "https://github.com/smac89",
"githubUsername": "smac89"
},
{
"name": "David Junger",
"url": "https://github.com/touffy",
"githubUsername": "touffy"
},
{
"name": "Deividas Bakanas",
"url": "https://github.com/DeividasBakanas",
"githubUsername": "DeividasBakanas"
},
{
"name": "Eugene Y. Q. Shen",
"url": "https://github.com/eyqs",
"githubUsername": "eyqs"
},
{
"name": "Hannes Magnusson",
"url": "https://github.com/Hannes-Magnusson-CK",
"githubUsername": "Hannes-Magnusson-CK"
},
{
"name": "Hoàng Văn Khải",
"url": "https://github.com/KSXGitHub",
"githubUsername": "KSXGitHub"
},
{
"name": "Huw",
"url": "https://github.com/hoo29",
"githubUsername": "hoo29"
},
{
"name": "Kelvin Jin",
"url": "https://github.com/kjin",
"githubUsername": "kjin"
},
{
"name": "Klaus Meinhardt",
"url": "https://github.com/ajafff",
"githubUsername": "ajafff"
},
{
"name": "Lishude",
"url": "https://github.com/islishude",
"githubUsername": "islishude"
},
{
"name": "Mariusz Wiktorczyk",
"url": "https://github.com/mwiktorczyk",
"githubUsername": "mwiktorczyk"
},
{
"name": "Mohsen Azimi",
"url": "https://github.com/mohsen1",
"githubUsername": "mohsen1"
},
{
"name": "Nicolas Even",
"url": "https://github.com/n-e",
"githubUsername": "n-e"
},
{
"name": "Nikita Galkin",
"url": "https://github.com/galkin",
"githubUsername": "galkin"
},
{
"name": "Parambir Singh",
"url": "https://github.com/parambirs",
"githubUsername": "parambirs"
},
{
"name": "Sebastian Silbermann",
"url": "https://github.com/eps1lon",
"githubUsername": "eps1lon"
},
{
"name": "Simon Schick",
"url": "https://github.com/SimonSchick",
"githubUsername": "SimonSchick"
},
{
"name": "Thomas den Hollander",
"url": "https://github.com/ThomasdenH",
"githubUsername": "ThomasdenH"
},
{
"name": "Wilco Bakker",
"url": "https://github.com/WilcoBakker",
"githubUsername": "WilcoBakker"
},
{
"name": "wwwy3y3",
"url": "https://github.com/wwwy3y3",
"githubUsername": "wwwy3y3"
},
{
"name": "Samuel Ainsworth",
"url": "https://github.com/samuela",
"githubUsername": "samuela"
},
{
"name": "Kyle Uehlein",
"url": "https://github.com/kuehlein",
"githubUsername": "kuehlein"
},
{
"name": "Thanik Bhongbhibhat",
"url": "https://github.com/bhongy",
"githubUsername": "bhongy"
},
{
"name": "Marcin Kopacz",
"url": "https://github.com/chyzwar",
"githubUsername": "chyzwar"
},
{
"name": "Trivikram Kamat",
"url": "https://github.com/trivikr",
"githubUsername": "trivikr"
},
{
"name": "Minh Son Nguyen",
"url": "https://github.com/nguymin4",
"githubUsername": "nguymin4"
},
{
"name": "Junxiao Shi",
"url": "https://github.com/yoursunny",
"githubUsername": "yoursunny"
},
{
"name": "Ilia Baryshnikov",
"url": "https://github.com/qwelias",
"githubUsername": "qwelias"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
},
{
"name": "Surasak Chaisurin",
"url": "https://github.com/Ryan-Willpower",
"githubUsername": "Ryan-Willpower"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
},
{
"name": "Anna Henningsen",
"url": "https://github.com/addaleax",
"githubUsername": "addaleax"
},
{
"name": "Jason Kwok",
"url": "https://github.com/JasonHK",
"githubUsername": "JasonHK"
},
{
"name": "Victor Perin",
"url": "https://github.com/victorperin",
"githubUsername": "victorperin"
},
{
"name": "Yongsheng Zhang",
"url": "https://github.com/ZYSzys",
"githubUsername": "ZYSzys"
}
],
"main": "",
"types": "index.d.ts",
"typesVersions": {
"<=3.6": {
"*": [
"ts3.6/*"
]
}
},
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/node"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "27e260431d93d284b56cfa62ffac0033dd082b38fe0a13304f6764a5767fc5aa",
"typeScriptVersion": "3.6"
}
\ No newline at end of file
declare module 'path/posix' {
import path = require('path');
export = path;
}
declare module 'path/win32' {
import path = require('path');
export = path;
}
declare module 'path' {
namespace path {
/**
* A parsed path object generated by path.parse() or consumed by path.format().
*/
interface ParsedPath {
/**
* The root of the path such as '/' or 'c:\'
*/
root: string;
/**
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
*/
dir: string;
/**
* The file name including extension (if any) such as 'index.html'
*/
base: string;
/**
* The file extension (if any) such as '.html'
*/
ext: string;
/**
* The file name without extension (if any) such as 'index'
*/
name: string;
}
interface FormatInputPathObject {
/**
* The root of the path such as '/' or 'c:\'
*/
root?: string;
/**
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
*/
dir?: string;
/**
* The file name including extension (if any) such as 'index.html'
*/
base?: string;
/**
* The file extension (if any) such as '.html'
*/
ext?: string;
/**
* The file name without extension (if any) such as 'index'
*/
name?: string;
}
interface PlatformPath {
/**
* Normalize a string path, reducing '..' and '.' parts.
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
*
* @param p string path to normalize.
*/
normalize(p: string): string;
/**
* Join all arguments together and normalize the resulting path.
* Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
*
* @param paths paths to join.
*/
join(...paths: string[]): string;
/**
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
*
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
*
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
* the current working directory is used as well. The resulting path is normalized,
* and trailing slashes are removed unless the path gets resolved to the root directory.
*
* @param pathSegments string paths to join. Non-string arguments are ignored.
*/
resolve(...pathSegments: string[]): string;
/**
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
*
* @param path path to test.
*/
isAbsolute(p: string): boolean;
/**
* Solve the relative path from {from} to {to}.
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
*/
relative(from: string, to: string): string;
/**
* Return the directory name of a path. Similar to the Unix dirname command.
*
* @param p the path to evaluate.
*/
dirname(p: string): string;
/**
* Return the last portion of a path. Similar to the Unix basename command.
* Often used to extract the file name from a fully qualified path.
*
* @param p the path to evaluate.
* @param ext optionally, an extension to remove from the result.
*/
basename(p: string, ext?: string): string;
/**
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
*
* @param p the path to evaluate.
*/
extname(p: string): string;
/**
* The platform-specific file separator. '\\' or '/'.
*/
readonly sep: string;
/**
* The platform-specific file delimiter. ';' or ':'.
*/
readonly delimiter: string;
/**
* Returns an object from a path string - the opposite of format().
*
* @param pathString path to evaluate.
*/
parse(p: string): ParsedPath;
/**
* Returns a path string from an object - the opposite of parse().
*
* @param pathString path to evaluate.
*/
format(pP: FormatInputPathObject): string;
/**
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
* If path is not a string, path will be returned without modifications.
* This method is meaningful only on Windows system.
* On POSIX systems, the method is non-operational and always returns path without modifications.
*/
toNamespacedPath(path: string): string;
/**
* Posix specific pathing.
* Same as parent object on posix.
*/
readonly posix: PlatformPath;
/**
* Windows specific pathing.
* Same as parent object on windows
*/
readonly win32: PlatformPath;
}
}
const path: path.PlatformPath;
export = path;
}
declare module 'perf_hooks' {
import { AsyncResource } from 'async_hooks';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
class PerformanceEntry {
protected constructor();
/**
* The total number of milliseconds elapsed for this entry.
* This value will not be meaningful for all Performance Entry types.
*/
readonly duration: number;
/**
* The name of the performance entry.
*/
readonly name: string;
/**
* The high resolution millisecond timestamp marking the starting time of the Performance Entry.
*/
readonly startTime: number;
/**
* The type of the performance entry.
* Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'.
*/
readonly entryType: EntryType;
/**
* When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
* the type of garbage collection operation that occurred.
* See perf_hooks.constants for valid values.
*/
readonly kind?: number;
/**
* When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
* property contains additional information about garbage collection operation.
* See perf_hooks.constants for valid values.
*/
readonly flags?: number;
}
class PerformanceNodeTiming extends PerformanceEntry {
/**
* The high resolution millisecond timestamp at which the Node.js process completed bootstrap.
*/
readonly bootstrapComplete: number;
/**
* The high resolution millisecond timestamp at which the Node.js process completed bootstrapping.
* If bootstrapping has not yet finished, the property has the value of -1.
*/
readonly environment: number;
/**
* The high resolution millisecond timestamp at which the Node.js environment was initialized.
*/
readonly idleTime: number;
/**
* The high resolution millisecond timestamp of the amount of time the event loop has been idle
* within the event loop's event provider (e.g. `epoll_wait`). This does not take CPU usage
* into consideration. If the event loop has not yet started (e.g., in the first tick of the main script),
* the property has the value of 0.
*/
readonly loopExit: number;
/**
* The high resolution millisecond timestamp at which the Node.js event loop started.
* If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1.
*/
readonly loopStart: number;
/**
* The high resolution millisecond timestamp at which the V8 platform was initialized.
*/
readonly v8Start: number;
}
interface EventLoopUtilization {
idle: number;
active: number;
utilization: number;
}
/**
* @param util1 The result of a previous call to eventLoopUtilization()
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
*/
type EventLoopUtilityFunction = (
util1?: EventLoopUtilization,
util2?: EventLoopUtilization,
) => EventLoopUtilization;
interface Performance {
/**
* If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
* If name is provided, removes only the named mark.
* @param name
*/
clearMarks(name?: string): void;
/**
* Creates a new PerformanceMark entry in the Performance Timeline.
* A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
* and whose performanceEntry.duration is always 0.
* Performance marks are used to mark specific significant moments in the Performance Timeline.
* @param name
*/
mark(name?: string): void;
/**
* Creates a new PerformanceMeasure entry in the Performance Timeline.
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
* and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.
*
* The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify
* any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist,
* then startMark is set to timeOrigin by default.
*
* The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp
* properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.
* @param name
* @param startMark
* @param endMark
*/
measure(name: string, startMark?: string, endMark?: string): void;
/**
* An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
*/
readonly nodeTiming: PerformanceNodeTiming;
/**
* @return the current high resolution millisecond timestamp
*/
now(): number;
/**
* The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured.
*/
readonly timeOrigin: number;
/**
* Wraps a function within a new function that measures the running time of the wrapped function.
* A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
* @param fn
*/
timerify<T extends (...optionalParams: any[]) => any>(fn: T): T;
/**
* eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
* It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
* No other CPU idle time is taken into consideration.
*/
eventLoopUtilization: EventLoopUtilityFunction;
}
interface PerformanceObserverEntryList {
/**
* @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime.
*/
getEntries(): PerformanceEntry[];
/**
* @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
* whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type.
*/
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
/**
* @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
* whose performanceEntry.entryType is equal to type.
*/
getEntriesByType(type: EntryType): PerformanceEntry[];
}
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
class PerformanceObserver extends AsyncResource {
constructor(callback: PerformanceObserverCallback);
/**
* Disconnects the PerformanceObserver instance from all notifications.
*/
disconnect(): void;
/**
* Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes.
* When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance.
* Property buffered defaults to false.
* @param options
*/
observe(options: { entryTypes: ReadonlyArray<EntryType>; buffered?: boolean }): void;
}
namespace constants {
const NODE_PERFORMANCE_GC_MAJOR: number;
const NODE_PERFORMANCE_GC_MINOR: number;
const NODE_PERFORMANCE_GC_INCREMENTAL: number;
const NODE_PERFORMANCE_GC_WEAKCB: number;
const NODE_PERFORMANCE_GC_FLAGS_NO: number;
const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
}
const performance: Performance;
interface EventLoopMonitorOptions {
/**
* The sampling rate in milliseconds.
* Must be greater than zero.
* @default 10
*/
resolution?: number;
}
interface Histogram {
/**
* A `Map` object detailing the accumulated percentile distribution.
*/
readonly percentiles: Map<number, number>;
/**
* The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
*/
readonly exceeds: number;
/**
* The minimum recorded event loop delay.
*/
readonly min: number;
/**
* The maximum recorded event loop delay.
*/
readonly max: number;
/**
* The mean of the recorded event loop delays.
*/
readonly mean: number;
/**
* The standard deviation of the recorded event loop delays.
*/
readonly stddev: number;
/**
* Resets the collected histogram data.
*/
reset(): void;
/**
* Returns the value at the given percentile.
* @param percentile A percentile value between 1 and 100.
*/
percentile(percentile: number): number;
}
interface IntervalHistogram extends Histogram {
/**
* Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
*/
enable(): boolean;
/**
* Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
*/
disable(): boolean;
}
interface RecordableHistogram extends Histogram {
record(val: number | bigint): void;
/**
* Calculates the amount of time (in nanoseconds) that has passed since the previous call to recordDelta() and records that amount in the histogram.
*/
recordDelta(): void;
}
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
interface CreateHistogramOptions {
/**
* The minimum recordable value. Must be an integer value greater than 0.
* @default 1
*/
min?: number | bigint;
/**
* The maximum recordable value. Must be an integer value greater than min.
* @default Number.MAX_SAFE_INTEGER
*/
max?: number | bigint;
/**
* The number of accuracy digits. Must be a number between 1 and 5.
* @default 3
*/
figures?: number;
}
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
}
declare module 'process' {
import * as tty from 'tty';
global {
var process: NodeJS.Process;
namespace NodeJS {
// this namespace merge is here because these are specifically used
// as the type for process.stdin, process.stdout, and process.stderr.
// they can't live in tty.d.ts because we need to disambiguate the imported name.
interface ReadStream extends tty.ReadStream {}
interface WriteStream extends tty.WriteStream {}
interface MemoryUsageFn {
/**
* The `process.memoryUsage()` method iterate over each page to gather informations about memory
* usage which can be slow depending on the program memory allocations.
*/
(): MemoryUsage;
/**
* method returns an integer representing the Resident Set Size (RSS) in bytes.
*/
rss(): number;
}
interface MemoryUsage {
rss: number;
heapTotal: number;
heapUsed: number;
external: number;
arrayBuffers: number;
}
interface CpuUsage {
user: number;
system: number;
}
interface ProcessRelease {
name: string;
sourceUrl?: string;
headersUrl?: string;
libUrl?: string;
lts?: string;
}
interface ProcessVersions extends Dict<string> {
http_parser: string;
node: string;
v8: string;
ares: string;
uv: string;
zlib: string;
modules: string;
openssl: string;
}
type Platform = 'aix'
| 'android'
| 'darwin'
| 'freebsd'
| 'haiku'
| 'linux'
| 'openbsd'
| 'sunos'
| 'win32'
| 'cygwin'
| 'netbsd';
type Signals =
"SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
"SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
"SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
"SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
type MultipleResolveType = 'resolve' | 'reject';
type BeforeExitListener = (code: number) => void;
type DisconnectListener = () => void;
type ExitListener = (code: number) => void;
type RejectionHandledListener = (promise: Promise<any>) => void;
type UncaughtExceptionListener = (error: Error) => void;
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
type WarningListener = (warning: Error) => void;
type MessageListener = (message: any, sendHandle: any) => void;
type SignalsListener = (signal: Signals) => void;
type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
interface Socket extends ReadWriteStream {
isTTY?: true;
}
// Alias for compatibility
interface ProcessEnv extends Dict<string> {}
interface HRTime {
(time?: [number, number]): [number, number];
bigint(): bigint;
}
interface ProcessReport {
/**
* Directory where the report is written.
* working directory of the Node.js process.
* @default '' indicating that reports are written to the current
*/
directory: string;
/**
* Filename where the report is written.
* The default value is the empty string.
* @default '' the output filename will be comprised of a timestamp,
* PID, and sequence number.
*/
filename: string;
/**
* Returns a JSON-formatted diagnostic report for the running process.
* The report's JavaScript stack trace is taken from err, if present.
*/
getReport(err?: Error): string;
/**
* If true, a diagnostic report is generated on fatal errors,
* such as out of memory errors or failed C++ assertions.
* @default false
*/
reportOnFatalError: boolean;
/**
* If true, a diagnostic report is generated when the process
* receives the signal specified by process.report.signal.
* @defaul false
*/
reportOnSignal: boolean;
/**
* If true, a diagnostic report is generated on uncaught exception.
* @default false
*/
reportOnUncaughtException: boolean;
/**
* The signal used to trigger the creation of a diagnostic report.
* @default 'SIGUSR2'
*/
signal: Signals;
/**
* Writes a diagnostic report to a file. If filename is not provided, the default filename
* includes the date, time, PID, and a sequence number.
* The report's JavaScript stack trace is taken from err, if present.
*
* @param fileName Name of the file where the report is written.
* This should be a relative path, that will be appended to the directory specified in
* `process.report.directory`, or the current working directory of the Node.js process,
* if unspecified.
* @param error A custom error used for reporting the JavaScript stack.
* @return Filename of the generated report.
*/
writeReport(fileName?: string): string;
writeReport(error?: Error): string;
writeReport(fileName?: string, err?: Error): string;
}
interface ResourceUsage {
fsRead: number;
fsWrite: number;
involuntaryContextSwitches: number;
ipcReceived: number;
ipcSent: number;
majorPageFault: number;
maxRSS: number;
minorPageFault: number;
sharedMemorySize: number;
signalsCount: number;
swappedOut: number;
systemCPUTime: number;
unsharedDataSize: number;
unsharedStackSize: number;
userCPUTime: number;
voluntaryContextSwitches: number;
}
interface EmitWarningOptions {
/**
* When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
*
* @default 'Warning'
*/
type?: string;
/**
* A unique identifier for the warning instance being emitted.
*/
code?: string;
/**
* When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
*
* @default process.emitWarning
*/
ctor?: Function;
/**
* Additional text to include with the error.
*/
detail?: string;
}
interface Process extends EventEmitter {
/**
* Can also be a tty.WriteStream, not typed due to limitations.
*/
stdout: WriteStream & {
fd: 1;
};
/**
* Can also be a tty.WriteStream, not typed due to limitations.
*/
stderr: WriteStream & {
fd: 2;
};
stdin: ReadStream & {
fd: 0;
};
openStdin(): Socket;
argv: string[];
argv0: string;
execArgv: string[];
execPath: string;
abort(): never;
chdir(directory: string): void;
cwd(): string;
debugPort: number;
/**
* The `process.emitWarning()` method can be used to emit custom or application specific process warnings.
*
* These can be listened for by adding a handler to the `'warning'` event.
*
* @param warning The warning to emit.
* @param type When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. Default: `'Warning'`.
* @param code A unique identifier for the warning instance being emitted.
* @param ctor When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. Default: `process.emitWarning`.
*/
emitWarning(warning: string | Error, ctor?: Function): void;
emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
env: ProcessEnv;
exit(code?: number): never;
exitCode?: number;
getgid(): number;
setgid(id: number | string): void;
getuid(): number;
setuid(id: number | string): void;
geteuid(): number;
seteuid(id: number | string): void;
getegid(): number;
setegid(id: number | string): void;
getgroups(): number[];
setgroups(groups: ReadonlyArray<string | number>): void;
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
hasUncaughtExceptionCaptureCallback(): boolean;
version: string;
versions: ProcessVersions;
config: {
target_defaults: {
cflags: any[];
default_configuration: string;
defines: string[];
include_dirs: string[];
libraries: string[];
};
variables: {
clang: number;
host_arch: string;
node_install_npm: boolean;
node_install_waf: boolean;
node_prefix: string;
node_shared_openssl: boolean;
node_shared_v8: boolean;
node_shared_zlib: boolean;
node_use_dtrace: boolean;
node_use_etw: boolean;
node_use_openssl: boolean;
target_arch: string;
v8_no_strict_aliasing: number;
v8_use_snapshot: boolean;
visibility: string;
};
};
kill(pid: number, signal?: string | number): true;
pid: number;
ppid: number;
title: string;
arch: string;
platform: Platform;
/** @deprecated since v14.0.0 - use `require.main` instead. */
mainModule?: Module;
memoryUsage: MemoryUsageFn;
cpuUsage(previousValue?: CpuUsage): CpuUsage;
nextTick(callback: Function, ...args: any[]): void;
release: ProcessRelease;
features: {
inspector: boolean;
debug: boolean;
uv: boolean;
ipv6: boolean;
tls_alpn: boolean;
tls_sni: boolean;
tls_ocsp: boolean;
tls: boolean;
};
/**
* @deprecated since v14.0.0 - Calling process.umask() with no argument causes
* the process-wide umask to be written twice. This introduces a race condition between threads,
* and is a potential security vulnerability. There is no safe, cross-platform alternative API.
*/
umask(): number;
/**
* Can only be set if not in worker thread.
*/
umask(mask: string | number): number;
uptime(): number;
hrtime: HRTime;
domain: Domain;
// Worker
send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
disconnect(): void;
connected: boolean;
/**
* The `process.allowedNodeEnvironmentFlags` property is a special,
* read-only `Set` of flags allowable within the `NODE_OPTIONS`
* environment variable.
*/
allowedNodeEnvironmentFlags: ReadonlySet<string>;
/**
* Only available with `--experimental-report`
*/
report?: ProcessReport;
resourceUsage(): ResourceUsage;
traceDeprecation: boolean;
/* EventEmitter */
addListener(event: "beforeExit", listener: BeforeExitListener): this;
addListener(event: "disconnect", listener: DisconnectListener): this;
addListener(event: "exit", listener: ExitListener): this;
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
addListener(event: "warning", listener: WarningListener): this;
addListener(event: "message", listener: MessageListener): this;
addListener(event: Signals, listener: SignalsListener): this;
addListener(event: "newListener", listener: NewListenerListener): this;
addListener(event: "removeListener", listener: RemoveListenerListener): this;
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
emit(event: "beforeExit", code: number): boolean;
emit(event: "disconnect"): boolean;
emit(event: "exit", code: number): boolean;
emit(event: "rejectionHandled", promise: Promise<any>): boolean;
emit(event: "uncaughtException", error: Error): boolean;
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
emit(event: "warning", warning: Error): boolean;
emit(event: "message", message: any, sendHandle: any): this;
emit(event: Signals, signal: Signals): boolean;
emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
emit(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: "beforeExit", listener: BeforeExitListener): this;
on(event: "disconnect", listener: DisconnectListener): this;
on(event: "exit", listener: ExitListener): this;
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
on(event: "warning", listener: WarningListener): this;
on(event: "message", listener: MessageListener): this;
on(event: Signals, listener: SignalsListener): this;
on(event: "newListener", listener: NewListenerListener): this;
on(event: "removeListener", listener: RemoveListenerListener): this;
on(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "beforeExit", listener: BeforeExitListener): this;
once(event: "disconnect", listener: DisconnectListener): this;
once(event: "exit", listener: ExitListener): this;
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
once(event: "warning", listener: WarningListener): this;
once(event: "message", listener: MessageListener): this;
once(event: Signals, listener: SignalsListener): this;
once(event: "newListener", listener: NewListenerListener): this;
once(event: "removeListener", listener: RemoveListenerListener): this;
once(event: "multipleResolves", listener: MultipleResolveListener): this;
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
prependListener(event: "disconnect", listener: DisconnectListener): this;
prependListener(event: "exit", listener: ExitListener): this;
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependListener(event: "warning", listener: WarningListener): this;
prependListener(event: "message", listener: MessageListener): this;
prependListener(event: Signals, listener: SignalsListener): this;
prependListener(event: "newListener", listener: NewListenerListener): this;
prependListener(event: "removeListener", listener: RemoveListenerListener): this;
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
prependOnceListener(event: "exit", listener: ExitListener): this;
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependOnceListener(event: "warning", listener: WarningListener): this;
prependOnceListener(event: "message", listener: MessageListener): this;
prependOnceListener(event: Signals, listener: SignalsListener): this;
prependOnceListener(event: "newListener", listener: NewListenerListener): this;
prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
listeners(event: "beforeExit"): BeforeExitListener[];
listeners(event: "disconnect"): DisconnectListener[];
listeners(event: "exit"): ExitListener[];
listeners(event: "rejectionHandled"): RejectionHandledListener[];
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
listeners(event: "warning"): WarningListener[];
listeners(event: "message"): MessageListener[];
listeners(event: Signals): SignalsListener[];
listeners(event: "newListener"): NewListenerListener[];
listeners(event: "removeListener"): RemoveListenerListener[];
listeners(event: "multipleResolves"): MultipleResolveListener[];
}
interface Global {
process: Process;
}
}
}
export = process;
}
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
declare module 'punycode' {
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
function decode(string: string): string;
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
function encode(string: string): string;
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
function toUnicode(domain: string): string;
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
function toASCII(domain: string): string;
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
const ucs2: ucs2;
interface ucs2 {
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
decode(string: string): number[];
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
encode(codePoints: ReadonlyArray<number>): string;
}
/**
* @deprecated since v7.0.0
* The version of the punycode module bundled in Node.js is being deprecated.
* In a future major version of Node.js this module will be removed.
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
const version: string;
}
declare module 'querystring' {
interface StringifyOptions {
encodeURIComponent?: (str: string) => string;
}
interface ParseOptions {
maxKeys?: number;
decodeURIComponent?: (str: string) => string;
}
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { }
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {
}
function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
/**
* The querystring.encode() function is an alias for querystring.stringify().
*/
const encode: typeof stringify;
/**
* The querystring.decode() function is an alias for querystring.parse().
*/
const decode: typeof parse;
function escape(str: string): string;
function unescape(str: string): string;
}
declare module 'readline' {
import { Abortable, EventEmitter } from 'events';
interface Key {
sequence?: string;
name?: string;
ctrl?: boolean;
meta?: boolean;
shift?: boolean;
}
class Interface extends EventEmitter {
readonly terminal: boolean;
// Need direct access to line/cursor data, for use in external processes
// see: https://github.com/nodejs/node/issues/30347
/** The current input data */
readonly line: string;
/** The current cursor position in the input line */
readonly cursor: number;
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
protected constructor(options: ReadLineOptions);
getPrompt(): string;
setPrompt(prompt: string): void;
prompt(preserveCursor?: boolean): void;
question(query: string, callback: (answer: string) => void): void;
question(query: string, options: Abortable, callback: (answer: string) => void): void;
pause(): this;
resume(): this;
close(): void;
write(data: string | Buffer, key?: Key): void;
/**
* Returns the real position of the cursor in relation to the input
* prompt + string. Long input (wrapping) strings, as well as multiple
* line prompts are included in the calculations.
*/
getCursorPos(): CursorPos;
/**
* events.EventEmitter
* 1. close
* 2. line
* 3. pause
* 4. resume
* 5. SIGCONT
* 6. SIGINT
* 7. SIGTSTP
* 8. history
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "history", listener: (history: string[]) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "line", input: string): boolean;
emit(event: "pause"): boolean;
emit(event: "resume"): boolean;
emit(event: "SIGCONT"): boolean;
emit(event: "SIGINT"): boolean;
emit(event: "SIGTSTP"): boolean;
emit(event: "history", history: string[]): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "line", listener: (input: string) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: "SIGCONT", listener: () => void): this;
on(event: "SIGINT", listener: () => void): this;
on(event: "SIGTSTP", listener: () => void): this;
on(event: "history", listener: (history: string[]) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "line", listener: (input: string) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: "SIGCONT", listener: () => void): this;
once(event: "SIGINT", listener: () => void): this;
once(event: "SIGTSTP", listener: () => void): this;
once(event: "history", listener: (history: string[]) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "line", listener: (input: string) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: "SIGCONT", listener: () => void): this;
prependListener(event: "SIGINT", listener: () => void): this;
prependListener(event: "SIGTSTP", listener: () => void): this;
prependListener(event: "history", listener: (history: string[]) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "line", listener: (input: string) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: "SIGCONT", listener: () => void): this;
prependOnceListener(event: "SIGINT", listener: () => void): this;
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
prependOnceListener(event: "history", listener: (history: string[]) => void): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
}
type ReadLine = Interface; // type forwarded for backwards compatibility
type Completer = (line: string) => CompleterResult;
type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any;
type CompleterResult = [string[], string];
interface ReadLineOptions {
input: NodeJS.ReadableStream;
output?: NodeJS.WritableStream;
completer?: Completer | AsyncCompleter;
terminal?: boolean;
/**
* Initial list of history lines. This option makes sense
* only if `terminal` is set to `true` by the user or by an internal `output`
* check, otherwise the history caching mechanism is not initialized at all.
* @default []
*/
history?: string[];
historySize?: number;
prompt?: string;
crlfDelay?: number;
/**
* If `true`, when a new input line added
* to the history list duplicates an older one, this removes the older line
* from the list.
* @default false
*/
removeHistoryDuplicates?: boolean;
escapeCodeTimeout?: number;
tabSize?: number;
}
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
function createInterface(options: ReadLineOptions): Interface;
function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
type Direction = -1 | 0 | 1;
interface CursorPos {
rows: number;
cols: number;
}
/**
* Clears the current line of this WriteStream in a direction identified by `dir`.
*/
function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
/**
* Clears this `WriteStream` from the current cursor down.
*/
function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
/**
* Moves this WriteStream's cursor to the specified position.
*/
function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
/**
* Moves this WriteStream's cursor relative to its current position.
*/
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
}
declare module 'repl' {
import { Interface, Completer, AsyncCompleter } from 'readline';
import { Context } from 'vm';
import { InspectOptions } from 'util';
interface ReplOptions {
/**
* The input prompt to display.
* @default "> "
*/
prompt?: string;
/**
* The `Readable` stream from which REPL input will be read.
* @default process.stdin
*/
input?: NodeJS.ReadableStream;
/**
* The `Writable` stream to which REPL output will be written.
* @default process.stdout
*/
output?: NodeJS.WritableStream;
/**
* If `true`, specifies that the output should be treated as a TTY terminal, and have
* ANSI/VT100 escape codes written to it.
* Default: checking the value of the `isTTY` property on the output stream upon
* instantiation.
*/
terminal?: boolean;
/**
* The function to be used when evaluating each given line of input.
* Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
* additional lines.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
*/
eval?: REPLEval;
/**
* Defines if the repl prints output previews or not.
* @default `true` Always `false` in case `terminal` is falsy.
*/
preview?: boolean;
/**
* If `true`, specifies that the default `writer` function should include ANSI color
* styling to REPL output. If a custom `writer` function is provided then this has no
* effect.
* Default: the REPL instance's `terminal` value.
*/
useColors?: boolean;
/**
* If `true`, specifies that the default evaluation function will use the JavaScript
* `global` as the context as opposed to creating a new separate context for the REPL
* instance. The node CLI REPL sets this value to `true`.
* Default: `false`.
*/
useGlobal?: boolean;
/**
* If `true`, specifies that the default writer will not output the return value of a
* command if it evaluates to `undefined`.
* Default: `false`.
*/
ignoreUndefined?: boolean;
/**
* The function to invoke to format the output of each command before writing to `output`.
* Default: a wrapper for `util.inspect`.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
*/
writer?: REPLWriter;
/**
* An optional function used for custom Tab auto completion.
*
* @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
*/
completer?: Completer | AsyncCompleter;
/**
* A flag that specifies whether the default evaluator executes all JavaScript commands in
* strict mode or default (sloppy) mode.
* Accepted values are:
* - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
* - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
* prefacing every repl statement with `'use strict'`.
*/
replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
/**
* Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
* pressed. This cannot be used together with a custom `eval` function.
* Default: `false`.
*/
breakEvalOnSigint?: boolean;
}
type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
type REPLWriter = (this: REPLServer, obj: any) => string;
/**
* This is the default "writer" value, if none is passed in the REPL options,
* and it can be overridden by custom print functions.
*/
const writer: REPLWriter & { options: InspectOptions };
type REPLCommandAction = (this: REPLServer, text: string) => void;
interface REPLCommand {
/**
* Help text to be displayed when `.help` is entered.
*/
help?: string;
/**
* The function to execute, optionally accepting a single string argument.
*/
action: REPLCommandAction;
}
/**
* Provides a customizable Read-Eval-Print-Loop (REPL).
*
* Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those
* according to a user-defined evaluation function, then output the result. Input and output
* may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`.
*
* Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style
* line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session
* state, error recovery, and customizable evaluation functions.
*
* Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_
* be created directly using the JavaScript `new` keyword.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl
*/
class REPLServer extends Interface {
/**
* The `vm.Context` provided to the `eval` function to be used for JavaScript
* evaluation.
*/
readonly context: Context;
/**
* @deprecated since v14.3.0 - Use `input` instead.
*/
readonly inputStream: NodeJS.ReadableStream;
/**
* @deprecated since v14.3.0 - Use `output` instead.
*/
readonly outputStream: NodeJS.WritableStream;
/**
* The `Readable` stream from which REPL input will be read.
*/
readonly input: NodeJS.ReadableStream;
/**
* The `Writable` stream to which REPL output will be written.
*/
readonly output: NodeJS.WritableStream;
/**
* The commands registered via `replServer.defineCommand()`.
*/
readonly commands: NodeJS.ReadOnlyDict<REPLCommand>;
/**
* A value indicating whether the REPL is currently in "editor mode".
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
*/
readonly editorMode: boolean;
/**
* A value indicating whether the `_` variable has been assigned.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreAssigned: boolean;
/**
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly last: any;
/**
* A value indicating whether the `_error` variable has been assigned.
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreErrAssigned: boolean;
/**
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly lastError: any;
/**
* Specified in the REPL options, this is the function to be used when evaluating each
* given line of input. If not specified in the REPL options, this is an async wrapper
* for the JavaScript `eval()` function.
*/
readonly eval: REPLEval;
/**
* Specified in the REPL options, this is a value indicating whether the default
* `writer` function should include ANSI color styling to REPL output.
*/
readonly useColors: boolean;
/**
* Specified in the REPL options, this is a value indicating whether the default `eval`
* function will use the JavaScript `global` as the context as opposed to creating a new
* separate context for the REPL instance.
*/
readonly useGlobal: boolean;
/**
* Specified in the REPL options, this is a value indicating whether the default `writer`
* function should output the result of a command if it evaluates to `undefined`.
*/
readonly ignoreUndefined: boolean;
/**
* Specified in the REPL options, this is the function to invoke to format the output of
* each command before writing to `outputStream`. If not specified in the REPL options,
* this will be a wrapper for `util.inspect`.
*/
readonly writer: REPLWriter;
/**
* Specified in the REPL options, this is the function to use for custom Tab auto-completion.
*/
readonly completer: Completer | AsyncCompleter;
/**
* Specified in the REPL options, this is a flag that specifies whether the default `eval`
* function should execute all JavaScript commands in strict mode or default (sloppy) mode.
* Possible values are:
* - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
* - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
* prefacing every repl statement with `'use strict'`.
*/
readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
/**
* NOTE: According to the documentation:
*
* > Instances of `repl.REPLServer` are created using the `repl.start()` method and
* > _should not_ be created directly using the JavaScript `new` keyword.
*
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
*/
private constructor();
/**
* Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked
* by typing a `.` followed by the `keyword`.
*
* @param keyword The command keyword (_without_ a leading `.` character).
* @param cmd The function to invoke when the command is processed.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd
*/
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
/**
* Readies the REPL instance for input from the user, printing the configured `prompt` to a
* new line in the `output` and resuming the `input` to accept new input.
*
* When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'.
*
* This method is primarily intended to be called from within the action function for
* commands registered using the `replServer.defineCommand()` method.
*
* @param preserveCursor When `true`, the cursor placement will not be reset to `0`.
*/
displayPrompt(preserveCursor?: boolean): void;
/**
* Clears any command that has been buffered but not yet executed.
*
* This method is primarily intended to be called from within the action function for
* commands registered using the `replServer.defineCommand()` method.
*
* @since v9.0.0
*/
clearBufferedCommand(): void;
/**
* Initializes a history log file for the REPL instance. When executing the
* Node.js binary and using the command line REPL, a history file is initialized
* by default. However, this is not the case when creating a REPL
* programmatically. Use this method to initialize a history log file when working
* with REPL instances programmatically.
* @param path The path to the history file
*/
setupHistory(path: string, cb: (err: Error | null, repl: this) => void): void;
/**
* events.EventEmitter
* 1. close - inherited from `readline.Interface`
* 2. line - inherited from `readline.Interface`
* 3. pause - inherited from `readline.Interface`
* 4. resume - inherited from `readline.Interface`
* 5. SIGCONT - inherited from `readline.Interface`
* 6. SIGINT - inherited from `readline.Interface`
* 7. SIGTSTP - inherited from `readline.Interface`
* 8. exit
* 9. reset
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "exit", listener: () => void): this;
addListener(event: "reset", listener: (context: Context) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "line", input: string): boolean;
emit(event: "pause"): boolean;
emit(event: "resume"): boolean;
emit(event: "SIGCONT"): boolean;
emit(event: "SIGINT"): boolean;
emit(event: "SIGTSTP"): boolean;
emit(event: "exit"): boolean;
emit(event: "reset", context: Context): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "line", listener: (input: string) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: "SIGCONT", listener: () => void): this;
on(event: "SIGINT", listener: () => void): this;
on(event: "SIGTSTP", listener: () => void): this;
on(event: "exit", listener: () => void): this;
on(event: "reset", listener: (context: Context) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "line", listener: (input: string) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: "SIGCONT", listener: () => void): this;
once(event: "SIGINT", listener: () => void): this;
once(event: "SIGTSTP", listener: () => void): this;
once(event: "exit", listener: () => void): this;
once(event: "reset", listener: (context: Context) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "line", listener: (input: string) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: "SIGCONT", listener: () => void): this;
prependListener(event: "SIGINT", listener: () => void): this;
prependListener(event: "SIGTSTP", listener: () => void): this;
prependListener(event: "exit", listener: () => void): this;
prependListener(event: "reset", listener: (context: Context) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "line", listener: (input: string) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: "SIGCONT", listener: () => void): this;
prependOnceListener(event: "SIGINT", listener: () => void): this;
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
prependOnceListener(event: "exit", listener: () => void): this;
prependOnceListener(event: "reset", listener: (context: Context) => void): this;
}
/**
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
*/
const REPL_MODE_SLOPPY: unique symbol;
/**
* A flag passed in the REPL options. Evaluates expressions in strict mode.
* This is equivalent to prefacing every repl statement with `'use strict'`.
*/
const REPL_MODE_STRICT: unique symbol;
/**
* Creates and starts a `repl.REPLServer` instance.
*
* @param options The options for the `REPLServer`. If `options` is a string, then it specifies
* the input prompt.
*/
function start(options?: string | ReplOptions): REPLServer;
/**
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
*/
class Recoverable extends SyntaxError {
err: Error;
constructor(err: Error);
}
}
declare module 'stream' {
import { EventEmitter, Abortable } from 'events';
import * as streamPromises from "stream/promises";
class internal extends EventEmitter {
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
}
namespace internal {
class Stream extends internal {
constructor(opts?: ReadableOptions);
}
interface StreamOptions<T extends Stream> extends Abortable {
emitClose?: boolean;
highWaterMark?: number;
objectMode?: boolean;
construct?(this: T, callback: (error?: Error | null) => void): void;
destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void;
autoDestroy?: boolean;
}
interface ReadableOptions extends StreamOptions<Readable> {
encoding?: BufferEncoding;
read?(this: Readable, size: number): void;
}
class Readable extends Stream implements NodeJS.ReadableStream {
/**
* A utility method for creating Readable Streams out of iterators.
*/
static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
readable: boolean;
readonly readableEncoding: BufferEncoding | null;
readonly readableEnded: boolean;
readonly readableFlowing: boolean | null;
readonly readableHighWaterMark: number;
readonly readableLength: number;
readonly readableObjectMode: boolean;
destroyed: boolean;
constructor(opts?: ReadableOptions);
_construct?(callback: (error?: Error | null) => void): void;
_read(size: number): void;
read(size?: number): any;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
unpipe(destination?: NodeJS.WritableStream): this;
unshift(chunk: any, encoding?: BufferEncoding): void;
wrap(oldStream: NodeJS.ReadableStream): this;
push(chunk: any, encoding?: BufferEncoding): boolean;
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
destroy(error?: Error): void;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. data
* 3. end
* 4. error
* 5. pause
* 6. readable
* 7. resume
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "data", listener: (chunk: any) => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "readable", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "data", chunk: any): boolean;
emit(event: "end"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "pause"): boolean;
emit(event: "readable"): boolean;
emit(event: "resume"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "data", listener: (chunk: any) => void): this;
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "readable", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "data", listener: (chunk: any) => void): this;
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "readable", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "data", listener: (chunk: any) => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "readable", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "data", listener: (chunk: any) => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "readable", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: () => void): this;
removeListener(event: "data", listener: (chunk: any) => void): this;
removeListener(event: "end", listener: () => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: "pause", listener: () => void): this;
removeListener(event: "readable", listener: () => void): this;
removeListener(event: "resume", listener: () => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
}
interface WritableOptions extends StreamOptions<Writable> {
decodeStrings?: boolean;
defaultEncoding?: BufferEncoding;
write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
writev?(this: Writable, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
final?(this: Writable, callback: (error?: Error | null) => void): void;
}
class Writable extends Stream implements NodeJS.WritableStream {
readonly writable: boolean;
readonly writableEnded: boolean;
readonly writableFinished: boolean;
readonly writableHighWaterMark: number;
readonly writableLength: number;
readonly writableObjectMode: boolean;
readonly writableCorked: number;
destroyed: boolean;
constructor(opts?: WritableOptions);
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
_writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
_construct?(callback: (error?: Error | null) => void): void;
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
_final(callback: (error?: Error | null) => void): void;
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
write(chunk: any, encoding: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
setDefaultEncoding(encoding: BufferEncoding): this;
end(cb?: () => void): void;
end(chunk: any, cb?: () => void): void;
end(chunk: any, encoding: BufferEncoding, cb?: () => void): void;
cork(): void;
uncork(): void;
destroy(error?: Error): void;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. drain
* 3. error
* 4. finish
* 5. pipe
* 6. unpipe
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "pipe", listener: (src: Readable) => void): this;
addListener(event: "unpipe", listener: (src: Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "drain"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "finish"): boolean;
emit(event: "pipe", src: Readable): boolean;
emit(event: "unpipe", src: Readable): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "pipe", listener: (src: Readable) => void): this;
on(event: "unpipe", listener: (src: Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "drain", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "pipe", listener: (src: Readable) => void): this;
once(event: "unpipe", listener: (src: Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "pipe", listener: (src: Readable) => void): this;
prependListener(event: "unpipe", listener: (src: Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: () => void): this;
removeListener(event: "drain", listener: () => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: "finish", listener: () => void): this;
removeListener(event: "pipe", listener: (src: Readable) => void): this;
removeListener(event: "unpipe", listener: (src: Readable) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
interface DuplexOptions extends ReadableOptions, WritableOptions {
allowHalfOpen?: boolean;
readableObjectMode?: boolean;
writableObjectMode?: boolean;
readableHighWaterMark?: number;
writableHighWaterMark?: number;
writableCorked?: number;
construct?(this: Duplex, callback: (error?: Error | null) => void): void;
read?(this: Duplex, size: number): void;
write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
writev?(this: Duplex, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
final?(this: Duplex, callback: (error?: Error | null) => void): void;
destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void;
}
// Note: Duplex extends both Readable and Writable.
class Duplex extends Readable implements Writable {
readonly writable: boolean;
readonly writableEnded: boolean;
readonly writableFinished: boolean;
readonly writableHighWaterMark: number;
readonly writableLength: number;
readonly writableObjectMode: boolean;
readonly writableCorked: number;
constructor(opts?: DuplexOptions);
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
_writev?(chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
_final(callback: (error?: Error | null) => void): void;
write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
setDefaultEncoding(encoding: BufferEncoding): this;
end(cb?: () => void): void;
end(chunk: any, cb?: () => void): void;
end(chunk: any, encoding?: BufferEncoding, cb?: () => void): void;
cork(): void;
uncork(): void;
}
type TransformCallback = (error?: Error | null, data?: any) => void;
interface TransformOptions extends DuplexOptions {
construct?(this: Transform, callback: (error?: Error | null) => void): void;
read?(this: Transform, size: number): void;
write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
writev?(this: Transform, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
final?(this: Transform, callback: (error?: Error | null) => void): void;
destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void;
transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
flush?(this: Transform, callback: TransformCallback): void;
}
class Transform extends Duplex {
constructor(opts?: TransformOptions);
_transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
_flush(callback: TransformCallback): void;
}
class PassThrough extends Transform { }
/**
* Attaches an AbortSignal to a readable or writeable stream. This lets code
* control stream destruction using an `AbortController`.
*
* Calling `abort` on the `AbortController` corresponding to the passed
* `AbortSignal` will behave the same way as calling `.destroy(new AbortError())`
* on the stream.
*/
function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
interface FinishedOptions extends Abortable {
error?: boolean;
readable?: boolean;
writable?: boolean;
}
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
namespace finished {
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
}
type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
type PipelineTransform<S extends PipelineTransformSource<any>, U> =
NodeJS.ReadWriteStream |
((source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ?
AsyncIterable<ST> : S) => AsyncIterable<U>);
type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<P>;
type PipelineDestination<S extends PipelineTransformSource<any>, P> =
S extends PipelineTransformSource<infer ST> ?
(NodeJS.WritableStream | PipelineDestinationIterableFunction<ST> | PipelineDestinationPromiseFunction<ST, P>) : never;
type PipelineCallback<S extends PipelineDestination<any, any>> =
S extends PipelineDestinationPromiseFunction<any, infer P> ? (err: NodeJS.ErrnoException | null, value: P) => void :
(err: NodeJS.ErrnoException | null) => void;
type PipelinePromise<S extends PipelineDestination<any, any>> =
S extends PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
interface PipelineOptions {
signal: AbortSignal;
}
function pipeline<A extends PipelineSource<any>,
B extends PipelineDestination<A, any>>(
source: A,
destination: B,
callback?: PipelineCallback<B>
): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
B extends PipelineDestination<T1, any>>(
source: A,
transform1: T1,
destination: B,
callback?: PipelineCallback<B>
): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
B extends PipelineDestination<T2, any>>(
source: A,
transform1: T1,
transform2: T2,
destination: B,
callback?: PipelineCallback<B>
): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
B extends PipelineDestination<T3, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
destination: B,
callback?: PipelineCallback<B>
): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
T4 extends PipelineTransform<T3, any>,
B extends PipelineDestination<T4, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
transform4: T4,
destination: B,
callback?: PipelineCallback<B>
): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
function pipeline(
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
callback?: (err: NodeJS.ErrnoException | null) => void,
): NodeJS.WritableStream;
function pipeline(
stream1: NodeJS.ReadableStream,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)>,
): NodeJS.WritableStream;
namespace pipeline {
function __promisify__<A extends PipelineSource<any>,
B extends PipelineDestination<A, any>>(
source: A,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function __promisify__<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
B extends PipelineDestination<T1, any>>(
source: A,
transform1: T1,
destination: B,
options?: PipelineOptions,
): PipelinePromise<B>;
function __promisify__<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
B extends PipelineDestination<T2, any>>(
source: A,
transform1: T1,
transform2: T2,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function __promisify__<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
B extends PipelineDestination<T3, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function __promisify__<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
T4 extends PipelineTransform<T3, any>,
B extends PipelineDestination<T4, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
transform4: T4,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function __promisify__(
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
options?: PipelineOptions
): Promise<void>;
function __promisify__(
stream1: NodeJS.ReadableStream,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>,
): Promise<void>;
}
interface Pipe {
close(): void;
hasRef(): boolean;
ref(): void;
unref(): void;
}
const promises: typeof streamPromises;
}
export = internal;
}
declare module "stream/promises" {
import { FinishedOptions, PipelineSource, PipelineTransform,
PipelineDestination, PipelinePromise, PipelineOptions } from "stream";
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
function pipeline<A extends PipelineSource<any>,
B extends PipelineDestination<A, any>>(
source: A,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
B extends PipelineDestination<T1, any>>(
source: A,
transform1: T1,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
B extends PipelineDestination<T2, any>>(
source: A,
transform1: T1,
transform2: T2,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
B extends PipelineDestination<T3, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, any>,
T4 extends PipelineTransform<T3, any>,
B extends PipelineDestination<T4, any>>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
transform4: T4,
destination: B,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline(
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
options?: PipelineOptions
): Promise<void>;
function pipeline(
stream1: NodeJS.ReadableStream,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>,
): Promise<void>;
}
declare module 'string_decoder' {
class StringDecoder {
constructor(encoding?: BufferEncoding);
write(buffer: Buffer): string;
end(buffer?: Buffer): string;
}
}
declare module 'timers' {
import { Abortable } from 'events';
interface TimerOptions extends Abortable {
/**
* Set to `false` to indicate that the scheduled `Timeout`
* should not require the Node.js event loop to remain active.
* @default true
*/
ref?: boolean;
}
function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
namespace setTimeout {
function __promisify__(ms: number): Promise<void>;
function __promisify__<T>(ms: number, value: T, options?: TimerOptions): Promise<T>;
}
function clearTimeout(timeoutId: NodeJS.Timeout): void;
function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
function clearInterval(intervalId: NodeJS.Timeout): void;
function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
namespace setImmediate {
function __promisify__(): Promise<void>;
function __promisify__<T>(value: T, options?: TimerOptions): Promise<T>;
}
function clearImmediate(immediateId: NodeJS.Immediate): void;
}
declare module 'timers/promises' {
import { TimerOptions } from 'timers';
/**
* Returns a promise that resolves after the specified delay in milliseconds.
* @param delay defaults to 1
*/
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
/**
* Returns a promise that resolves in the next tick.
*/
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
/**
*
* Returns an async iterator that generates values in an interval of delay ms.
* @param delay defaults to 1
*/
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment