@types/node
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
declare module 'assert' { | ||
declare module "assert" { | ||
/** An alias of `assert.ok()`. */ | ||
@@ -10,3 +10,3 @@ function assert(value: any, message?: string | Error): asserts value; | ||
generatedMessage: boolean; | ||
code: 'ERR_ASSERTION'; | ||
code: "ERR_ASSERTION"; | ||
@@ -46,3 +46,3 @@ constructor(options?: { | ||
type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error; | ||
type AssertPredicate = RegExp | (new() => object) | ((thrown: any) => boolean) | object | Error; | ||
@@ -96,29 +96,31 @@ function fail(message?: string | Error): never; | ||
const strict: Omit< | ||
typeof assert, | ||
| 'equal' | ||
| 'notEqual' | ||
| 'deepEqual' | ||
| 'notDeepEqual' | ||
| 'ok' | ||
| 'strictEqual' | ||
| 'deepStrictEqual' | ||
| 'ifError' | ||
| 'strict' | ||
> & { | ||
(value: any, message?: string | Error): asserts value; | ||
equal: typeof strictEqual; | ||
notEqual: typeof notStrictEqual; | ||
deepEqual: typeof deepStrictEqual; | ||
notDeepEqual: typeof notDeepStrictEqual; | ||
const strict: | ||
& Omit< | ||
typeof assert, | ||
| "equal" | ||
| "notEqual" | ||
| "deepEqual" | ||
| "notDeepEqual" | ||
| "ok" | ||
| "strictEqual" | ||
| "deepStrictEqual" | ||
| "ifError" | ||
| "strict" | ||
> | ||
& { | ||
(value: any, message?: string | Error): asserts value; | ||
equal: typeof strictEqual; | ||
notEqual: typeof notStrictEqual; | ||
deepEqual: typeof deepStrictEqual; | ||
notDeepEqual: typeof notDeepStrictEqual; | ||
// Mapped types and assertion functions are incompatible? | ||
// TS2775: Assertions require every name in the call target | ||
// to be declared with an explicit type annotation. | ||
ok: typeof ok; | ||
strictEqual: typeof strictEqual; | ||
deepStrictEqual: typeof deepStrictEqual; | ||
ifError: typeof ifError; | ||
strict: typeof strict; | ||
}; | ||
// Mapped types and assertion functions are incompatible? | ||
// TS2775: Assertions require every name in the call target | ||
// to be declared with an explicit type annotation. | ||
ok: typeof ok; | ||
strictEqual: typeof strictEqual; | ||
deepStrictEqual: typeof deepStrictEqual; | ||
ifError: typeof ifError; | ||
strict: typeof strict; | ||
}; | ||
} | ||
@@ -128,5 +130,5 @@ | ||
} | ||
declare module 'node:assert' { | ||
import assert = require('assert'); | ||
declare module "node:assert" { | ||
import assert = require("assert"); | ||
export = assert; | ||
} |
/** | ||
* Async Hooks module: https://nodejs.org/api/async_hooks.html | ||
*/ | ||
declare module 'async_hooks' { | ||
declare module "async_hooks" { | ||
/** | ||
@@ -86,16 +86,16 @@ * Returns the asyncId of the current execution context. | ||
interface AsyncResourceOptions { | ||
/** | ||
* The ID of the execution context that created this async event. | ||
* @default executionAsyncId() | ||
*/ | ||
triggerAsyncId?: number | undefined; | ||
/** | ||
* The ID of the execution context that created this async event. | ||
* @default executionAsyncId() | ||
*/ | ||
triggerAsyncId?: number | undefined; | ||
/** | ||
* Disables automatic `emitDestroy` when the object is garbage collected. | ||
* This usually does not need to be set (even if `emitDestroy` is called | ||
* manually), unless the resource's `asyncId` is retrieved and the | ||
* sensitive API's `emitDestroy` is called with it. | ||
* @default false | ||
*/ | ||
requireManualDestroy?: boolean | undefined; | ||
/** | ||
* Disables automatic `emitDestroy` when the object is garbage collected. | ||
* This usually does not need to be set (even if `emitDestroy` is called | ||
* manually), unless the resource's `asyncId` is retrieved and the | ||
* sensitive API's `emitDestroy` is called with it. | ||
* @default false | ||
*/ | ||
requireManualDestroy?: boolean | undefined; | ||
} | ||
@@ -115,5 +115,5 @@ | ||
* this async event (default: `executionAsyncId()`), or an | ||
* AsyncResourceOptions object (since 9.3) | ||
* AsyncResourceOptions object (since v9.3.0) | ||
*/ | ||
constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); | ||
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); | ||
@@ -125,3 +125,6 @@ /** | ||
*/ | ||
static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource }; | ||
static bind<Func extends (...args: any[]) => any>( | ||
fn: Func, | ||
type?: string, | ||
): Func & { asyncResource: AsyncResource }; | ||
@@ -145,3 +148,7 @@ /** | ||
*/ | ||
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; | ||
runInAsyncScope<This, Result>( | ||
fn: (this: This, ...args: any[]) => Result, | ||
thisArg?: This, | ||
...args: any[] | ||
): Result; | ||
@@ -206,2 +213,3 @@ /** | ||
// TODO: Apply generic vararg once available | ||
run<R>(store: T, callback: () => R): R; | ||
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R; | ||
@@ -232,4 +240,4 @@ | ||
} | ||
declare module 'node:async_hooks' { | ||
export * from 'async_hooks'; | ||
declare module "node:async_hooks" { | ||
export * from "async_hooks"; | ||
} |
@@ -1,2 +0,3 @@ | ||
declare module 'buffer' { | ||
declare module "buffer" { | ||
import { BinaryLike } from "node:crypto"; | ||
export const INSPECT_MAX_BYTES: number; | ||
@@ -20,7 +21,70 @@ export const kMaxLength: number; | ||
}; | ||
/** | ||
* @experimental | ||
*/ | ||
export interface BlobOptions { | ||
/** | ||
* @default 'utf8' | ||
*/ | ||
encoding?: BufferEncoding | undefined; | ||
/** | ||
* The Blob content-type. The intent is for `type` to convey | ||
* the MIME media type of the data, however no validation of the type format | ||
* is performed. | ||
*/ | ||
type?: string | undefined; | ||
} | ||
/** | ||
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across | ||
* multiple worker threads. | ||
* @since v14.18.0 | ||
* @experimental | ||
*/ | ||
export class Blob { | ||
/** | ||
* The total size of the `Blob` in bytes. | ||
* @since v14.18.0 | ||
*/ | ||
readonly size: number; | ||
/** | ||
* The content-type of the `Blob`. | ||
* @since v14.18.0 | ||
*/ | ||
readonly type: string; | ||
/** | ||
* Creates a new `Blob` object containing a concatenation of the given sources. | ||
* | ||
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into | ||
* the 'Blob' and can therefore be safely modified after the 'Blob' is created. | ||
* | ||
* String sources are also copied into the `Blob`. | ||
*/ | ||
constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions); | ||
/** | ||
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of | ||
* the `Blob` data. | ||
* @since v14.18.0 | ||
*/ | ||
arrayBuffer(): Promise<ArrayBuffer>; | ||
/** | ||
* Creates and returns a new `Blob` containing a subset of this `Blob` objects | ||
* data. The original `Blob` is not altered. | ||
* @since v14.18.0 | ||
* @param start The starting index. | ||
* @param end The ending index. | ||
* @param type The content-type for the new `Blob` | ||
*/ | ||
slice(start?: number, end?: number, type?: string): Blob; | ||
/** | ||
* Returns a promise that fulfills with the contents of the `Blob` decoded as a | ||
* UTF-8 string. | ||
* @since v14.18.0 | ||
*/ | ||
text(): Promise<string>; | ||
} | ||
export { BuffType as Buffer }; | ||
} | ||
declare module 'node:buffer' { | ||
export * from 'buffer'; | ||
declare module "node:buffer" { | ||
export * from "buffer"; | ||
} |
@@ -1,6 +0,6 @@ | ||
declare module 'child_process' { | ||
import { BaseEncodingOptions } from 'fs'; | ||
import * as events from 'events'; | ||
import * as net from 'net'; | ||
import { Writable, Readable, Stream, Pipe } from 'stream'; | ||
declare module "child_process" { | ||
import { BaseEncodingOptions } from "fs"; | ||
import * as events from "events"; | ||
import * as net from "net"; | ||
import { Pipe, Readable, Stream, Writable } from "stream"; | ||
@@ -20,3 +20,3 @@ type Serializable = string | object | number | boolean; | ||
Readable | Writable | null | undefined, // extra | ||
Readable | Writable | null | undefined // extra | ||
Readable | Writable | null | undefined, // extra | ||
]; | ||
@@ -33,3 +33,8 @@ readonly killed: boolean; | ||
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; | ||
send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; | ||
send( | ||
message: Serializable, | ||
sendHandle?: SendHandle, | ||
options?: MessageOptions, | ||
callback?: (error: Error | null) => void, | ||
): boolean; | ||
disconnect(): void; | ||
@@ -84,6 +89,12 @@ unref(): void; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; | ||
prependOnceListener( | ||
event: "close", | ||
listener: (code: number | null, signal: NodeJS.Signals | null) => void, | ||
): this; | ||
prependOnceListener(event: "disconnect", listener: () => void): this; | ||
prependOnceListener(event: "error", listener: (err: Error) => void): this; | ||
prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; | ||
prependOnceListener( | ||
event: "exit", | ||
listener: (code: number | null, signal: NodeJS.Signals | null) => void, | ||
): this; | ||
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; | ||
@@ -102,3 +113,3 @@ } | ||
Readable | Writable | null | undefined, // extra, no modification | ||
Readable | Writable | null | undefined // extra, no modification | ||
Readable | Writable | null | undefined, // extra, no modification | ||
]; | ||
@@ -121,3 +132,3 @@ } | ||
Readable | Writable | null | undefined, // extra, no modification | ||
Readable | Writable | null | undefined // extra, no modification | ||
Readable | Writable | null | undefined, // extra, no modification | ||
]; | ||
@@ -130,5 +141,9 @@ } | ||
type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>; | ||
type StdioOptions = | ||
| "pipe" | ||
| "ignore" | ||
| "inherit" | ||
| Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>; | ||
type SerializationType = 'json' | 'advanced'; | ||
type SerializationType = "json" | "advanced"; | ||
@@ -152,3 +167,3 @@ interface MessagingOptions { | ||
/** | ||
* @default true | ||
* @default false | ||
*/ | ||
@@ -164,2 +179,11 @@ windowsHide?: boolean | undefined; | ||
argv0?: string | undefined; | ||
/** | ||
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. | ||
* If passed as an array, the first element is used for `stdin`, the second for | ||
* `stdout`, and the third for `stderr`. A fourth element can be used to | ||
* specify the `stdio` behavior beyond the standard streams. See | ||
* {@link ChildProcess.stdio} for more information. | ||
* | ||
* @default 'pipe' | ||
*/ | ||
stdio?: StdioOptions | undefined; | ||
@@ -175,7 +199,7 @@ shell?: boolean | string | undefined; | ||
interface SpawnOptionsWithoutStdio extends SpawnOptions { | ||
stdio?: 'pipe' | Array<null | undefined | 'pipe'> | undefined; | ||
stdio?: "pipe" | Array<null | undefined | "pipe"> | undefined; | ||
} | ||
type StdioNull = 'inherit' | 'ignore' | Stream; | ||
type StdioPipe = undefined | null | 'pipe'; | ||
type StdioNull = "inherit" | "ignore" | Stream; | ||
type StdioPipe = undefined | null | "pipe"; | ||
@@ -229,3 +253,7 @@ interface SpawnOptionsWithStdioTuple< | ||
// overloads of spawn with 'args' | ||
function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; | ||
function spawn( | ||
command: string, | ||
args?: ReadonlyArray<string>, | ||
options?: SpawnOptionsWithoutStdio, | ||
): ChildProcessWithoutNullStreams; | ||
@@ -297,9 +325,20 @@ function spawn( | ||
// no `options` definitely means stdout/stderr are `string`. | ||
function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function exec( | ||
command: string, | ||
callback?: (error: ExecException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. | ||
function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; | ||
function exec( | ||
command: string, | ||
options: { encoding: "buffer" | null } & ExecOptions, | ||
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, | ||
): ChildProcess; | ||
// `options` with well known `encoding` means stdout/stderr are definitely `string`. | ||
function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function exec( | ||
command: string, | ||
options: { encoding: BufferEncoding } & ExecOptions, | ||
callback?: (error: ExecException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
@@ -315,3 +354,7 @@ // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. | ||
// `options` without an `encoding` means stdout/stderr are definitely `string`. | ||
function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function exec( | ||
command: string, | ||
options: ExecOptions, | ||
callback?: (error: ExecException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
@@ -331,7 +374,19 @@ // fallback if nothing else matches. Worst case is always `string | Buffer`. | ||
namespace exec { | ||
function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; | ||
function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; | ||
function __promisify__(command: string): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
command: string, | ||
options: { encoding: "buffer" | null } & ExecOptions, | ||
): PromiseWithChild<{ stdout: Buffer; stderr: Buffer }>; | ||
function __promisify__( | ||
command: string, | ||
options: { encoding: BufferEncoding } & ExecOptions, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
command: string, | ||
options: ExecOptions, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
command: string, | ||
options?: (BaseEncodingOptions & ExecOptions) | null, | ||
): PromiseWithChild<{ stdout: string | Buffer; stderr: string | Buffer }>; | ||
} | ||
@@ -349,3 +404,3 @@ | ||
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { | ||
encoding: 'buffer' | null; | ||
encoding: "buffer" | null; | ||
} | ||
@@ -355,3 +410,6 @@ interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { | ||
} | ||
type ExecFileException = ExecException & NodeJS.ErrnoException; | ||
type ExecFileException = | ||
& Omit<ExecException, "code"> | ||
& Omit<NodeJS.ErrnoException, "code"> | ||
& { code?: string | number | undefined | null }; | ||
@@ -361,12 +419,27 @@ function execFile(file: string): ChildProcess; | ||
function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess; | ||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; | ||
function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, | ||
): ChildProcess; | ||
// no `options` definitely means stdout/stderr are `string`. | ||
function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function execFile( | ||
file: string, | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. | ||
function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; | ||
function execFile( | ||
file: string, | ||
options: ExecFileOptionsWithBufferEncoding, | ||
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, | ||
): ChildProcess; | ||
function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
@@ -378,5 +451,9 @@ options: ExecFileOptionsWithBufferEncoding, | ||
// `options` with well known `encoding` means stdout/stderr are definitely `string`. | ||
function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function execFile( | ||
file: string, | ||
options: ExecFileOptionsWithStringEncoding, | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
@@ -402,8 +479,12 @@ options: ExecFileOptionsWithStringEncoding, | ||
// `options` without an `encoding` means stdout/stderr are definitely `string`. | ||
function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; | ||
function execFile( | ||
file: string, | ||
options: ExecFileOptions, | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: ExecFileOptions, | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void | ||
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, | ||
): ChildProcess; | ||
@@ -415,3 +496,6 @@ | ||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, | ||
callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, | ||
callback: | ||
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | ||
| undefined | ||
| null, | ||
): ChildProcess; | ||
@@ -422,3 +506,6 @@ function execFile( | ||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, | ||
callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null, | ||
callback: | ||
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | ||
| undefined | ||
| null, | ||
): ChildProcess; | ||
@@ -428,22 +515,52 @@ | ||
namespace execFile { | ||
function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; | ||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>; | ||
function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; | ||
function __promisify__(file: string): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
options: ExecFileOptionsWithBufferEncoding, | ||
): PromiseWithChild<{ stdout: Buffer; stderr: Buffer }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: ExecFileOptionsWithBufferEncoding, | ||
): PromiseWithChild<{ stdout: Buffer; stderr: Buffer }>; | ||
function __promisify__( | ||
file: string, | ||
options: ExecFileOptionsWithStringEncoding, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: ExecFileOptionsWithStringEncoding, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
options: ExecFileOptionsWithOtherEncoding, | ||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; | ||
function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>; | ||
function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; | ||
): PromiseWithChild<{ stdout: string | Buffer; stderr: string | Buffer }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: ExecFileOptionsWithOtherEncoding, | ||
): PromiseWithChild<{ stdout: string | Buffer; stderr: string | Buffer }>; | ||
function __promisify__( | ||
file: string, | ||
options: ExecFileOptions, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: ExecFileOptions, | ||
): PromiseWithChild<{ stdout: string; stderr: string }>; | ||
function __promisify__( | ||
file: string, | ||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, | ||
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>; | ||
): PromiseWithChild<{ stdout: string | Buffer; stderr: string | Buffer }>; | ||
function __promisify__( | ||
file: string, | ||
args: ReadonlyArray<string> | undefined | null, | ||
options: (BaseEncodingOptions & ExecFileOptions) | undefined | null, | ||
): PromiseWithChild<{ stdout: string | Buffer; stderr: string | Buffer }>; | ||
} | ||
@@ -455,2 +572,11 @@ | ||
silent?: boolean | undefined; | ||
/** | ||
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. | ||
* If passed as an array, the first element is used for `stdin`, the second for | ||
* `stdout`, and the third for `stderr`. A fourth element can be used to | ||
* specify the `stdio` behavior beyond the standard streams. See | ||
* {@link ChildProcess.stdio} for more information. | ||
* | ||
* @default 'pipe' | ||
*/ | ||
stdio?: StdioOptions | undefined; | ||
@@ -467,3 +593,3 @@ detached?: boolean | undefined; | ||
maxBuffer?: number | undefined; | ||
encoding?: BufferEncoding | 'buffer' | null | undefined; | ||
encoding?: BufferEncoding | "buffer" | null | undefined; | ||
} | ||
@@ -474,3 +600,3 @@ interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { | ||
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { | ||
encoding?: 'buffer' | null | undefined; | ||
encoding?: "buffer" | null | undefined; | ||
} | ||
@@ -490,8 +616,29 @@ interface SpawnSyncReturns<T> { | ||
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>; | ||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>; | ||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>; | ||
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>; | ||
function spawnSync( | ||
command: string, | ||
args?: ReadonlyArray<string>, | ||
options?: SpawnSyncOptionsWithStringEncoding, | ||
): SpawnSyncReturns<string>; | ||
function spawnSync( | ||
command: string, | ||
args?: ReadonlyArray<string>, | ||
options?: SpawnSyncOptionsWithBufferEncoding, | ||
): SpawnSyncReturns<Buffer>; | ||
function spawnSync( | ||
command: string, | ||
args?: ReadonlyArray<string>, | ||
options?: SpawnSyncOptions, | ||
): SpawnSyncReturns<string | Buffer>; | ||
interface ExecSyncOptions extends CommonOptions { | ||
input?: string | Uint8Array | undefined; | ||
/** | ||
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. | ||
* If passed as an array, the first element is used for `stdin`, the second for | ||
* `stdout`, and the third for `stderr`. A fourth element can be used to | ||
* specify the `stdio` behavior beyond the standard streams. See | ||
* {@link ChildProcess.stdio} for more information. | ||
* | ||
* @default 'pipe' | ||
*/ | ||
stdio?: StdioOptions | undefined; | ||
@@ -501,3 +648,3 @@ shell?: string | undefined; | ||
maxBuffer?: number | undefined; | ||
encoding?: BufferEncoding | 'buffer' | null | undefined; | ||
encoding?: BufferEncoding | "buffer" | null | undefined; | ||
} | ||
@@ -508,3 +655,3 @@ interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { | ||
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { | ||
encoding?: 'buffer' | null | undefined; | ||
encoding?: "buffer" | null | undefined; | ||
} | ||
@@ -518,2 +665,11 @@ function execSync(command: string): Buffer; | ||
input?: string | NodeJS.ArrayBufferView | undefined; | ||
/** | ||
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. | ||
* If passed as an array, the first element is used for `stdin`, the second for | ||
* `stdout`, and the third for `stderr`. A fourth element can be used to | ||
* specify the `stdio` behavior beyond the standard streams. See | ||
* {@link ChildProcess.stdio} for more information. | ||
* | ||
* @default 'pipe' | ||
*/ | ||
stdio?: StdioOptions | undefined; | ||
@@ -536,8 +692,20 @@ killSignal?: NodeJS.Signals | number | undefined; | ||
function execFileSync(command: string, args: ReadonlyArray<string>): Buffer; | ||
function execFileSync(command: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithStringEncoding): string; | ||
function execFileSync(command: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; | ||
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer; | ||
function execFileSync( | ||
command: string, | ||
args: ReadonlyArray<string>, | ||
options: ExecFileSyncOptionsWithStringEncoding, | ||
): string; | ||
function execFileSync( | ||
command: string, | ||
args: ReadonlyArray<string>, | ||
options: ExecFileSyncOptionsWithBufferEncoding, | ||
): Buffer; | ||
function execFileSync( | ||
command: string, | ||
args?: ReadonlyArray<string>, | ||
options?: ExecFileSyncOptions, | ||
): string | Buffer; | ||
} | ||
declare module 'node:child_process' { | ||
export * from 'child_process'; | ||
declare module "node:child_process" { | ||
export * from "child_process"; | ||
} |
@@ -1,7 +0,8 @@ | ||
declare module 'cluster' { | ||
import * as child from 'child_process'; | ||
import EventEmitter = require('events'); | ||
import * as net from 'net'; | ||
declare module "cluster" { | ||
import * as child from "child_process"; | ||
import EventEmitter = require("events"); | ||
import * as net from "net"; | ||
// interfaces | ||
type SerializationType = "json" | "advanced"; | ||
interface ClusterSettings { | ||
@@ -16,2 +17,5 @@ execArgv?: string[] | undefined; // default: process.execArgv | ||
inspectPort?: number | (() => number) | undefined; | ||
serialization?: SerializationType | undefined; | ||
cwd?: string | undefined; | ||
windowsHide?: boolean | undefined; | ||
} | ||
@@ -22,3 +26,3 @@ | ||
port: number; | ||
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" | ||
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" | ||
} | ||
@@ -29,3 +33,7 @@ | ||
process: child.ChildProcess; | ||
send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean; | ||
send( | ||
message: child.Serializable, | ||
sendHandle?: child.SendHandle, | ||
callback?: (error: Error | null) => void, | ||
): boolean; | ||
kill(signal?: string): void; | ||
@@ -52,3 +60,3 @@ destroy(signal?: string): void; | ||
addListener(event: "listening", listener: (address: Address) => void): this; | ||
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
addListener(event: "online", listener: () => void): this; | ||
@@ -69,3 +77,3 @@ | ||
on(event: "listening", listener: (address: Address) => void): this; | ||
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
on(event: "online", listener: () => void): this; | ||
@@ -78,3 +86,3 @@ | ||
once(event: "listening", listener: (address: Address) => void): this; | ||
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
once(event: "online", listener: () => void): this; | ||
@@ -87,3 +95,3 @@ | ||
prependListener(event: "listening", listener: (address: Address) => void): this; | ||
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependListener(event: "online", listener: () => void): this; | ||
@@ -96,3 +104,3 @@ | ||
prependOnceListener(event: "listening", listener: (address: Address) => void): this; | ||
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependOnceListener(event: "online", listener: () => void): this; | ||
@@ -131,3 +139,6 @@ } | ||
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; | ||
addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
addListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
addListener(event: "online", listener: (worker: Worker) => void): this; | ||
@@ -150,3 +161,3 @@ addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; | ||
on(event: "listening", listener: (worker: Worker, address: Address) => void): this; | ||
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
on(event: "online", listener: (worker: Worker) => void): this; | ||
@@ -160,3 +171,3 @@ on(event: "setup", listener: (settings: ClusterSettings) => void): this; | ||
once(event: "listening", listener: (worker: Worker, address: Address) => void): this; | ||
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
once(event: "online", listener: (worker: Worker) => void): this; | ||
@@ -170,3 +181,6 @@ once(event: "setup", listener: (settings: ClusterSettings) => void): this; | ||
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; | ||
prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): this; // the handle is a net.Socket or net.Server object, or undefined. | ||
prependListener(event: "online", listener: (worker: Worker) => void): this; | ||
@@ -181,3 +195,6 @@ prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; | ||
prependOnceListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): this; | ||
prependOnceListener(event: "online", listener: (worker: Worker) => void): this; | ||
@@ -215,4 +232,7 @@ prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; | ||
function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function addListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): Cluster; | ||
function addListener(event: "online", listener: (worker: Worker) => void): Cluster; | ||
@@ -235,3 +255,6 @@ function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; | ||
function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; | ||
function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. | ||
function on( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): Cluster; // the handle is a net.Socket or net.Server object, or undefined. | ||
function on(event: "online", listener: (worker: Worker) => void): Cluster; | ||
@@ -245,3 +268,6 @@ function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; | ||
function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; | ||
function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined. | ||
function once( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): Cluster; // the handle is a net.Socket or net.Server object, or undefined. | ||
function once(event: "online", listener: (worker: Worker) => void): Cluster; | ||
@@ -262,4 +288,7 @@ function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; | ||
function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function prependListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): Cluster; | ||
function prependListener(event: "online", listener: (worker: Worker) => void): Cluster; | ||
@@ -270,7 +299,13 @@ function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; | ||
function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster; | ||
function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster; | ||
function prependOnceListener( | ||
event: "exit", | ||
listener: (worker: Worker, code: number, signal: string) => void, | ||
): Cluster; | ||
function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster; | ||
function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; | ||
// the handle is a net.Socket or net.Server object, or undefined. | ||
function prependOnceListener( | ||
event: "message", | ||
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, | ||
): Cluster; | ||
function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster; | ||
@@ -281,4 +316,4 @@ function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster; | ||
} | ||
declare module 'node:cluster' { | ||
export * from 'cluster'; | ||
declare module "node:cluster" { | ||
export * from "cluster"; | ||
} |
@@ -1,7 +0,7 @@ | ||
declare module 'console' { | ||
import console = require('node:console'); | ||
declare module "console" { | ||
import console = require("node:console"); | ||
export = console; | ||
} | ||
declare module 'node:console' { | ||
import { InspectOptions } from 'util'; | ||
declare module "node:console" { | ||
import { InspectOptions } from "util"; | ||
@@ -120,3 +120,3 @@ global { | ||
ignoreErrors?: boolean | undefined; | ||
colorMode?: boolean | 'auto' | undefined; | ||
colorMode?: boolean | "auto" | undefined; | ||
inspectOptions?: InspectOptions | undefined; | ||
@@ -127,3 +127,3 @@ /** | ||
*/ | ||
groupIndentation?: number | undefined; | ||
groupIndentation?: number | undefined; | ||
} | ||
@@ -130,0 +130,0 @@ |
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ | ||
declare module 'constants' { | ||
import { constants as osConstants, SignalConstants } from 'os'; | ||
import { constants as cryptoConstants } from 'crypto'; | ||
import { constants as fsConstants } from 'fs'; | ||
declare module "constants" { | ||
import { constants as osConstants, SignalConstants } from "os"; | ||
import { constants as cryptoConstants } from "crypto"; | ||
import { constants as fsConstants } from "fs"; | ||
const exp: typeof osConstants.errno & | ||
typeof osConstants.priority & | ||
SignalConstants & | ||
typeof cryptoConstants & | ||
typeof fsConstants; | ||
const exp: | ||
& typeof osConstants.errno | ||
& typeof osConstants.priority | ||
& SignalConstants | ||
& typeof cryptoConstants | ||
& typeof fsConstants; | ||
export = exp; | ||
} | ||
declare module 'node:constants' { | ||
import constants = require('constants'); | ||
declare module "node:constants" { | ||
import constants = require("constants"); | ||
export = constants; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'crypto' { | ||
import * as stream from 'stream'; | ||
declare module "crypto" { | ||
import * as stream from "stream"; | ||
@@ -27,3 +27,3 @@ interface Certificate { | ||
/** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */ | ||
new (): Certificate; | ||
new(): Certificate; | ||
/** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */ | ||
@@ -144,9 +144,9 @@ (): Certificate; | ||
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings | ||
type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex'; | ||
type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1'; | ||
type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2'; | ||
type BinaryToTextEncoding = "base64" | "base64url" | "hex"; | ||
type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1"; | ||
type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; | ||
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; | ||
type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid'; | ||
type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; | ||
@@ -169,6 +169,6 @@ class Hash extends stream.Transform { | ||
type KeyObjectType = 'secret' | 'public' | 'private'; | ||
type KeyObjectType = "secret" | "public" | "private"; | ||
interface KeyExportOptions<T extends KeyFormat> { | ||
type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; | ||
type: "pkcs1" | "spki" | "pkcs8" | "sec1"; | ||
format: T; | ||
@@ -187,4 +187,4 @@ cipher?: string | undefined; | ||
asymmetricKeySize?: number | undefined; | ||
export(options: KeyExportOptions<'pem'>): string | Buffer; | ||
export(options?: KeyExportOptions<'der'>): Buffer; | ||
export(options: KeyExportOptions<"pem">): string | Buffer; | ||
export(options?: KeyExportOptions<"der">): Buffer; | ||
symmetricKeySize?: number | undefined; | ||
@@ -194,4 +194,5 @@ type: KeyObjectType; | ||
type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305'; | ||
type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; | ||
type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305"; | ||
type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm"; | ||
type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb"; | ||
@@ -208,2 +209,5 @@ type BinaryLike = string | NodeJS.ArrayBufferView; | ||
} | ||
interface CipherOCBOptions extends stream.TransformOptions { | ||
authTagLength: number; | ||
} | ||
/** @deprecated since v10.0.0 use `createCipheriv()` */ | ||
@@ -219,9 +223,15 @@ function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; | ||
key: CipherKey, | ||
iv: BinaryLike | null, | ||
iv: BinaryLike, | ||
options: CipherCCMOptions, | ||
): CipherCCM; | ||
function createCipheriv( | ||
algorithm: CipherOCBTypes, | ||
key: CipherKey, | ||
iv: BinaryLike, | ||
options: CipherOCBOptions, | ||
): CipherOCB; | ||
function createCipheriv( | ||
algorithm: CipherGCMTypes, | ||
key: CipherKey, | ||
iv: BinaryLike | null, | ||
iv: BinaryLike, | ||
options?: CipherGCMOptions, | ||
@@ -256,2 +266,6 @@ ): CipherGCM; | ||
} | ||
interface CipherOCB extends Cipher { | ||
setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; | ||
getAuthTag(): Buffer; | ||
} | ||
/** @deprecated since v10.0.0 use `createDecipheriv()` */ | ||
@@ -267,9 +281,15 @@ function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; | ||
key: CipherKey, | ||
iv: BinaryLike | null, | ||
iv: BinaryLike, | ||
options: CipherCCMOptions, | ||
): DecipherCCM; | ||
function createDecipheriv( | ||
algorithm: CipherOCBTypes, | ||
key: CipherKey, | ||
iv: BinaryLike, | ||
options: CipherOCBOptions, | ||
): DecipherOCB; | ||
function createDecipheriv( | ||
algorithm: CipherGCMTypes, | ||
key: CipherKey, | ||
iv: BinaryLike | null, | ||
iv: BinaryLike, | ||
options?: CipherGCMOptions, | ||
@@ -304,2 +324,6 @@ ): DecipherGCM; | ||
} | ||
interface DecipherOCB extends Decipher { | ||
setAuthTag(buffer: NodeJS.ArrayBufferView): this; | ||
setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this; | ||
} | ||
@@ -309,3 +333,3 @@ interface PrivateKeyInput { | ||
format?: KeyFormat | undefined; | ||
type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined; | ||
type?: "pkcs1" | "pkcs8" | "sec1" | undefined; | ||
passphrase?: string | Buffer | undefined; | ||
@@ -317,3 +341,3 @@ } | ||
format?: KeyFormat | undefined; | ||
type?: 'pkcs1' | 'spki' | undefined; | ||
type?: "pkcs1" | "spki" | undefined; | ||
} | ||
@@ -325,9 +349,9 @@ | ||
function createSign(algorithm: string, options?: stream.WritableOptions): Signer; | ||
function createSign(algorithm: string, options?: stream.WritableOptions): Sign; | ||
type DSAEncoding = 'der' | 'ieee-p1363'; | ||
type DSAEncoding = "der" | "ieee-p1363"; | ||
interface SigningOptions { | ||
/** | ||
* @See crypto.constants.RSA_PKCS1_PADDING | ||
* @see crypto.constants.RSA_PKCS1_PADDING | ||
*/ | ||
@@ -350,7 +374,7 @@ padding?: number | undefined; | ||
class Signer extends stream.Writable { | ||
class Sign extends stream.Writable { | ||
private constructor(); | ||
update(data: BinaryLike): Signer; | ||
update(data: string, input_encoding: Encoding): Signer; | ||
update(data: BinaryLike): Sign; | ||
update(data: string, input_encoding: Encoding): Sign; | ||
sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; | ||
@@ -399,6 +423,10 @@ sign( | ||
generateKeys(encoding: BinaryToTextEncoding): string; | ||
computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer; | ||
computeSecret(other_public_key: string, input_encoding: BinaryToTextEncoding): Buffer; | ||
computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: BinaryToTextEncoding): string; | ||
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; | ||
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; | ||
computeSecret( | ||
otherPublicKey: NodeJS.ArrayBufferView, | ||
inputEncoding: null, | ||
outputEncoding: BinaryToTextEncoding, | ||
): string; | ||
computeSecret( | ||
other_public_key: string, | ||
@@ -422,3 +450,38 @@ input_encoding: BinaryToTextEncoding, | ||
} | ||
function getDiffieHellman(group_name: string): DiffieHellman; | ||
/** | ||
* The `DiffieHellmanGroup` class takes a well-known modp group as its argument. | ||
* It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. | ||
* In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. | ||
* | ||
* ```js | ||
* const { createDiffieHellmanGroup } = await import('node:crypto'); | ||
* const dh = createDiffieHellmanGroup('modp1'); | ||
* ``` | ||
* The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): | ||
* ```bash | ||
* $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h | ||
* modp1 # 768 bits | ||
* modp2 # 1024 bits | ||
* modp5 # 1536 bits | ||
* modp14 # 2048 bits | ||
* modp15 # etc. | ||
* modp16 | ||
* modp17 | ||
* modp18 | ||
* ``` | ||
* @since v0.7.5 | ||
*/ | ||
const DiffieHellmanGroup: DiffieHellmanGroupConstructor; | ||
interface DiffieHellmanGroupConstructor { | ||
new(name: string): DiffieHellmanGroup; | ||
(name: string): DiffieHellmanGroup; | ||
readonly prototype: DiffieHellmanGroup; | ||
} | ||
type DiffieHellmanGroup = Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">; | ||
function getDiffieHellman(groupName: string): DiffieHellmanGroup; | ||
/** | ||
* An alias for {@link getDiffieHellman} | ||
* @since v0.9.3 | ||
*/ | ||
function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; | ||
function pbkdf2( | ||
@@ -478,5 +541,5 @@ password: BinaryLike, | ||
} | ||
type UUID = `${string}-${string}-${string}-${string}-${string}`; | ||
function randomUUID(options?: RandomUUIDOptions): UUID; | ||
function randomUUID(options?: RandomUUIDOptions): string; | ||
interface ScryptOptions { | ||
@@ -527,2 +590,8 @@ cost?: number | undefined; | ||
function getFips(): 1 | 0; | ||
/** | ||
* Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available. | ||
* @since v10.0.0 | ||
* @param bool `true` to enable FIPS mode. | ||
*/ | ||
function setFips(bool: boolean): void; | ||
function getHashes(): string[]; | ||
@@ -535,4 +604,4 @@ class ECDH { | ||
inputEncoding?: BinaryToTextEncoding, | ||
outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url', | ||
format?: 'uncompressed' | 'compressed' | 'hybrid', | ||
outputEncoding?: "latin1" | "hex" | "base64" | "base64url", | ||
format?: "uncompressed" | "compressed" | "hybrid", | ||
): Buffer | string; | ||
@@ -561,4 +630,4 @@ generateKeys(): Buffer; | ||
type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; | ||
type KeyFormat = 'pem' | 'der'; | ||
type KeyType = "rsa" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; | ||
type KeyFormat = "pem" | "der"; | ||
@@ -642,7 +711,7 @@ interface BasePrivateKeyEncodingOptions<T extends KeyFormat> { | ||
publicKeyEncoding: { | ||
type: 'pkcs1' | 'spki'; | ||
type: "pkcs1" | "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs1' | 'pkcs8'; | ||
type: "pkcs1" | "pkcs8"; | ||
}; | ||
@@ -662,7 +731,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'spki'; | ||
type: "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs8'; | ||
type: "pkcs8"; | ||
}; | ||
@@ -678,7 +747,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'pkcs1' | 'spki'; | ||
type: "pkcs1" | "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'sec1' | 'pkcs8'; | ||
type: "sec1" | "pkcs8"; | ||
}; | ||
@@ -689,7 +758,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'spki'; | ||
type: "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs8'; | ||
type: "pkcs8"; | ||
}; | ||
@@ -700,7 +769,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'spki'; | ||
type: "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs8'; | ||
type: "pkcs8"; | ||
}; | ||
@@ -711,7 +780,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'spki'; | ||
type: "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs8'; | ||
type: "pkcs8"; | ||
}; | ||
@@ -722,7 +791,7 @@ } | ||
publicKeyEncoding: { | ||
type: 'spki'; | ||
type: "spki"; | ||
format: PubF; | ||
}; | ||
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & { | ||
type: 'pkcs8'; | ||
type: "pkcs8"; | ||
}; | ||
@@ -737,149 +806,149 @@ } | ||
function generateKeyPairSync( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "pem">, | ||
): KeyPairSyncResult<string, string>; | ||
function generateKeyPairSync( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "der">, | ||
): KeyPairSyncResult<string, Buffer>; | ||
function generateKeyPairSync( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "pem">, | ||
): KeyPairSyncResult<Buffer, string>; | ||
function generateKeyPairSync( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "der">, | ||
): KeyPairSyncResult<Buffer, Buffer>; | ||
function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; | ||
function generateKeyPair( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'rsa', | ||
type: "rsa", | ||
options: RSAKeyPairKeyObjectOptions, | ||
@@ -890,23 +959,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'dsa', | ||
type: "dsa", | ||
options: DSAKeyPairKeyObjectOptions, | ||
@@ -917,23 +986,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ec', | ||
type: "ec", | ||
options: ECKeyPairKeyObjectOptions, | ||
@@ -944,23 +1013,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed25519', | ||
type: "ed25519", | ||
options: ED25519KeyPairKeyObjectOptions | undefined, | ||
@@ -971,23 +1040,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'ed448', | ||
type: "ed448", | ||
options: ED448KeyPairKeyObjectOptions | undefined, | ||
@@ -998,23 +1067,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x25519', | ||
type: "x25519", | ||
options: X25519KeyPairKeyObjectOptions | undefined, | ||
@@ -1025,23 +1094,23 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function generateKeyPair( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "pem">, | ||
callback: (err: Error | null, publicKey: string, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "der">, | ||
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "pem">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "der">, | ||
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, | ||
): void; | ||
function generateKeyPair( | ||
type: 'x448', | ||
type: "x448", | ||
options: X448KeyPairKeyObjectOptions | undefined, | ||
@@ -1053,73 +1122,73 @@ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, | ||
function __promisify__( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'pem', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'pem'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'rsa', | ||
options: RSAKeyPairOptions<'der', 'der'>, | ||
type: "rsa", | ||
options: RSAKeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'pem', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'pem'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'dsa', | ||
options: DSAKeyPairOptions<'der', 'der'>, | ||
type: "dsa", | ||
options: DSAKeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'pem', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'pem'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ec', | ||
options: ECKeyPairOptions<'der', 'der'>, | ||
type: "ec", | ||
options: ECKeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'pem', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'pem'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ed25519', | ||
options: ED25519KeyPairOptions<'der', 'der'>, | ||
type: "ed25519", | ||
options: ED25519KeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'ed25519', | ||
type: "ed25519", | ||
options?: ED25519KeyPairKeyObjectOptions, | ||
@@ -1129,37 +1198,37 @@ ): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'pem', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'pem'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'ed448', | ||
options: ED448KeyPairOptions<'der', 'der'>, | ||
type: "ed448", | ||
options: ED448KeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'pem', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'pem'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'x25519', | ||
options: X25519KeyPairOptions<'der', 'der'>, | ||
type: "x25519", | ||
options: X25519KeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'x25519', | ||
type: "x25519", | ||
options?: X25519KeyPairKeyObjectOptions, | ||
@@ -1169,18 +1238,18 @@ ): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "pem">, | ||
): Promise<{ publicKey: string; privateKey: string }>; | ||
function __promisify__( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'pem', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"pem", "der">, | ||
): Promise<{ publicKey: string; privateKey: Buffer }>; | ||
function __promisify__( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'pem'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "pem">, | ||
): Promise<{ publicKey: Buffer; privateKey: string }>; | ||
function __promisify__( | ||
type: 'x448', | ||
options: X448KeyPairOptions<'der', 'der'>, | ||
type: "x448", | ||
options: X448KeyPairOptions<"der", "der">, | ||
): Promise<{ publicKey: Buffer; privateKey: Buffer }>; | ||
function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; | ||
} | ||
@@ -1223,5 +1292,34 @@ | ||
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; | ||
/** | ||
* Load and set the `engine` for some or all OpenSSL functions (selected by flags). | ||
* | ||
* `engine` could be either an id or a path to the engine's shared library. | ||
* | ||
* The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. | ||
* The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`): | ||
* | ||
* - `crypto.constants.ENGINE_METHOD_RSA` | ||
* - `crypto.constants.ENGINE_METHOD_DSA` | ||
* - `crypto.constants.ENGINE_METHOD_DH` | ||
* - `crypto.constants.ENGINE_METHOD_RAND` | ||
* - `crypto.constants.ENGINE_METHOD_EC` | ||
* - `crypto.constants.ENGINE_METHOD_CIPHERS` | ||
* - `crypto.constants.ENGINE_METHOD_DIGESTS` | ||
* - `crypto.constants.ENGINE_METHOD_PKEY_METHS` | ||
* - `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` | ||
* - `crypto.constants.ENGINE_METHOD_ALL` | ||
* - `crypto.constants.ENGINE_METHOD_NONE` | ||
* | ||
* The flags below are deprecated in OpenSSL-1.1.0. | ||
* | ||
* - `crypto.constants.ENGINE_METHOD_ECDH` | ||
* - `crypto.constants.ENGINE_METHOD_ECDSA` | ||
* - `crypto.constants.ENGINE_METHOD_STORE` | ||
* @since v0.11.11 | ||
* @param [flags=crypto.constants.ENGINE_METHOD_ALL] | ||
*/ | ||
function setEngine(engine: string, flags?: number): void; | ||
} | ||
declare module 'node:crypto' { | ||
export * from 'crypto'; | ||
declare module "node:crypto" { | ||
export * from "crypto"; | ||
} |
@@ -1,9 +0,9 @@ | ||
declare module 'dgram' { | ||
import { AddressInfo } from 'net'; | ||
import * as dns from 'dns'; | ||
import EventEmitter = require('events'); | ||
declare module "dgram" { | ||
import { AddressInfo } from "net"; | ||
import * as dns from "dns"; | ||
import EventEmitter = require("events"); | ||
interface RemoteInfo { | ||
address: string; | ||
family: 'IPv4' | 'IPv6'; | ||
family: "IPv4" | "IPv6"; | ||
port: number; | ||
@@ -31,3 +31,9 @@ size: number; | ||
sendBufferSize?: number | undefined; | ||
lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined; | ||
lookup?: | ||
| (( | ||
hostname: string, | ||
options: dns.LookupOneOptions, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, | ||
) => void) | ||
| undefined; | ||
} | ||
@@ -54,8 +60,38 @@ | ||
remoteAddress(): AddressInfo; | ||
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; | ||
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void; | ||
send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void; | ||
send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; | ||
send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; | ||
send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; | ||
send( | ||
msg: string | Uint8Array | ReadonlyArray<any>, | ||
port?: number, | ||
address?: string, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
send( | ||
msg: string | Uint8Array | ReadonlyArray<any>, | ||
port?: number, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
send( | ||
msg: string | Uint8Array | ReadonlyArray<any>, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
send( | ||
msg: string | Uint8Array, | ||
offset: number, | ||
length: number, | ||
port?: number, | ||
address?: string, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
send( | ||
msg: string | Uint8Array, | ||
offset: number, | ||
length: number, | ||
port?: number, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
send( | ||
msg: string | Uint8Array, | ||
offset: number, | ||
length: number, | ||
callback?: (error: Error | null, bytes: number) => void, | ||
): void; | ||
setBroadcast(flag: boolean): void; | ||
@@ -144,4 +180,4 @@ setMulticastInterface(multicastInterface: string): void; | ||
} | ||
declare module 'node:dgram' { | ||
export * from 'dgram'; | ||
declare module "node:dgram" { | ||
export * from "dgram"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'dns' { | ||
declare module "dns" { | ||
// Supported getaddrinfo flags. | ||
@@ -31,7 +31,26 @@ const ADDRCONFIG: number; | ||
function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; | ||
function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; | ||
function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; | ||
function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; | ||
function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; | ||
function lookup( | ||
hostname: string, | ||
family: number, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, | ||
): void; | ||
function lookup( | ||
hostname: string, | ||
options: LookupOneOptions, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, | ||
): void; | ||
function lookup( | ||
hostname: string, | ||
options: LookupAllOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, | ||
): void; | ||
function lookup( | ||
hostname: string, | ||
options: LookupOptions, | ||
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, | ||
): void; | ||
function lookup( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, | ||
): void; | ||
@@ -45,6 +64,10 @@ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. | ||
function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; | ||
function lookupService( | ||
address: string, | ||
port: number, | ||
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, | ||
): void; | ||
namespace lookupService { | ||
function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; | ||
function __promisify__(address: string, port: number): Promise<{ hostname: string; service: string }>; | ||
} | ||
@@ -143,29 +166,80 @@ | ||
type AnyRecord = AnyARecord | | ||
AnyAaaaRecord | | ||
AnyCnameRecord | | ||
AnyMxRecord | | ||
AnyNaptrRecord | | ||
AnyNsRecord | | ||
AnyPtrRecord | | ||
AnySoaRecord | | ||
AnySrvRecord | | ||
AnyTxtRecord; | ||
type AnyRecord = | ||
| AnyARecord | ||
| AnyAaaaRecord | ||
| AnyCnameRecord | ||
| AnyMxRecord | ||
| AnyNaptrRecord | ||
| AnyNsRecord | ||
| AnyPtrRecord | ||
| AnySoaRecord | ||
| AnySrvRecord | ||
| AnyTxtRecord; | ||
function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; | ||
function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; | ||
function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; | ||
function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; | ||
function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; | ||
function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; | ||
function resolve( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "A", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "AAAA", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "ANY", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "CNAME", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "MX", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "NAPTR", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "NS", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "PTR", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "SOA", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "SRV", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: "TXT", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, | ||
): void; | ||
function resolve( | ||
hostname: string, | ||
rrtype: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, | ||
callback: ( | ||
err: NodeJS.ErrnoException | null, | ||
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[], | ||
) => void, | ||
): void; | ||
@@ -182,8 +256,22 @@ | ||
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>; | ||
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; | ||
function __promisify__( | ||
hostname: string, | ||
rrtype: string, | ||
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; | ||
} | ||
function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; | ||
function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; | ||
function resolve4( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve4( | ||
hostname: string, | ||
options: ResolveWithTtlOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, | ||
): void; | ||
function resolve4( | ||
hostname: string, | ||
options: ResolveOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, | ||
): void; | ||
@@ -197,5 +285,16 @@ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. | ||
function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; | ||
function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; | ||
function resolve6( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
function resolve6( | ||
hostname: string, | ||
options: ResolveWithTtlOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, | ||
): void; | ||
function resolve6( | ||
hostname: string, | ||
options: ResolveOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, | ||
): void; | ||
@@ -209,3 +308,6 @@ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. | ||
function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolveCname( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
namespace resolveCname { | ||
@@ -215,3 +317,6 @@ function __promisify__(hostname: string): Promise<string[]>; | ||
function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; | ||
function resolveMx( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, | ||
): void; | ||
namespace resolveMx { | ||
@@ -221,3 +326,6 @@ function __promisify__(hostname: string): Promise<MxRecord[]>; | ||
function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; | ||
function resolveNaptr( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, | ||
): void; | ||
namespace resolveNaptr { | ||
@@ -227,3 +335,6 @@ function __promisify__(hostname: string): Promise<NaptrRecord[]>; | ||
function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolveNs( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
namespace resolveNs { | ||
@@ -233,3 +344,6 @@ function __promisify__(hostname: string): Promise<string[]>; | ||
function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; | ||
function resolvePtr( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, | ||
): void; | ||
namespace resolvePtr { | ||
@@ -239,3 +353,6 @@ function __promisify__(hostname: string): Promise<string[]>; | ||
function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; | ||
function resolveSoa( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, | ||
): void; | ||
namespace resolveSoa { | ||
@@ -245,3 +362,6 @@ function __promisify__(hostname: string): Promise<SoaRecord>; | ||
function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; | ||
function resolveSrv( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, | ||
): void; | ||
namespace resolveSrv { | ||
@@ -251,3 +371,6 @@ function __promisify__(hostname: string): Promise<SrvRecord[]>; | ||
function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; | ||
function resolveTxt( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, | ||
): void; | ||
namespace resolveTxt { | ||
@@ -257,3 +380,6 @@ function __promisify__(hostname: string): Promise<string[][]>; | ||
function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; | ||
function resolveAny( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, | ||
): void; | ||
namespace resolveAny { | ||
@@ -267,3 +393,3 @@ function __promisify__(hostname: string): Promise<AnyRecord[]>; | ||
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; | ||
function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; | ||
@@ -330,3 +456,3 @@ // Error codes | ||
function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>; | ||
function lookupService(address: string, port: number): Promise<{ hostname: string; service: string }>; | ||
@@ -345,3 +471,6 @@ function resolve(hostname: string): Promise<string[]>; | ||
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>; | ||
function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; | ||
function resolve( | ||
hostname: string, | ||
rrtype: string, | ||
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; | ||
@@ -378,3 +507,3 @@ function resolve4(hostname: string): Promise<string[]>; | ||
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; | ||
function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; | ||
@@ -403,4 +532,4 @@ class Resolver { | ||
} | ||
declare module 'node:dns' { | ||
export * from 'dns'; | ||
declare module "node:dns" { | ||
export * from "dns"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'domain' { | ||
import EventEmitter = require('events'); | ||
declare module "domain" { | ||
import EventEmitter = require("events"); | ||
@@ -25,4 +25,4 @@ global { | ||
} | ||
declare module 'node:domain' { | ||
export * from 'domain'; | ||
declare module "node:domain" { | ||
export * from "domain"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'events' { | ||
declare module "events" { | ||
interface EventEmitterOptions { | ||
@@ -48,3 +48,3 @@ /** | ||
import internal = require('events'); | ||
import internal = require("events"); | ||
namespace EventEmitter { | ||
@@ -80,5 +80,5 @@ // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 | ||
} | ||
declare module 'node:events' { | ||
import events = require('events'); | ||
declare module "node:events" { | ||
import events = require("events"); | ||
export = events; | ||
} |
@@ -1,20 +0,21 @@ | ||
declare module 'fs/promises' { | ||
declare module "fs/promises" { | ||
import { | ||
Stats, | ||
BaseEncodingOptions, | ||
BigIntStats, | ||
StatOptions, | ||
WriteVResult, | ||
BufferEncodingOption, | ||
constants as fsConstants, | ||
Dir, | ||
Dirent, | ||
MakeDirectoryOptions, | ||
Mode, | ||
OpenDirOptions, | ||
OpenMode, | ||
PathLike, | ||
ReadVResult, | ||
PathLike, | ||
RmDirOptions, | ||
RmOptions, | ||
MakeDirectoryOptions, | ||
Dirent, | ||
OpenDirOptions, | ||
Dir, | ||
BaseEncodingOptions, | ||
BufferEncodingOption, | ||
OpenMode, | ||
Mode, | ||
} from 'fs'; | ||
StatOptions, | ||
Stats, | ||
WriteVResult, | ||
} from "fs"; | ||
@@ -37,3 +38,9 @@ interface FileHandle { | ||
*/ | ||
appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>; | ||
appendFile( | ||
data: string | Uint8Array, | ||
options?: | ||
| BaseEncodingOptions & { mode?: Mode | undefined; flag?: OpenMode | undefined } | ||
| BufferEncoding | ||
| null, | ||
): Promise<void>; | ||
@@ -69,3 +76,8 @@ /** | ||
*/ | ||
read<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; | ||
read<TBuffer extends Uint8Array>( | ||
buffer: TBuffer, | ||
offset?: number | null, | ||
length?: number | null, | ||
position?: number | null, | ||
): Promise<{ bytesRead: number; buffer: TBuffer }>; | ||
@@ -78,3 +90,3 @@ /** | ||
*/ | ||
readFile(options?: { encoding?: null | undefined, flag?: OpenMode | undefined } | null): Promise<Buffer>; | ||
readFile(options?: { encoding?: null | undefined; flag?: OpenMode | undefined } | null): Promise<Buffer>; | ||
@@ -87,3 +99,3 @@ /** | ||
*/ | ||
readFile(options: { encoding: BufferEncoding, flag?: OpenMode | undefined } | BufferEncoding): Promise<string>; | ||
readFile(options: { encoding: BufferEncoding; flag?: OpenMode | undefined } | BufferEncoding): Promise<string>; | ||
@@ -96,3 +108,5 @@ /** | ||
*/ | ||
readFile(options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>; | ||
readFile( | ||
options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null, | ||
): Promise<string | Buffer>; | ||
@@ -127,3 +141,8 @@ /** | ||
*/ | ||
write<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; | ||
write<TBuffer extends Uint8Array>( | ||
buffer: TBuffer, | ||
offset?: number | null, | ||
length?: number | null, | ||
position?: number | null, | ||
): Promise<{ bytesWritten: number; buffer: TBuffer }>; | ||
@@ -139,3 +158,7 @@ /** | ||
*/ | ||
write(data: string | Uint8Array, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>; | ||
write( | ||
data: string | Uint8Array, | ||
position?: number | null, | ||
encoding?: BufferEncoding | null, | ||
): Promise<{ bytesWritten: number; buffer: string }>; | ||
@@ -153,3 +176,9 @@ /** | ||
*/ | ||
writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>; | ||
writeFile( | ||
data: string | Uint8Array, | ||
options?: | ||
| BaseEncodingOptions & { mode?: Mode | undefined; flag?: OpenMode | undefined } | ||
| BufferEncoding | ||
| null, | ||
): Promise<void>; | ||
@@ -172,2 +201,4 @@ /** | ||
const constants: typeof fsConstants; | ||
/** | ||
@@ -196,6 +227,7 @@ * Asynchronously tests a user's permissions for the file specified by path. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not | ||
* @param [flags='r'] See `support of file system `flags``. | ||
* @param [mode] A file mode. If a string is passed, it is parsed as an octal integer. If not | ||
* supplied, defaults to `0o666`. | ||
*/ | ||
function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>; | ||
function open(path: PathLike, flags?: string | number, mode?: string | number): Promise<FileHandle>; | ||
@@ -217,3 +249,3 @@ /** | ||
position?: number | null, | ||
): Promise<{ bytesRead: number, buffer: TBuffer }>; | ||
): Promise<{ bytesRead: number; buffer: TBuffer }>; | ||
@@ -234,3 +266,5 @@ /** | ||
offset?: number | null, | ||
length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; | ||
length?: number | null, | ||
position?: number | null, | ||
): Promise<{ bytesWritten: number; buffer: TBuffer }>; | ||
@@ -246,3 +280,8 @@ /** | ||
*/ | ||
function write(handle: FileHandle, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>; | ||
function write( | ||
handle: FileHandle, | ||
string: string, | ||
position?: number | null, | ||
encoding?: BufferEncoding | null, | ||
): Promise<{ bytesWritten: number; buffer: string }>; | ||
@@ -301,3 +340,3 @@ /** | ||
*/ | ||
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>; | ||
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }): Promise<string | undefined>; | ||
@@ -310,3 +349,6 @@ /** | ||
*/ | ||
function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>; | ||
function mkdir( | ||
path: PathLike, | ||
options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null, | ||
): Promise<void>; | ||
@@ -326,3 +368,6 @@ /** | ||
*/ | ||
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>; | ||
function readdir( | ||
path: PathLike, | ||
options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null, | ||
): Promise<string[]>; | ||
@@ -334,3 +379,6 @@ /** | ||
*/ | ||
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Promise<Buffer[]>; | ||
function readdir( | ||
path: PathLike, | ||
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer", | ||
): Promise<Buffer[]>; | ||
@@ -342,3 +390,6 @@ /** | ||
*/ | ||
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>; | ||
function readdir( | ||
path: PathLike, | ||
options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null, | ||
): Promise<string[] | Buffer[]>; | ||
@@ -534,3 +585,6 @@ /** | ||
data: string | Uint8Array, | ||
options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null | ||
options?: | ||
| BaseEncodingOptions & { mode?: Mode | undefined; flag?: OpenMode | undefined } | ||
| BufferEncoding | ||
| null, | ||
): Promise<void>; | ||
@@ -553,3 +607,6 @@ | ||
data: string | Uint8Array, | ||
options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null | ||
options?: | ||
| BaseEncodingOptions & { mode?: Mode | undefined; flag?: OpenMode | undefined } | ||
| BufferEncoding | ||
| null, | ||
): Promise<void>; | ||
@@ -564,3 +621,6 @@ | ||
*/ | ||
function readFile(path: PathLike | FileHandle, options?: { encoding?: null | undefined, flag?: OpenMode | undefined } | null): Promise<Buffer>; | ||
function readFile( | ||
path: PathLike | FileHandle, | ||
options?: { encoding?: null | undefined; flag?: OpenMode | undefined } | null, | ||
): Promise<Buffer>; | ||
@@ -574,3 +634,6 @@ /** | ||
*/ | ||
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode | undefined } | BufferEncoding): Promise<string>; | ||
function readFile( | ||
path: PathLike | FileHandle, | ||
options: { encoding: BufferEncoding; flag?: OpenMode | undefined } | BufferEncoding, | ||
): Promise<string>; | ||
@@ -584,8 +647,11 @@ /** | ||
*/ | ||
function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>; | ||
function readFile( | ||
path: PathLike | FileHandle, | ||
options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null, | ||
): Promise<string | Buffer>; | ||
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>; | ||
} | ||
declare module 'node:fs/promises' { | ||
export * from 'fs/promises'; | ||
declare module "node:fs/promises" { | ||
export * from "fs/promises"; | ||
} |
@@ -55,5 +55,5 @@ // Declare "static" methods in Error | ||
} | ||
declare function clearTimeout(timeoutId: NodeJS.Timeout): void; | ||
declare function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; | ||
declare function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout; | ||
declare function clearInterval(intervalId: NodeJS.Timeout): void; | ||
declare function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; | ||
declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; | ||
@@ -64,3 +64,3 @@ declare namespace setImmediate { | ||
} | ||
declare function clearImmediate(immediateId: NodeJS.Immediate): void; | ||
declare function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; | ||
@@ -76,7 +76,63 @@ declare function queueMicrotask(callback: () => void): void; | ||
// Buffer class | ||
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"; | ||
type BufferEncoding = | ||
| "ascii" | ||
| "utf8" | ||
| "utf-8" | ||
| "utf16le" | ||
| "ucs2" | ||
| "ucs-2" | ||
| "base64" | ||
| "base64url" | ||
| "latin1" | ||
| "binary" | ||
| "hex"; | ||
type WithImplicitCoercion<T> = T | { valueOf(): T }; | ||
// #region borrowed | ||
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib | ||
/** | ||
* A controller object that allows you to abort one or more DOM requests as and when desired. | ||
* @since v14.7.0 | ||
*/ | ||
interface AbortController { | ||
/** | ||
* Returns the AbortSignal object associated with this object. | ||
* @since v14.7.0 | ||
*/ | ||
readonly signal: AbortSignal; | ||
/** | ||
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. | ||
* @since v14.7.0 | ||
*/ | ||
abort(reason?: any): void; | ||
} | ||
/** | ||
* A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. | ||
* @since v14.7.0 | ||
*/ | ||
interface AbortSignal { | ||
/** | ||
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. | ||
* @since v14.7.0 | ||
*/ | ||
readonly aborted: boolean; | ||
readonly reason: any; | ||
} | ||
declare var AbortController: { | ||
prototype: AbortController; | ||
new(): AbortController; | ||
}; | ||
declare var AbortSignal: { | ||
prototype: AbortSignal; | ||
new(): AbortSignal; | ||
abort(reason?: any): AbortSignal; | ||
timeout(milliseconds: number): AbortSignal; | ||
}; | ||
// #endregion borrowed | ||
/** | ||
* Raw data is stored in instances of the Buffer class. | ||
@@ -113,3 +169,2 @@ * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. | ||
* | ||
* | ||
* @param arrayBuffer The ArrayBuffer with which to share memory. | ||
@@ -141,3 +196,7 @@ * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. | ||
*/ | ||
static from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer; | ||
static from( | ||
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, | ||
byteOffset?: number, | ||
length?: number, | ||
): Buffer; | ||
/** | ||
@@ -154,3 +213,6 @@ * Creates a new Buffer using the passed {data} | ||
*/ | ||
static from(str: WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: 'string'): string }, encoding?: BufferEncoding): Buffer; | ||
static from( | ||
str: WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: "string"): string }, | ||
encoding?: BufferEncoding, | ||
): Buffer; | ||
/** | ||
@@ -183,3 +245,3 @@ * Creates a new Buffer using the passed {data} | ||
string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, | ||
encoding?: BufferEncoding | ||
encoding?: BufferEncoding, | ||
): number; | ||
@@ -210,3 +272,3 @@ /** | ||
*/ | ||
static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; | ||
static alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; | ||
/** | ||
@@ -235,3 +297,3 @@ * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents | ||
toString(encoding?: BufferEncoding, start?: number, end?: number): string; | ||
toJSON(): { type: 'Buffer'; data: number[] }; | ||
toJSON(): { type: "Buffer"; data: number[] }; | ||
equals(otherBuffer: Uint8Array): boolean; | ||
@@ -243,3 +305,3 @@ compare( | ||
sourceStart?: number, | ||
sourceEnd?: number | ||
sourceEnd?: number, | ||
): number; | ||
@@ -268,20 +330,85 @@ copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; | ||
writeBigUInt64BE(value: bigint, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeBigUInt64BE | ||
* @since v14.10.0, v12.19.0 | ||
*/ | ||
writeBigUint64BE(value: bigint, offset?: number): number; | ||
writeBigUInt64LE(value: bigint, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeBigUInt64LE | ||
* @since v14.10.0, v12.19.0 | ||
*/ | ||
writeBigUint64LE(value: bigint, offset?: number): number; | ||
writeUIntLE(value: number, offset: number, byteLength: number): number; | ||
/** | ||
* @alias Buffer.writeUIntLE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUintLE(value: number, offset: number, byteLength: number): number; | ||
writeUIntBE(value: number, offset: number, byteLength: number): number; | ||
/** | ||
* @alias Buffer.writeUIntBE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUintBE(value: number, offset: number, byteLength: number): number; | ||
writeIntLE(value: number, offset: number, byteLength: number): number; | ||
writeIntBE(value: number, offset: number, byteLength: number): number; | ||
readBigUInt64BE(offset?: number): bigint; | ||
/** | ||
* @alias Buffer.readBigUInt64BE | ||
* @since v14.10.0, v12.19.0 | ||
*/ | ||
readBigUint64BE(offset?: number): bigint; | ||
readBigUInt64LE(offset?: number): bigint; | ||
/** | ||
* @alias Buffer.readBigUInt64LE | ||
* @since v14.10.0, v12.19.0 | ||
*/ | ||
readBigUint64LE(offset?: number): bigint; | ||
readBigInt64BE(offset?: number): bigint; | ||
readBigInt64LE(offset?: number): bigint; | ||
readUIntLE(offset: number, byteLength: number): number; | ||
/** | ||
* @alias Buffer.readUIntLE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUintLE(offset: number, byteLength: number): number; | ||
readUIntBE(offset: number, byteLength: number): number; | ||
/** | ||
* @alias Buffer.readUIntBE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUintBE(offset: number, byteLength: number): number; | ||
readIntLE(offset: number, byteLength: number): number; | ||
readIntBE(offset: number, byteLength: number): number; | ||
readUInt8(offset?: number): number; | ||
/** | ||
* @alias Buffer.readUInt8 | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUint8(offset?: number): number; | ||
readUInt16LE(offset?: number): number; | ||
/** | ||
* @alias Buffer.readUInt16LE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUint16LE(offset?: number): number; | ||
readUInt16BE(offset?: number): number; | ||
/** | ||
* @alias Buffer.readUInt16BE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUint16BE(offset?: number): number; | ||
readUInt32LE(offset?: number): number; | ||
/** | ||
* @alias Buffer.readUInt32LE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUint32LE(offset?: number): number; | ||
readUInt32BE(offset?: number): number; | ||
/** | ||
* @alias Buffer.readUInt32BE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
readUint32BE(offset?: number): number; | ||
readInt8(offset?: number): number; | ||
@@ -301,6 +428,31 @@ readInt16LE(offset?: number): number; | ||
writeUInt8(value: number, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeUInt8 | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUint8(value: number, offset?: number): number; | ||
writeUInt16LE(value: number, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeUInt16LE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUint16LE(value: number, offset?: number): number; | ||
writeUInt16BE(value: number, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeUInt16BE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUint16BE(value: number, offset?: number): number; | ||
writeUInt32LE(value: number, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeUInt32LE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUint32LE(value: number, offset?: number): number; | ||
writeUInt32BE(value: number, offset?: number): number; | ||
/** | ||
* @alias Buffer.writeUInt32BE | ||
* @since v14.9.0, v12.19.0 | ||
*/ | ||
writeUint32BE(value: number, offset?: number): number; | ||
writeInt8(value: number, offset?: number): number; | ||
@@ -341,3 +493,3 @@ writeInt16LE(value: number, offset?: number): number; | ||
*/ | ||
getters?: 'get' | 'set' | boolean | undefined; | ||
getters?: "get" | "set" | boolean | undefined; | ||
showHidden?: boolean | undefined; | ||
@@ -409,3 +561,3 @@ /** | ||
*/ | ||
getFileName(): string | null; | ||
getFileName(): string | undefined; | ||
@@ -463,3 +615,3 @@ /** | ||
isPaused(): boolean; | ||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T; | ||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T; | ||
unpipe(destination?: WritableStream): this; | ||
@@ -480,3 +632,3 @@ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; | ||
interface ReadWriteStream extends ReadableStream, WritableStream { } | ||
interface ReadWriteStream extends ReadableStream, WritableStream {} | ||
@@ -595,3 +747,3 @@ interface Global { | ||
interface RequireResolve { | ||
(id: string, options?: { paths?: string[] | undefined; }): string; | ||
(id: string, options?: { paths?: string[] | undefined }): string; | ||
paths(request: string): string[] | null; | ||
@@ -601,5 +753,5 @@ } | ||
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { | ||
'.js': (m: Module, filename: string) => any; | ||
'.json': (m: Module, filename: string) => any; | ||
'.node': (m: Module, filename: string) => any; | ||
".js": (m: Module, filename: string) => any; | ||
".json": (m: Module, filename: string) => any; | ||
".node": (m: Module, filename: string) => any; | ||
} | ||
@@ -612,7 +764,7 @@ interface Module { | ||
loaded: boolean; | ||
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */ | ||
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ | ||
parent: Module | null | undefined; | ||
children: Module[]; | ||
/** | ||
* @since 11.14.0 | ||
* @since v11.14.0 | ||
* | ||
@@ -619,0 +771,0 @@ * The directory name of the module. This is usually the same as the path.dirname() of the module.id. |
@@ -1,71 +0,72 @@ | ||
declare module 'http' { | ||
import * as stream from 'stream'; | ||
import { URL } from 'url'; | ||
import { Socket, Server as NetServer, LookupFunction } from 'net'; | ||
declare module "http" { | ||
import * as stream from "stream"; | ||
import { URL } from "url"; | ||
import { EventEmitter } from "events"; | ||
import { LookupFunction, Server as NetServer, Socket } from "net"; | ||
// incoming headers will never contain number | ||
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> { | ||
'accept'?: string | undefined; | ||
'accept-language'?: string | undefined; | ||
'accept-patch'?: string | undefined; | ||
'accept-ranges'?: string | undefined; | ||
'access-control-allow-credentials'?: string | undefined; | ||
'access-control-allow-headers'?: string | undefined; | ||
'access-control-allow-methods'?: string | undefined; | ||
'access-control-allow-origin'?: string | undefined; | ||
'access-control-expose-headers'?: string | undefined; | ||
'access-control-max-age'?: string | undefined; | ||
'access-control-request-headers'?: string | undefined; | ||
'access-control-request-method'?: string | undefined; | ||
'age'?: string | undefined; | ||
'allow'?: string | undefined; | ||
'alt-svc'?: string | undefined; | ||
'authorization'?: string | undefined; | ||
'cache-control'?: string | undefined; | ||
'connection'?: string | undefined; | ||
'content-disposition'?: string | undefined; | ||
'content-encoding'?: string | undefined; | ||
'content-language'?: string | undefined; | ||
'content-length'?: string | undefined; | ||
'content-location'?: string | undefined; | ||
'content-range'?: string | undefined; | ||
'content-type'?: string | undefined; | ||
'cookie'?: string | undefined; | ||
'date'?: string | undefined; | ||
'etag'?: string | undefined; | ||
'expect'?: string | undefined; | ||
'expires'?: string | undefined; | ||
'forwarded'?: string | undefined; | ||
'from'?: string | undefined; | ||
'host'?: string | undefined; | ||
'if-match'?: string | undefined; | ||
'if-modified-since'?: string | undefined; | ||
'if-none-match'?: string | undefined; | ||
'if-unmodified-since'?: string | undefined; | ||
'last-modified'?: string | undefined; | ||
'location'?: string | undefined; | ||
'origin'?: string | undefined; | ||
'pragma'?: string | undefined; | ||
'proxy-authenticate'?: string | undefined; | ||
'proxy-authorization'?: string | undefined; | ||
'public-key-pins'?: string | undefined; | ||
'range'?: string | undefined; | ||
'referer'?: string | undefined; | ||
'retry-after'?: string | undefined; | ||
'sec-websocket-accept'?: string | undefined; | ||
'sec-websocket-extensions'?: string | undefined; | ||
'sec-websocket-key'?: string | undefined; | ||
'sec-websocket-protocol'?: string | undefined; | ||
'sec-websocket-version'?: string | undefined; | ||
'set-cookie'?: string[] | undefined; | ||
'strict-transport-security'?: string | undefined; | ||
'tk'?: string | undefined; | ||
'trailer'?: string | undefined; | ||
'transfer-encoding'?: string | undefined; | ||
'upgrade'?: string | undefined; | ||
'user-agent'?: string | undefined; | ||
'vary'?: string | undefined; | ||
'via'?: string | undefined; | ||
'warning'?: string | undefined; | ||
'www-authenticate'?: string | undefined; | ||
"accept"?: string | undefined; | ||
"accept-language"?: string | undefined; | ||
"accept-patch"?: string | undefined; | ||
"accept-ranges"?: string | undefined; | ||
"access-control-allow-credentials"?: string | undefined; | ||
"access-control-allow-headers"?: string | undefined; | ||
"access-control-allow-methods"?: string | undefined; | ||
"access-control-allow-origin"?: string | undefined; | ||
"access-control-expose-headers"?: string | undefined; | ||
"access-control-max-age"?: string | undefined; | ||
"access-control-request-headers"?: string | undefined; | ||
"access-control-request-method"?: string | undefined; | ||
"age"?: string | undefined; | ||
"allow"?: string | undefined; | ||
"alt-svc"?: string | undefined; | ||
"authorization"?: string | undefined; | ||
"cache-control"?: string | undefined; | ||
"connection"?: string | undefined; | ||
"content-disposition"?: string | undefined; | ||
"content-encoding"?: string | undefined; | ||
"content-language"?: string | undefined; | ||
"content-length"?: string | undefined; | ||
"content-location"?: string | undefined; | ||
"content-range"?: string | undefined; | ||
"content-type"?: string | undefined; | ||
"cookie"?: string | undefined; | ||
"date"?: string | undefined; | ||
"etag"?: string | undefined; | ||
"expect"?: string | undefined; | ||
"expires"?: string | undefined; | ||
"forwarded"?: string | undefined; | ||
"from"?: string | undefined; | ||
"host"?: string | undefined; | ||
"if-match"?: string | undefined; | ||
"if-modified-since"?: string | undefined; | ||
"if-none-match"?: string | undefined; | ||
"if-unmodified-since"?: string | undefined; | ||
"last-modified"?: string | undefined; | ||
"location"?: string | undefined; | ||
"origin"?: string | undefined; | ||
"pragma"?: string | undefined; | ||
"proxy-authenticate"?: string | undefined; | ||
"proxy-authorization"?: string | undefined; | ||
"public-key-pins"?: string | undefined; | ||
"range"?: string | undefined; | ||
"referer"?: string | undefined; | ||
"retry-after"?: string | undefined; | ||
"sec-websocket-accept"?: string | undefined; | ||
"sec-websocket-extensions"?: string | undefined; | ||
"sec-websocket-key"?: string | undefined; | ||
"sec-websocket-protocol"?: string | undefined; | ||
"sec-websocket-version"?: string | undefined; | ||
"set-cookie"?: string[] | undefined; | ||
"strict-transport-security"?: string | undefined; | ||
"tk"?: string | undefined; | ||
"trailer"?: string | undefined; | ||
"transfer-encoding"?: string | undefined; | ||
"upgrade"?: string | undefined; | ||
"user-agent"?: string | undefined; | ||
"vary"?: string | undefined; | ||
"via"?: string | undefined; | ||
"warning"?: string | undefined; | ||
"www-authenticate"?: string | undefined; | ||
} | ||
@@ -76,4 +77,3 @@ | ||
interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> { | ||
} | ||
interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {} | ||
@@ -102,9 +102,14 @@ interface ClientRequestArgs { | ||
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 | ||
createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined; | ||
createConnection?: | ||
| ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | ||
| undefined; | ||
lookup?: LookupFunction | undefined; | ||
} | ||
interface ServerOptions { | ||
IncomingMessage?: typeof IncomingMessage | undefined; | ||
ServerResponse?: typeof ServerResponse | undefined; | ||
interface ServerOptions< | ||
Request extends typeof IncomingMessage = typeof IncomingMessage, | ||
Response extends typeof ServerResponse = typeof ServerResponse, | ||
> { | ||
IncomingMessage?: Request | undefined; | ||
ServerResponse?: Response | undefined; | ||
/** | ||
@@ -126,7 +131,13 @@ * Optionally overrides the value of | ||
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; | ||
type RequestListener< | ||
Request extends typeof IncomingMessage = typeof IncomingMessage, | ||
Response extends typeof ServerResponse = typeof ServerResponse, | ||
> = (req: InstanceType<Request>, res: InstanceType<Response>) => void; | ||
class Server extends NetServer { | ||
constructor(requestListener?: RequestListener); | ||
constructor(options: ServerOptions, requestListener?: RequestListener); | ||
class Server< | ||
Request extends typeof IncomingMessage = typeof IncomingMessage, | ||
Response extends typeof ServerResponse = typeof ServerResponse, | ||
> extends NetServer { | ||
constructor(requestListener?: RequestListener<Request, Response>); | ||
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>); | ||
setTimeout(msecs?: number, callback?: () => void): this; | ||
@@ -155,67 +166,91 @@ setTimeout(callback: () => void): this; | ||
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; | ||
addListener(event: 'checkContinue', listener: RequestListener): this; | ||
addListener(event: 'checkExpectation', listener: RequestListener): this; | ||
addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; | ||
addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this; | ||
addListener(event: 'request', listener: RequestListener): this; | ||
addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => 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; | ||
addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this; | ||
addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this; | ||
addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; | ||
addListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
addListener(event: "request", listener: RequestListener<Request, Response>): this; | ||
addListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
emit(event: string, ...args: any[]): boolean; | ||
emit(event: 'close'): boolean; | ||
emit(event: 'connection', socket: Socket): boolean; | ||
emit(event: 'error', err: Error): boolean; | ||
emit(event: 'listening'): boolean; | ||
emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean; | ||
emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean; | ||
emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean; | ||
emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean; | ||
emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean; | ||
emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean; | ||
emit(event: "close"): boolean; | ||
emit(event: "connection", socket: Socket): boolean; | ||
emit(event: "error", err: Error): boolean; | ||
emit(event: "listening"): boolean; | ||
emit(event: "checkContinue", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "checkExpectation", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; | ||
emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean; | ||
emit(event: "request", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): 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; | ||
on(event: 'checkContinue', listener: RequestListener): this; | ||
on(event: 'checkExpectation', listener: RequestListener): this; | ||
on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; | ||
on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this; | ||
on(event: 'request', listener: RequestListener): this; | ||
on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => 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; | ||
on(event: "checkContinue", listener: RequestListener<Request, Response>): this; | ||
on(event: "checkExpectation", listener: RequestListener<Request, Response>): this; | ||
on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; | ||
on(event: "connect", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this; | ||
on(event: "request", listener: RequestListener<Request, Response>): this; | ||
on(event: "upgrade", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => 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; | ||
once(event: 'checkContinue', listener: RequestListener): this; | ||
once(event: 'checkExpectation', listener: RequestListener): this; | ||
once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; | ||
once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this; | ||
once(event: 'request', listener: RequestListener): this; | ||
once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => 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; | ||
once(event: "checkContinue", listener: RequestListener<Request, Response>): this; | ||
once(event: "checkExpectation", listener: RequestListener<Request, Response>): this; | ||
once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; | ||
once( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
once(event: "request", listener: RequestListener<Request, Response>): this; | ||
once( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => 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; | ||
prependListener(event: 'checkContinue', listener: RequestListener): this; | ||
prependListener(event: 'checkExpectation', listener: RequestListener): this; | ||
prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; | ||
prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this; | ||
prependListener(event: 'request', listener: RequestListener): this; | ||
prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => 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; | ||
prependListener(event: "checkContinue", listener: RequestListener<Request, Response>): this; | ||
prependListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this; | ||
prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; | ||
prependListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
prependListener(event: "request", listener: RequestListener<Request, Response>): this; | ||
prependListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => 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; | ||
prependOnceListener(event: 'checkContinue', listener: RequestListener): this; | ||
prependOnceListener(event: 'checkExpectation', listener: RequestListener): this; | ||
prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; | ||
prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this; | ||
prependOnceListener(event: 'request', listener: RequestListener): this; | ||
prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => 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; | ||
prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this; | ||
prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this; | ||
prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; | ||
prependOnceListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
prependOnceListener(event: "request", listener: RequestListener<Request, Response>): this; | ||
prependOnceListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void, | ||
): this; | ||
} | ||
@@ -266,3 +301,7 @@ | ||
writeContinue(callback?: () => void): void; | ||
writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; | ||
writeHead( | ||
statusCode: number, | ||
statusMessage?: string, | ||
headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], | ||
): this; | ||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; | ||
@@ -287,2 +326,4 @@ writeProcessing(): void; | ||
protocol: string; | ||
reusedSocket: boolean; | ||
maxHeadersCount: number; | ||
@@ -300,80 +341,98 @@ constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); | ||
addListener(event: 'abort', listener: () => void): this; | ||
addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
addListener(event: 'continue', listener: () => void): this; | ||
addListener(event: 'information', listener: (info: InformationEvent) => void): this; | ||
addListener(event: 'response', listener: (response: IncomingMessage) => void): this; | ||
addListener(event: 'socket', listener: (socket: Socket) => void): this; | ||
addListener(event: 'timeout', listener: () => void): this; | ||
addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
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: stream.Readable) => void): this; | ||
addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; | ||
addListener(event: "abort", listener: () => void): this; | ||
addListener( | ||
event: "connect", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, | ||
): this; | ||
addListener(event: "continue", listener: () => void): this; | ||
addListener(event: "information", listener: (info: InformationEvent) => void): this; | ||
addListener(event: "response", listener: (response: IncomingMessage) => void): this; | ||
addListener(event: "socket", listener: (socket: Socket) => void): this; | ||
addListener(event: "timeout", listener: () => void): this; | ||
addListener( | ||
event: "upgrade", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, | ||
): this; | ||
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: stream.Readable) => void): this; | ||
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; | ||
addListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
on(event: 'abort', listener: () => void): this; | ||
on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
on(event: 'continue', listener: () => void): this; | ||
on(event: 'information', listener: (info: InformationEvent) => void): this; | ||
on(event: 'response', listener: (response: IncomingMessage) => void): this; | ||
on(event: 'socket', listener: (socket: Socket) => void): this; | ||
on(event: 'timeout', listener: () => void): this; | ||
on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
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: stream.Readable) => void): this; | ||
on(event: 'unpipe', listener: (src: stream.Readable) => void): this; | ||
on(event: "abort", listener: () => void): this; | ||
on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
on(event: "continue", listener: () => void): this; | ||
on(event: "information", listener: (info: InformationEvent) => void): this; | ||
on(event: "response", listener: (response: IncomingMessage) => void): this; | ||
on(event: "socket", listener: (socket: Socket) => void): this; | ||
on(event: "timeout", listener: () => void): this; | ||
on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
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: stream.Readable) => void): this; | ||
on(event: "unpipe", listener: (src: stream.Readable) => void): this; | ||
on(event: string | symbol, listener: (...args: any[]) => void): this; | ||
once(event: 'abort', listener: () => void): this; | ||
once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
once(event: 'continue', listener: () => void): this; | ||
once(event: 'information', listener: (info: InformationEvent) => void): this; | ||
once(event: 'response', listener: (response: IncomingMessage) => void): this; | ||
once(event: 'socket', listener: (socket: Socket) => void): this; | ||
once(event: 'timeout', listener: () => void): this; | ||
once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
once(event: 'unpipe', listener: (src: stream.Readable) => void): this; | ||
once(event: "abort", listener: () => void): this; | ||
once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
once(event: "continue", listener: () => void): this; | ||
once(event: "information", listener: (info: InformationEvent) => void): this; | ||
once(event: "response", listener: (response: IncomingMessage) => void): this; | ||
once(event: "socket", listener: (socket: Socket) => void): this; | ||
once(event: "timeout", listener: () => void): this; | ||
once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
once(event: "unpipe", listener: (src: stream.Readable) => void): this; | ||
once(event: string | symbol, listener: (...args: any[]) => void): this; | ||
prependListener(event: 'abort', listener: () => void): this; | ||
prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
prependListener(event: 'continue', listener: () => void): this; | ||
prependListener(event: 'information', listener: (info: InformationEvent) => void): this; | ||
prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; | ||
prependListener(event: 'socket', listener: (socket: Socket) => void): this; | ||
prependListener(event: 'timeout', listener: () => void): this; | ||
prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; | ||
prependListener(event: "abort", listener: () => void): this; | ||
prependListener( | ||
event: "connect", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, | ||
): this; | ||
prependListener(event: "continue", listener: () => void): this; | ||
prependListener(event: "information", listener: (info: InformationEvent) => void): this; | ||
prependListener(event: "response", listener: (response: IncomingMessage) => void): this; | ||
prependListener(event: "socket", listener: (socket: Socket) => void): this; | ||
prependListener(event: "timeout", listener: () => void): this; | ||
prependListener( | ||
event: "upgrade", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; | ||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: 'abort', listener: () => void): this; | ||
prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; | ||
prependOnceListener(event: 'continue', listener: () => void): this; | ||
prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; | ||
prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; | ||
prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; | ||
prependOnceListener(event: 'timeout', listener: () => void): this; | ||
prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; | ||
prependOnceListener(event: "abort", listener: () => void): this; | ||
prependOnceListener( | ||
event: "connect", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, | ||
): this; | ||
prependOnceListener(event: "continue", listener: () => void): this; | ||
prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; | ||
prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this; | ||
prependOnceListener(event: "socket", listener: (socket: Socket) => void): this; | ||
prependOnceListener(event: "timeout", listener: () => void): this; | ||
prependOnceListener( | ||
event: "upgrade", | ||
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => 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: stream.Readable) => void): this; | ||
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; | ||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
@@ -448,6 +507,6 @@ } | ||
*/ | ||
scheduling?: 'fifo' | 'lifo' | undefined; | ||
scheduling?: "fifo" | "lifo" | undefined; | ||
} | ||
class Agent { | ||
class Agent extends EventEmitter { | ||
maxFreeSockets: number; | ||
@@ -478,12 +537,44 @@ maxSockets: number; | ||
function createServer(requestListener?: RequestListener): Server; | ||
function createServer(options: ServerOptions, requestListener?: RequestListener): Server; | ||
function createServer< | ||
Request extends typeof IncomingMessage = typeof IncomingMessage, | ||
Response extends typeof ServerResponse = typeof ServerResponse, | ||
>(requestListener?: RequestListener<Request, Response>): Server<Request, Response>; | ||
function createServer< | ||
Request extends typeof IncomingMessage = typeof IncomingMessage, | ||
Response extends typeof ServerResponse = typeof ServerResponse, | ||
>( | ||
options: ServerOptions<Request, Response>, | ||
requestListener?: RequestListener<Request, Response>, | ||
): Server<Request, Response>; | ||
// although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, | ||
// create interface RequestOptions would make the naming more clear to developers | ||
interface RequestOptions extends ClientRequestArgs { } | ||
interface RequestOptions extends ClientRequestArgs {} | ||
function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; | ||
function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; | ||
function request( | ||
url: string | URL, | ||
options: RequestOptions, | ||
callback?: (res: IncomingMessage) => void, | ||
): ClientRequest; | ||
function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; | ||
function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; | ||
/** | ||
* Performs the low-level validations on the provided name that are done when `res.setHeader(name, value)` is called. | ||
* Passing illegal value as name will result in a TypeError being thrown, identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. | ||
* @param name Header name | ||
* @since v14.3.0 | ||
*/ | ||
function validateHeaderName(name: string): void; | ||
/** | ||
* Performs the low-level validations on the provided value that are done when `res.setHeader(name, value)` is called. | ||
* Passing illegal value as value will result in a TypeError being thrown. | ||
* - Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. | ||
* - Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. | ||
* @param name Header name | ||
* @param value Header value | ||
* @since v14.3.0 | ||
*/ | ||
function validateHeaderValue(name: string, value: string): void; | ||
let globalAgent: Agent; | ||
@@ -497,4 +588,4 @@ | ||
} | ||
declare module 'node:http' { | ||
export * from 'http'; | ||
declare module "node:http" { | ||
export * from "http"; | ||
} |
@@ -1,16 +0,16 @@ | ||
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'; | ||
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, | ||
IncomingMessage, | ||
OutgoingHttpHeaders, | ||
IncomingMessage, | ||
ServerResponse, | ||
} from 'http'; | ||
export { OutgoingHttpHeaders } from 'http'; | ||
} from "http"; | ||
export { OutgoingHttpHeaders } from "http"; | ||
@@ -83,3 +83,3 @@ export interface IncomingHttpStatusHeader { | ||
readonly sentTrailers?: OutgoingHttpHeaders | undefined; | ||
readonly session: Http2Session; | ||
readonly session: Http2Session | undefined; | ||
readonly state: StreamState; | ||
@@ -191,5 +191,11 @@ | ||
addListener(event: "continue", listener: () => {}): this; | ||
addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): 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: "response", | ||
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, | ||
): this; | ||
addListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
@@ -204,23 +210,47 @@ | ||
on(event: "continue", listener: () => {}): this; | ||
on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): 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: "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: "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: "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: "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: "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: "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: "response", | ||
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, | ||
): this; | ||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
@@ -233,7 +263,22 @@ } | ||
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; | ||
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; | ||
respondWithFD( | ||
fd: number | fs.promises.FileHandle, | ||
headers?: OutgoingHttpHeaders, | ||
options?: ServerStreamFileResponseOptions, | ||
): void; | ||
respondWithFile( | ||
path: string, | ||
headers?: OutgoingHttpHeaders, | ||
options?: ServerStreamFileResponseOptionsWithError, | ||
): void; | ||
} | ||
@@ -259,2 +304,3 @@ | ||
waitForTrailers?: boolean | undefined; | ||
signal?: AbortSignal | undefined; | ||
} | ||
@@ -292,7 +338,13 @@ | ||
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; | ||
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; | ||
settings( | ||
settings: Settings, | ||
callback?: (err: Error | null, settings: Settings, duration: number) => void, | ||
): void; | ||
unref(): void; | ||
@@ -302,4 +354,10 @@ | ||
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: "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; | ||
@@ -343,4 +401,10 @@ addListener(event: "ping", 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: "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; | ||
@@ -354,4 +418,10 @@ prependListener(event: "ping", 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: "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; | ||
@@ -369,4 +439,14 @@ prependOnceListener(event: "ping", listener: () => 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: "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; | ||
@@ -377,3 +457,8 @@ | ||
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; | ||
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; | ||
emit( | ||
event: "stream", | ||
stream: ClientHttp2Stream, | ||
headers: IncomingHttpHeaders & IncomingHttpStatusHeader, | ||
flags: number, | ||
): boolean; | ||
emit(event: string | symbol, ...args: any[]): boolean; | ||
@@ -384,3 +469,10 @@ | ||
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: "stream", | ||
listener: ( | ||
stream: ClientHttp2Stream, | ||
headers: IncomingHttpHeaders & IncomingHttpStatusHeader, | ||
flags: number, | ||
) => void, | ||
): this; | ||
on(event: string | symbol, listener: (...args: any[]) => void): this; | ||
@@ -390,4 +482,14 @@ | ||
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: "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; | ||
@@ -397,4 +499,14 @@ | ||
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: "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; | ||
@@ -404,4 +516,14 @@ | ||
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: "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; | ||
@@ -420,4 +542,10 @@ } | ||
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: "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; | ||
@@ -430,15 +558,36 @@ | ||
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: "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: "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: "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: "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; | ||
@@ -460,3 +609,2 @@ } | ||
selectPadding?(frameLen: number, maxFrameLen: number): number; | ||
createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex; | ||
} | ||
@@ -467,3 +615,3 @@ | ||
createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; | ||
protocol?: 'http:' | 'https:' | undefined; | ||
protocol?: "http:" | "https:" | undefined; | ||
} | ||
@@ -478,6 +626,6 @@ | ||
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } | ||
export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } | ||
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} | ||
export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {} | ||
export interface ServerOptions extends ServerSessionOptions { } | ||
export interface ServerOptions extends ServerSessionOptions {} | ||
@@ -490,7 +638,16 @@ export interface SecureServerOptions extends SecureServerSessionOptions { | ||
export interface Http2Server extends net.Server { | ||
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
addListener(event: "timeout", listener: () => void): this; | ||
@@ -507,31 +664,61 @@ addListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
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: "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: "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: "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: "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: "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: "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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
prependOnceListener(event: "timeout", listener: () => void): this; | ||
@@ -544,7 +731,16 @@ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
export interface Http2SecureServer extends tls.Server { | ||
addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
addListener(event: "timeout", listener: () => void): this; | ||
@@ -563,7 +759,13 @@ addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; | ||
on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
on(event: "timeout", listener: () => void): this; | ||
@@ -573,7 +775,13 @@ on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; | ||
once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => 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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
once(event: "timeout", listener: () => void): this; | ||
@@ -583,7 +791,16 @@ once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; | ||
prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => 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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
prependListener(event: "timeout", listener: () => void): this; | ||
@@ -593,7 +810,16 @@ prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; | ||
prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => 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: "stream", | ||
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, | ||
): this; | ||
prependOnceListener(event: "timeout", listener: () => void): this; | ||
@@ -607,3 +833,8 @@ prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; | ||
export class Http2ServerRequest extends stream.Readable { | ||
constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray<string>); | ||
constructor( | ||
stream: ServerHttp2Stream, | ||
headers: IncomingHttpHeaders, | ||
options: stream.ReadableOptions, | ||
rawHeaders: ReadonlyArray<string>, | ||
); | ||
@@ -689,3 +920,3 @@ readonly aborted: boolean; | ||
statusCode: number; | ||
statusMessage: ''; | ||
statusMessage: ""; | ||
addTrailers(trailers: OutgoingHttpHeaders): void; | ||
@@ -707,3 +938,6 @@ end(callback?: () => void): this; | ||
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; | ||
createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; | ||
createPushResponse( | ||
headers: OutgoingHttpHeaders, | ||
callback: (err: Error | null, res: Http2ServerResponse) => void, | ||
): void; | ||
@@ -976,17 +1210,30 @@ addListener(event: "close", listener: () => void): this; | ||
export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; | ||
export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; | ||
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 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, | ||
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 | ||
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, | ||
): ClientHttp2Session; | ||
} | ||
declare module 'node:http2' { | ||
export * from 'http2'; | ||
declare module "node:http2" { | ||
export * from "http2"; | ||
} |
@@ -1,13 +0,20 @@ | ||
declare module 'https' { | ||
import { Duplex } from 'stream'; | ||
import * as tls from 'tls'; | ||
import * as http from 'http'; | ||
import { URL } from 'url'; | ||
declare module "https" { | ||
import { Duplex } from "stream"; | ||
import * as tls from "tls"; | ||
import * as http from "http"; | ||
import { URL } from "url"; | ||
type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; | ||
type ServerOptions< | ||
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, | ||
Response extends typeof http.ServerResponse = typeof http.ServerResponse, | ||
> = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>; | ||
type RequestOptions = http.RequestOptions & tls.SecureContextOptions & { | ||
rejectUnauthorized?: boolean | undefined; // Defaults to true | ||
servername?: string | undefined; // SNI TLS Extension | ||
}; | ||
type RequestOptions = | ||
& http.RequestOptions | ||
& tls.SecureContextOptions | ||
& { | ||
checkServerIdentity?: typeof tls.checkServerIdentity | undefined; | ||
rejectUnauthorized?: boolean | undefined; // Defaults to true | ||
servername?: string | undefined; // SNI TLS Extension | ||
}; | ||
@@ -24,120 +31,245 @@ interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { | ||
interface Server extends http.Server {} | ||
class Server extends tls.Server { | ||
constructor(requestListener?: http.RequestListener); | ||
constructor(options: ServerOptions, requestListener?: http.RequestListener); | ||
interface Server< | ||
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, | ||
Response extends typeof http.ServerResponse = typeof http.ServerResponse, | ||
> extends http.Server<Request, Response> {} | ||
class Server< | ||
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, | ||
Response extends typeof http.ServerResponse = typeof http.ServerResponse, | ||
> extends tls.Server { | ||
constructor(requestListener?: http.RequestListener<Request, Response>); | ||
constructor( | ||
options: ServerOptions<Request, Response>, | ||
requestListener?: http.RequestListener<Request, Response>, | ||
); | ||
addListener(event: string, listener: (...args: any[]) => void): this; | ||
addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
addListener(event: 'close', listener: () => void): this; | ||
addListener(event: 'connection', listener: (socket: Duplex) => void): this; | ||
addListener(event: 'error', listener: (err: Error) => void): this; | ||
addListener(event: 'listening', listener: () => void): this; | ||
addListener(event: 'checkContinue', listener: http.RequestListener): this; | ||
addListener(event: 'checkExpectation', listener: http.RequestListener): this; | ||
addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; | ||
addListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
addListener(event: 'request', listener: http.RequestListener): this; | ||
addListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
addListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, | ||
): this; | ||
addListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
addListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, | ||
): this; | ||
addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
addListener(event: "close", listener: () => void): this; | ||
addListener(event: "connection", listener: (socket: Duplex) => void): this; | ||
addListener(event: "error", listener: (err: Error) => void): this; | ||
addListener(event: "listening", listener: () => void): this; | ||
addListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this; | ||
addListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this; | ||
addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; | ||
addListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
addListener(event: "request", listener: http.RequestListener<Request, Response>): this; | ||
addListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
emit(event: string, ...args: any[]): boolean; | ||
emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean; | ||
emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; | ||
emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; | ||
emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; | ||
emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean; | ||
emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean; | ||
emit(event: 'close'): boolean; | ||
emit(event: 'connection', socket: Duplex): boolean; | ||
emit(event: 'error', err: Error): boolean; | ||
emit(event: 'listening'): boolean; | ||
emit(event: 'checkContinue', req: http.IncomingMessage, res: http.ServerResponse): boolean; | ||
emit(event: 'checkExpectation', req: http.IncomingMessage, res: http.ServerResponse): boolean; | ||
emit(event: 'clientError', err: Error, socket: Duplex): boolean; | ||
emit(event: 'connect', req: http.IncomingMessage, socket: Duplex, head: Buffer): boolean; | ||
emit(event: 'request', req: http.IncomingMessage, res: http.ServerResponse): boolean; | ||
emit(event: 'upgrade', req: http.IncomingMessage, socket: Duplex, head: Buffer): boolean; | ||
emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean; | ||
emit( | ||
event: "newSession", | ||
sessionId: Buffer, | ||
sessionData: Buffer, | ||
callback: (err: Error, resp: Buffer) => void, | ||
): boolean; | ||
emit( | ||
event: "OCSPRequest", | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
): boolean; | ||
emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; | ||
emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; | ||
emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; | ||
emit(event: "close"): boolean; | ||
emit(event: "connection", socket: Duplex): boolean; | ||
emit(event: "error", err: Error): boolean; | ||
emit(event: "listening"): boolean; | ||
emit(event: "checkContinue", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "checkExpectation", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "clientError", err: Error, socket: Duplex): boolean; | ||
emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean; | ||
emit(event: "request", req: InstanceType<Request>, res: InstanceType<Response>): boolean; | ||
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean; | ||
on(event: string, listener: (...args: any[]) => void): this; | ||
on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
on(event: 'close', listener: () => void): this; | ||
on(event: 'connection', listener: (socket: Duplex) => void): this; | ||
on(event: 'error', listener: (err: Error) => void): this; | ||
on(event: 'listening', listener: () => void): this; | ||
on(event: 'checkContinue', listener: http.RequestListener): this; | ||
on(event: 'checkExpectation', listener: http.RequestListener): this; | ||
on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; | ||
on(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
on(event: 'request', listener: http.RequestListener): this; | ||
on(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
on( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, | ||
): this; | ||
on( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
on( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, | ||
): this; | ||
on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
on(event: "close", listener: () => void): this; | ||
on(event: "connection", listener: (socket: Duplex) => void): this; | ||
on(event: "error", listener: (err: Error) => void): this; | ||
on(event: "listening", listener: () => void): this; | ||
on(event: "checkContinue", listener: http.RequestListener<Request, Response>): this; | ||
on(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this; | ||
on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; | ||
on(event: "connect", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this; | ||
on(event: "request", listener: http.RequestListener<Request, Response>): this; | ||
on(event: "upgrade", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this; | ||
once(event: string, listener: (...args: any[]) => void): this; | ||
once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
once(event: 'close', listener: () => void): this; | ||
once(event: 'connection', listener: (socket: Duplex) => void): this; | ||
once(event: 'error', listener: (err: Error) => void): this; | ||
once(event: 'listening', listener: () => void): this; | ||
once(event: 'checkContinue', listener: http.RequestListener): this; | ||
once(event: 'checkExpectation', listener: http.RequestListener): this; | ||
once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; | ||
once(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
once(event: 'request', listener: http.RequestListener): this; | ||
once(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
once( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, | ||
): this; | ||
once( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
once( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, | ||
): this; | ||
once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
once(event: "close", listener: () => void): this; | ||
once(event: "connection", listener: (socket: Duplex) => void): this; | ||
once(event: "error", listener: (err: Error) => void): this; | ||
once(event: "listening", listener: () => void): this; | ||
once(event: "checkContinue", listener: http.RequestListener<Request, Response>): this; | ||
once(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this; | ||
once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; | ||
once(event: "connect", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this; | ||
once(event: "request", listener: http.RequestListener<Request, Response>): this; | ||
once(event: "upgrade", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this; | ||
prependListener(event: string, listener: (...args: any[]) => void): this; | ||
prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener(event: 'close', listener: () => void): this; | ||
prependListener(event: 'connection', listener: (socket: Duplex) => void): this; | ||
prependListener(event: 'error', listener: (err: Error) => void): this; | ||
prependListener(event: 'listening', listener: () => void): this; | ||
prependListener(event: 'checkContinue', listener: http.RequestListener): this; | ||
prependListener(event: 'checkExpectation', listener: http.RequestListener): this; | ||
prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; | ||
prependListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
prependListener(event: 'request', listener: http.RequestListener): this; | ||
prependListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, | ||
): this; | ||
prependListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
prependListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, | ||
): this; | ||
prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
prependListener(event: "close", listener: () => void): this; | ||
prependListener(event: "connection", listener: (socket: Duplex) => void): this; | ||
prependListener(event: "error", listener: (err: Error) => void): this; | ||
prependListener(event: "listening", listener: () => void): this; | ||
prependListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this; | ||
prependListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this; | ||
prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; | ||
prependListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this; | ||
prependListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: 'close', listener: () => void): this; | ||
prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this; | ||
prependOnceListener(event: 'error', listener: (err: Error) => void): this; | ||
prependOnceListener(event: 'listening', listener: () => void): this; | ||
prependOnceListener(event: 'checkContinue', listener: http.RequestListener): this; | ||
prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this; | ||
prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; | ||
prependOnceListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
prependOnceListener(event: 'request', listener: http.RequestListener): this; | ||
prependOnceListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this; | ||
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, | ||
): this; | ||
prependOnceListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
prependOnceListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, | ||
): this; | ||
prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; | ||
prependOnceListener(event: "close", listener: () => void): this; | ||
prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this; | ||
prependOnceListener(event: "error", listener: (err: Error) => void): this; | ||
prependOnceListener(event: "listening", listener: () => void): this; | ||
prependOnceListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this; | ||
prependOnceListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this; | ||
prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; | ||
prependOnceListener( | ||
event: "connect", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this; | ||
prependOnceListener( | ||
event: "upgrade", | ||
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void, | ||
): this; | ||
} | ||
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; | ||
function createServer< | ||
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, | ||
Response extends typeof http.ServerResponse = typeof http.ServerResponse, | ||
>(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>; | ||
function createServer< | ||
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, | ||
Response extends typeof http.ServerResponse = typeof http.ServerResponse, | ||
>( | ||
options: ServerOptions<Request, Response>, | ||
requestListener?: http.RequestListener<Request, Response>, | ||
): Server<Request, Response>; | ||
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; | ||
} | ||
declare module 'node:https' { | ||
export * from 'https'; | ||
declare module "node:https" { | ||
export * from "https"; | ||
} |
@@ -38,3 +38,2 @@ // Type definitions for non-npm package Node.js 14.18 | ||
// ExE Boss <https://github.com/ExE-Boss> | ||
// Surasak Chaisurin <https://github.com/Ryan-Willpower> | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
@@ -48,3 +47,3 @@ // Anna Henningsen <https://github.com/addaleax> | ||
// NOTE: These definitions support NodeJS and TypeScript 3.7+ | ||
// NOTE: These definitions support NodeJS and TypeScript 4.9+ | ||
@@ -51,0 +50,0 @@ // Reference required types from the default lib: |
@@ -1,3 +0,3 @@ | ||
declare module 'module' { | ||
import { URL } from 'url'; | ||
declare module "module" { | ||
import { URL } from "url"; | ||
namespace Module { | ||
@@ -53,5 +53,5 @@ /** | ||
} | ||
declare module 'node:module' { | ||
import module = require('module'); | ||
declare module "node:module" { | ||
import module = require("module"); | ||
export = module; | ||
} |
@@ -1,5 +0,5 @@ | ||
declare module 'net' { | ||
import * as stream from 'stream'; | ||
import EventEmitter = require('events'); | ||
import * as dns from 'dns'; | ||
declare module "net" { | ||
import * as stream from "stream"; | ||
import EventEmitter = require("events"); | ||
import * as dns from "dns"; | ||
@@ -59,2 +59,3 @@ type LookupFunction = ( | ||
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; | ||
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; | ||
@@ -91,5 +92,17 @@ class Socket extends stream.Duplex { | ||
readonly localPort: number; | ||
readonly pending: boolean; | ||
/** | ||
* This property represents the state of the connection as a string. | ||
* @see {https://nodejs.org/api/net.html#socketreadystate} | ||
* @since v0.5.0 | ||
*/ | ||
readonly readyState: SocketReadyState; | ||
readonly remoteAddress?: string | undefined; | ||
readonly remoteFamily?: string | undefined; | ||
readonly remotePort?: number | undefined; | ||
/** | ||
* The socket timeout in milliseconds as set by socket.setTimeout(). It is undefined if a timeout has not been set. | ||
* @since v10.7.0 | ||
*/ | ||
readonly timeout?: number | undefined; | ||
@@ -119,3 +132,6 @@ // Extended base methods | ||
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: "lookup", | ||
listener: (err: Error, address: string, family: string | number, host: string) => void, | ||
): this; | ||
addListener(event: "ready", listener: () => void): this; | ||
@@ -142,3 +158,6 @@ addListener(event: "timeout", 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: "lookup", | ||
listener: (err: Error, address: string, family: string | number, host: string) => void, | ||
): this; | ||
on(event: "ready", listener: () => void): this; | ||
@@ -154,3 +173,6 @@ on(event: "timeout", 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: "lookup", | ||
listener: (err: Error, address: string, family: string | number, host: string) => void, | ||
): this; | ||
once(event: "ready", listener: () => void): this; | ||
@@ -166,3 +188,6 @@ once(event: "timeout", 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: "lookup", | ||
listener: (err: Error, address: string, family: string | number, host: string) => void, | ||
): this; | ||
prependListener(event: "ready", listener: () => void): this; | ||
@@ -178,3 +203,6 @@ prependListener(event: "timeout", 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: "lookup", | ||
listener: (err: Error, address: string, family: string | number, host: string) => void, | ||
): this; | ||
prependOnceListener(event: "ready", listener: () => void): this; | ||
@@ -301,4 +329,4 @@ prependOnceListener(event: "timeout", listener: () => void): this; | ||
} | ||
declare module 'node:net' { | ||
export * from 'net'; | ||
declare module "node:net" { | ||
export * from "net"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'os' { | ||
declare module "os" { | ||
interface CpuInfo { | ||
@@ -24,2 +24,3 @@ model: string; | ||
family: "IPv4"; | ||
scopeid?: undefined; | ||
} | ||
@@ -52,3 +53,3 @@ | ||
function homedir(): string; | ||
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>; | ||
function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>; | ||
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>; | ||
@@ -242,4 +243,4 @@ | ||
} | ||
declare module 'node:os' { | ||
export * from 'os'; | ||
declare module "node:os" { | ||
export * from "os"; | ||
} |
{ | ||
"name": "@types/node", | ||
"version": "14.18.5", | ||
"version": "14.18.63", | ||
"description": "TypeScript definitions for Node.js", | ||
@@ -184,7 +184,2 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
{ | ||
"name": "Surasak Chaisurin", | ||
"url": "https://github.com/Ryan-Willpower", | ||
"githubUsername": "Ryan-Willpower" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
@@ -222,2 +217,9 @@ "url": "https://github.com/peterblazejewicz", | ||
"types": "index.d.ts", | ||
"typesVersions": { | ||
"<=4.8": { | ||
"*": [ | ||
"ts4.8/*" | ||
] | ||
} | ||
}, | ||
"repository": { | ||
@@ -230,4 +232,4 @@ "type": "git", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "252c75e4415b41c2119a2a09f46387f535c6c18a5d96975c41aefb8ec86e7436", | ||
"typeScriptVersion": "3.8" | ||
"typesPublisherContentHash": "094b5f53a7bae39684ec23bea14130aaf2772995fa789fc757b734b2f16b28f0", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'path' { | ||
declare module "path" { | ||
namespace path { | ||
@@ -57,14 +57,15 @@ /** | ||
* | ||
* @param p string path to normalize. | ||
* @param path string path to normalize. | ||
* @throws {TypeError} if `path` is not a string. | ||
*/ | ||
normalize(p: string): string; | ||
normalize(path: 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. | ||
* @throws {TypeError} if any of the path segments is not a string. | ||
*/ | ||
join(...paths: string[]): string; | ||
/** | ||
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}. | ||
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}. | ||
* | ||
@@ -78,14 +79,20 @@ * Starting from leftmost {from} parameter, resolves {to} to an absolute path. | ||
* | ||
* @param pathSegments string paths to join. Non-string arguments are ignored. | ||
* @param paths A sequence of paths or path segments. | ||
* @throws {TypeError} if any of the arguments is not a string. | ||
*/ | ||
resolve(...pathSegments: string[]): string; | ||
resolve(...paths: string[]): string; | ||
/** | ||
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. | ||
* | ||
* If the given {path} is a zero-length string, `false` will be returned. | ||
* | ||
* @param path path to test. | ||
* @throws {TypeError} if `path` is not a string. | ||
*/ | ||
isAbsolute(p: string): boolean; | ||
isAbsolute(path: string): boolean; | ||
/** | ||
* Solve the relative path from {from} to {to}. | ||
* Solve the relative path from {from} to {to} based on the current working directory. | ||
* 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. | ||
* | ||
* @throws {TypeError} if either `from` or `to` is not a string. | ||
*/ | ||
@@ -96,5 +103,6 @@ relative(from: string, to: string): string; | ||
* | ||
* @param p the path to evaluate. | ||
* @param path the path to evaluate. | ||
* @throws {TypeError} if `path` is not a string. | ||
*/ | ||
dirname(p: string): string; | ||
dirname(path: string): string; | ||
/** | ||
@@ -104,33 +112,36 @@ * Return the last portion of a path. Similar to the Unix basename command. | ||
* | ||
* @param p the path to evaluate. | ||
* @param path the path to evaluate. | ||
* @param ext optionally, an extension to remove from the result. | ||
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. | ||
*/ | ||
basename(p: string, ext?: string): string; | ||
basename(path: 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 | ||
* 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. | ||
* @param path the path to evaluate. | ||
* @throws {TypeError} if `path` is not a string. | ||
*/ | ||
extname(p: string): string; | ||
extname(path: string): string; | ||
/** | ||
* The platform-specific file separator. '\\' or '/'. | ||
*/ | ||
readonly sep: string; | ||
readonly sep: "\\" | "/"; | ||
/** | ||
* The platform-specific file delimiter. ';' or ':'. | ||
*/ | ||
readonly delimiter: string; | ||
readonly delimiter: ";" | ":"; | ||
/** | ||
* Returns an object from a path string - the opposite of format(). | ||
* | ||
* @param pathString path to evaluate. | ||
* @param path path to evaluate. | ||
* @throws {TypeError} if `path` is not a string. | ||
*/ | ||
parse(p: string): ParsedPath; | ||
parse(path: string): ParsedPath; | ||
/** | ||
* Returns a path string from an object - the opposite of parse(). | ||
* | ||
* @param pathString path to evaluate. | ||
* @param pathObject path to evaluate. | ||
*/ | ||
format(pP: FormatInputPathObject): string; | ||
format(pathObject: FormatInputPathObject): string; | ||
/** | ||
@@ -158,5 +169,5 @@ * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. | ||
} | ||
declare module 'node:path' { | ||
import path = require('path'); | ||
declare module "node:path" { | ||
import path = require("path"); | ||
export = path; | ||
} |
@@ -1,5 +0,5 @@ | ||
declare module 'perf_hooks' { | ||
import { AsyncResource } from 'async_hooks'; | ||
declare module "perf_hooks" { | ||
import { AsyncResource } from "async_hooks"; | ||
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http'; | ||
type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http"; | ||
@@ -272,4 +272,4 @@ interface PerformanceEntry { | ||
} | ||
declare module 'node:perf_hooks' { | ||
export * from 'perf_hooks'; | ||
declare module "node:perf_hooks" { | ||
export * from "perf_hooks"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'process' { | ||
import * as tty from 'tty'; | ||
declare module "process" { | ||
import * as tty from "tty"; | ||
@@ -46,21 +46,55 @@ global { | ||
type Platform = 'aix' | ||
| 'android' | ||
| 'darwin' | ||
| 'freebsd' | ||
| 'linux' | ||
| 'openbsd' | ||
| 'sunos' | ||
| 'win32' | ||
| 'cygwin' | ||
| 'netbsd'; | ||
type Platform = | ||
| "aix" | ||
| "android" | ||
| "darwin" | ||
| "freebsd" | ||
| "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"; | ||
| "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 UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection'; | ||
type MultipleResolveType = 'resolve' | 'reject'; | ||
type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection"; | ||
type MultipleResolveType = "resolve" | "reject"; | ||
@@ -282,3 +316,8 @@ type BeforeExitListener = (code: number) => void; | ||
// Worker | ||
send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean | undefined}, callback?: (error: Error | null) => void): boolean; | ||
send?( | ||
message: any, | ||
sendHandle?: any, | ||
options?: { swallowErrors?: boolean | undefined }, | ||
callback?: (error: Error | null) => void, | ||
): boolean; | ||
disconnect(): void; | ||
@@ -412,5 +451,5 @@ connected: boolean; | ||
} | ||
declare module 'node:process' { | ||
import process = require('process'); | ||
declare module "node:process" { | ||
import process = require("process"); | ||
export = process; | ||
} |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
declare module 'punycode' { | ||
declare module "punycode" { | ||
/** | ||
@@ -77,4 +77,4 @@ * @deprecated since v7.0.0 | ||
} | ||
declare module 'node:punycode' { | ||
export * from 'punycode'; | ||
declare module "node:punycode" { | ||
export * from "punycode"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'querystring' { | ||
declare module "querystring" { | ||
interface StringifyOptions { | ||
@@ -11,5 +11,15 @@ encodeURIComponent?: ((str: string) => string) | undefined; | ||
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { } | ||
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {} | ||
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> { | ||
interface ParsedUrlQueryInput extends | ||
NodeJS.Dict< | ||
| string | ||
| number | ||
| boolean | ||
| ReadonlyArray<string> | ||
| ReadonlyArray<number> | ||
| ReadonlyArray<boolean> | ||
| null | ||
> | ||
{ | ||
} | ||
@@ -30,4 +40,4 @@ | ||
} | ||
declare module 'node:querystring' { | ||
export * from 'querystring'; | ||
declare module "node:querystring" { | ||
export * from "querystring"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'readline' { | ||
import EventEmitter = require('events'); | ||
declare module "readline" { | ||
import EventEmitter = require("events"); | ||
@@ -30,3 +30,8 @@ interface Key { | ||
*/ | ||
protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); | ||
protected constructor( | ||
input: NodeJS.ReadableStream, | ||
output?: NodeJS.WritableStream, | ||
completer?: Completer | AsyncCompleter, | ||
terminal?: boolean, | ||
); | ||
/** | ||
@@ -145,3 +150,8 @@ * NOTE: According to the documentation: | ||
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; | ||
function createInterface( | ||
input: NodeJS.ReadableStream, | ||
output?: NodeJS.WritableStream, | ||
completer?: Completer | AsyncCompleter, | ||
terminal?: boolean, | ||
): Interface; | ||
function createInterface(options: ReadLineOptions): Interface; | ||
@@ -174,4 +184,4 @@ function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; | ||
} | ||
declare module 'node:readline' { | ||
export * from 'readline'; | ||
declare module "node:readline" { | ||
export * from "readline"; | ||
} |
@@ -11,7 +11,7 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 04 Jan 2022 18:31:34 GMT | ||
* Last updated: Sat, 23 Sep 2023 20:38:33 GMT | ||
* Dependencies: none | ||
* Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` | ||
* Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` | ||
# Credits | ||
These definitions were written 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), [Seth Westphal](https://github.com/westy92), [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), [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), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [Bond](https://github.com/bondz), and [Linus Unnebäck](https://github.com/LinusU). | ||
These definitions were written 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), [Seth Westphal](https://github.com/westy92), [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), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [Bond](https://github.com/bondz), and [Linus Unnebäck](https://github.com/LinusU). |
@@ -1,5 +0,5 @@ | ||
declare module 'repl' { | ||
import { Interface, Completer, AsyncCompleter } from 'readline'; | ||
import { Context } from 'vm'; | ||
import { InspectOptions } from 'util'; | ||
declare module "repl" { | ||
import { AsyncCompleter, Completer, Interface } from "readline"; | ||
import { Context } from "vm"; | ||
import { InspectOptions } from "util"; | ||
@@ -94,3 +94,9 @@ interface ReplOptions { | ||
type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; | ||
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; | ||
@@ -397,4 +403,4 @@ | ||
} | ||
declare module 'node:repl' { | ||
export * from 'repl'; | ||
declare module "node:repl" { | ||
export * from "repl"; | ||
} |
@@ -1,6 +0,6 @@ | ||
declare module 'stream' { | ||
import EventEmitter = require('events'); | ||
declare module "stream" { | ||
import EventEmitter = require("events"); | ||
class internal extends EventEmitter { | ||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T; | ||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean | undefined }): T; | ||
} | ||
@@ -133,4 +133,13 @@ | ||
emitClose?: boolean | undefined; | ||
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; | ||
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; | ||
destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void; | ||
@@ -152,3 +161,6 @@ final?(this: Writable, callback: (error?: Error | null) => void): void; | ||
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; | ||
_writev?(chunks: Array<{ 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; | ||
@@ -242,3 +254,7 @@ _final(callback: (error?: Error | null) => void): 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; | ||
writev?( | ||
this: Duplex, | ||
chunks: Array<{ chunk: any; encoding: BufferEncoding }>, | ||
callback: (error?: Error | null) => void, | ||
): void; | ||
final?(this: Duplex, callback: (error?: Error | null) => void): void; | ||
@@ -260,3 +276,6 @@ destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; | ||
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; | ||
_writev?(chunks: Array<{ 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; | ||
@@ -272,2 +291,101 @@ _final(callback: (error?: Error | null) => void): void; | ||
uncork(): void; | ||
/** | ||
* Event emitter | ||
* The defined events on documents including: | ||
* 1. close | ||
* 2. data | ||
* 3. drain | ||
* 4. end | ||
* 5. error | ||
* 6. finish | ||
* 7. pause | ||
* 8. pipe | ||
* 9. readable | ||
* 10. resume | ||
* 11. unpipe | ||
*/ | ||
addListener(event: "close", listener: () => void): this; | ||
addListener(event: "data", listener: (chunk: any) => 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: "pause", listener: () => void): this; | ||
addListener(event: "pipe", listener: (src: Readable) => void): this; | ||
addListener(event: "readable", listener: () => void): this; | ||
addListener(event: "resume", listener: () => 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: "data", chunk: any): boolean; | ||
emit(event: "drain"): boolean; | ||
emit(event: "end"): boolean; | ||
emit(event: "error", err: Error): boolean; | ||
emit(event: "finish"): boolean; | ||
emit(event: "pause"): boolean; | ||
emit(event: "pipe", src: Readable): boolean; | ||
emit(event: "readable"): boolean; | ||
emit(event: "resume"): boolean; | ||
emit(event: "unpipe", src: Readable): boolean; | ||
emit(event: string | symbol, ...args: any[]): boolean; | ||
on(event: "close", listener: () => void): this; | ||
on(event: "data", listener: (chunk: any) => 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: "pause", listener: () => void): this; | ||
on(event: "pipe", listener: (src: Readable) => void): this; | ||
on(event: "readable", listener: () => void): this; | ||
on(event: "resume", listener: () => 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: "data", listener: (chunk: any) => 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: "pause", listener: () => void): this; | ||
once(event: "pipe", listener: (src: Readable) => void): this; | ||
once(event: "readable", listener: () => void): this; | ||
once(event: "resume", listener: () => 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: "data", listener: (chunk: any) => 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: "pause", listener: () => void): this; | ||
prependListener(event: "pipe", listener: (src: Readable) => void): this; | ||
prependListener(event: "readable", listener: () => void): this; | ||
prependListener(event: "resume", listener: () => 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: "data", listener: (chunk: any) => 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: "pause", listener: () => void): this; | ||
prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; | ||
prependOnceListener(event: "readable", listener: () => void): this; | ||
prependOnceListener(event: "resume", listener: () => 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: "data", listener: (chunk: any) => void): this; | ||
removeListener(event: "drain", listener: () => void): this; | ||
removeListener(event: "end", listener: () => void): this; | ||
removeListener(event: "error", listener: (err: Error) => void): this; | ||
removeListener(event: "finish", listener: () => void): this; | ||
removeListener(event: "pause", listener: () => void): this; | ||
removeListener(event: "pipe", listener: (src: Readable) => void): this; | ||
removeListener(event: "readable", listener: () => void): this; | ||
removeListener(event: "resume", listener: () => void): this; | ||
removeListener(event: "unpipe", listener: (src: Readable) => void): this; | ||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this; | ||
} | ||
@@ -279,4 +397,13 @@ | ||
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; | ||
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; | ||
@@ -294,3 +421,3 @@ destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; | ||
class PassThrough extends Transform { } | ||
class PassThrough extends Transform {} | ||
@@ -302,13 +429,32 @@ interface FinishedOptions { | ||
} | ||
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; | ||
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>; | ||
function __promisify__( | ||
stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, | ||
options?: FinishedOptions, | ||
): Promise<void>; | ||
} | ||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; | ||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T; | ||
function pipeline<T extends NodeJS.WritableStream>( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: T, | ||
callback?: (err: NodeJS.ErrnoException | null) => void, | ||
): T; | ||
function pipeline<T extends NodeJS.WritableStream>( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream, | ||
stream3: T, | ||
callback?: (err: NodeJS.ErrnoException | null) => void, | ||
): T; | ||
function pipeline<T extends NodeJS.WritableStream>( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream, | ||
stream3: NodeJS.ReadWriteStream, | ||
@@ -333,20 +479,33 @@ stream4: T, | ||
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, | ||
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)>, | ||
...streams: Array< | ||
NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void) | ||
> | ||
): NodeJS.WritableStream; | ||
namespace pipeline { | ||
function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise<void>; | ||
function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.WritableStream): Promise<void>; | ||
function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: NodeJS.WritableStream): Promise<void>; | ||
function __promisify__( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream, | ||
stream3: NodeJS.WritableStream, | ||
): Promise<void>; | ||
function __promisify__( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream, | ||
stream3: NodeJS.ReadWriteStream, | ||
stream4: NodeJS.WritableStream, | ||
): Promise<void>; | ||
function __promisify__( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream, | ||
stream3: NodeJS.ReadWriteStream, | ||
stream4: NodeJS.ReadWriteStream, | ||
stream5: NodeJS.WritableStream, | ||
): Promise<void>; | ||
function __promisify__(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>): Promise<void>; | ||
function __promisify__( | ||
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, | ||
): Promise<void>; | ||
function __promisify__( | ||
stream1: NodeJS.ReadableStream, | ||
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, | ||
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream>, | ||
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream> | ||
): Promise<void>; | ||
@@ -365,5 +524,5 @@ } | ||
} | ||
declare module 'node:stream' { | ||
import stream = require('stream'); | ||
declare module "node:stream" { | ||
import stream = require("stream"); | ||
export = stream; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'string_decoder' { | ||
declare module "string_decoder" { | ||
class StringDecoder { | ||
@@ -8,4 +8,4 @@ constructor(encoding?: BufferEncoding); | ||
} | ||
declare module 'node:string_decoder' { | ||
export * from 'string_decoder'; | ||
declare module "node:string_decoder" { | ||
export * from "string_decoder"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'timers' { | ||
declare module "timers" { | ||
function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout; | ||
@@ -7,5 +7,5 @@ namespace setTimeout { | ||
} | ||
function clearTimeout(timeoutId: NodeJS.Timeout): void; | ||
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; | ||
function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout; | ||
function clearInterval(intervalId: NodeJS.Timeout): void; | ||
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; | ||
function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; | ||
@@ -16,6 +16,6 @@ namespace setImmediate { | ||
} | ||
function clearImmediate(immediateId: NodeJS.Immediate): void; | ||
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; | ||
} | ||
declare module 'node:timers' { | ||
export * from 'timers'; | ||
declare module "node:timers" { | ||
export * from "timers"; | ||
} |
@@ -1,4 +0,4 @@ | ||
declare module 'tls' { | ||
import * as net from 'net'; | ||
import * as stream from 'stream'; | ||
declare module "tls" { | ||
import * as net from "net"; | ||
import * as stream from "stream"; | ||
@@ -150,3 +150,3 @@ const CLIENT_RENEG_LIMIT: number; | ||
*/ | ||
encrypted: boolean; | ||
encrypted: true; | ||
@@ -270,3 +270,6 @@ /** | ||
*/ | ||
renegotiate(options: { rejectUnauthorized?: boolean | undefined, requestCert?: boolean | undefined }, callback: (err: Error | null) => void): undefined | boolean; | ||
renegotiate( | ||
options: { rejectUnauthorized?: boolean | undefined; requestCert?: boolean | undefined }, | ||
callback: (err: Error | null) => void, | ||
): undefined | boolean; | ||
/** | ||
@@ -409,3 +412,2 @@ * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). | ||
/** | ||
* | ||
* @param socket | ||
@@ -490,3 +492,2 @@ * @param identity identity parameter sent from the client. | ||
/** | ||
* | ||
* The server.setSecureContext() method replaces the | ||
@@ -515,5 +516,18 @@ * secure context of an existing server. Existing connections to the | ||
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; | ||
addListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
addListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, | ||
): this; | ||
addListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
addListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, | ||
): this; | ||
addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; | ||
@@ -524,5 +538,14 @@ addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; | ||
emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; | ||
emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; | ||
emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; | ||
emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; | ||
emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; | ||
emit( | ||
event: "OCSPRequest", | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
): boolean; | ||
emit( | ||
event: "resumeSession", | ||
sessionId: Buffer, | ||
callback: (err: Error | null, sessionData: Buffer | null) => void, | ||
): boolean; | ||
emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; | ||
@@ -533,5 +556,15 @@ emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; | ||
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; | ||
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; | ||
on( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
on( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, | ||
): this; | ||
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; | ||
@@ -542,5 +575,18 @@ on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; | ||
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; | ||
once(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
once( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, | ||
): this; | ||
once( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
once( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, | ||
): this; | ||
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; | ||
@@ -551,5 +597,18 @@ once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; | ||
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; | ||
prependListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
prependListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, | ||
): this; | ||
prependListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
prependListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, | ||
): this; | ||
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; | ||
@@ -560,5 +619,18 @@ prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; | ||
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; | ||
prependOnceListener(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; | ||
prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; | ||
prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; | ||
prependOnceListener( | ||
event: "newSession", | ||
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, | ||
): this; | ||
prependOnceListener( | ||
event: "OCSPRequest", | ||
listener: ( | ||
certificate: Buffer, | ||
issuer: Buffer, | ||
callback: (err: Error | null, resp: Buffer) => void, | ||
) => void, | ||
): this; | ||
prependOnceListener( | ||
event: "resumeSession", | ||
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, | ||
): this; | ||
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; | ||
@@ -573,3 +645,3 @@ prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; | ||
type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; | ||
type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; | ||
@@ -750,3 +822,8 @@ interface SecureContextOptions { | ||
function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; | ||
function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; | ||
function connect( | ||
port: number, | ||
host?: string, | ||
options?: ConnectionOptions, | ||
secureConnectListener?: () => void, | ||
): TLSSocket; | ||
function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; | ||
@@ -756,3 +833,8 @@ /** | ||
*/ | ||
function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; | ||
function createSecurePair( | ||
credentials?: SecureContext, | ||
isServer?: boolean, | ||
requestCert?: boolean, | ||
rejectUnauthorized?: boolean, | ||
): SecurePair; | ||
function createSecureContext(options?: SecureContextOptions): SecureContext; | ||
@@ -795,4 +877,4 @@ function getCiphers(): string[]; | ||
} | ||
declare module 'node:tls' { | ||
export * from 'tls'; | ||
declare module "node:tls" { | ||
export * from "tls"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'trace_events' { | ||
declare module "trace_events" { | ||
/** | ||
@@ -62,4 +62,4 @@ * The `Tracing` object is used to enable or disable tracing for sets of | ||
} | ||
declare module 'node:trace_events' { | ||
export * from 'trace_events'; | ||
declare module "node:trace_events" { | ||
export * from "trace_events"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'tty' { | ||
import * as net from 'net'; | ||
declare module "tty" { | ||
import * as net from "net"; | ||
@@ -67,4 +67,4 @@ function isatty(fd: number): boolean; | ||
} | ||
declare module 'node:tty' { | ||
export * from 'tty'; | ||
declare module "node:tty" { | ||
export * from "tty"; | ||
} |
@@ -1,3 +0,4 @@ | ||
declare module 'url' { | ||
import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring'; | ||
declare module "url" { | ||
import { ClientRequestArgs } from "node:http"; | ||
import { ParsedUrlQuery, ParsedUrlQueryInput } from "querystring"; | ||
@@ -46,3 +47,7 @@ // Input to `url.format` | ||
/** @deprecated since v11.0.0 - Use the WHATWG URL API. */ | ||
function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; | ||
function parse( | ||
urlStr: string, | ||
parseQueryString: false | undefined, | ||
slashesDenoteHost?: boolean, | ||
): UrlWithStringQuery; | ||
/** @deprecated since v11.0.0 - Use the WHATWG URL API. */ | ||
@@ -75,2 +80,29 @@ function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; | ||
function pathToFileURL(url: string): URL; | ||
/** | ||
* This utility function converts a URL object into an ordinary options object as | ||
* expected by the `http.request()` and `https.request()` APIs. | ||
* | ||
* ```js | ||
* import { urlToHttpOptions } from 'url'; | ||
* const myURL = new URL('https://a:b@測試?abc#foo'); | ||
* | ||
* console.log(urlToHttpOptions(myURL)); | ||
* | ||
* { | ||
* protocol: 'https:', | ||
* hostname: 'xn--g6w251d', | ||
* hash: '#foo', | ||
* search: '?abc', | ||
* pathname: '/', | ||
* path: '/?abc', | ||
* href: 'https://a:b@xn--g6w251d/?abc#foo', | ||
* auth: 'a:b' | ||
* } | ||
* | ||
* ``` | ||
* @since v14.18.0 | ||
* @param url The `WHATWG URL` object to convert to an options object. | ||
* @return Options object | ||
*/ | ||
function urlToHttpOptions(url: URL): ClientRequestArgs; | ||
@@ -103,7 +135,15 @@ interface URLFormatOptions { | ||
class URLSearchParams implements Iterable<[string, string]> { | ||
constructor(init?: URLSearchParams | string | Record<string, string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>); | ||
constructor( | ||
init?: | ||
| URLSearchParams | ||
| string | ||
| Record<string, string | ReadonlyArray<string>> | ||
| Iterable<[string, string]> | ||
| ReadonlyArray<[string, string]>, | ||
); | ||
readonly size: number; | ||
append(name: string, value: string): void; | ||
delete(name: string): void; | ||
entries(): IterableIterator<[string, string]>; | ||
forEach(callback: (value: string, name: string, searchParams: this) => void): void; | ||
forEach(callback: (value: string, name: string, searchParams: URLSearchParams) => void, thisArg?: any): void; | ||
get(name: string): string | null; | ||
@@ -119,5 +159,33 @@ getAll(name: string): string[]; | ||
} | ||
import { URL as _URL, URLSearchParams as _URLSearchParams } from "url"; | ||
global { | ||
interface URLSearchParams extends _URLSearchParams {} | ||
interface URL extends _URL {} | ||
interface Global { | ||
URL: typeof _URL; | ||
URLSearchParams: typeof _URLSearchParams; | ||
} | ||
/** | ||
* `URL` class is a global reference for `require('url').URL` | ||
* https://nodejs.org/api/url.html#the-whatwg-url-api | ||
* @since v10.0.0 | ||
*/ | ||
var URL: | ||
// For compatibility with "dom" and "webworker" URL declarations | ||
typeof globalThis extends { onmessage: any; URL: infer URL } ? URL | ||
: typeof _URL; | ||
/** | ||
* `URLSearchParams` class is a global reference for `require('url').URLSearchParams`. | ||
* https://nodejs.org/api/url.html#class-urlsearchparams | ||
* @since v10.0.0 | ||
*/ | ||
var URLSearchParams: | ||
// For compatibility with "dom" and "webworker" URLSearchParams declarations | ||
typeof globalThis extends { onmessage: any; URLSearchParams: infer URLSearchParams } ? URLSearchParams | ||
: typeof _URLSearchParams; | ||
} | ||
} | ||
declare module 'node:url' { | ||
export * from 'url'; | ||
declare module "node:url" { | ||
export * from "url"; | ||
} |
@@ -1,4 +0,15 @@ | ||
declare module 'util' { | ||
interface InspectOptions extends NodeJS.InspectOptions { } | ||
type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module'; | ||
declare module "util" { | ||
interface InspectOptions extends NodeJS.InspectOptions {} | ||
type Style = | ||
| "special" | ||
| "number" | ||
| "bigint" | ||
| "boolean" | ||
| "undefined" | ||
| "null" | ||
| "string" | ||
| "symbol" | ||
| "date" | ||
| "regexp" | ||
| "module"; | ||
type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string; | ||
@@ -14,7 +25,7 @@ interface InspectOptionsStylized extends InspectOptions { | ||
function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; | ||
function inspect(object: any, options: InspectOptions): string; | ||
function inspect(object: any, options?: InspectOptions): string; | ||
namespace inspect { | ||
let colors: NodeJS.Dict<[number, number]>; | ||
let styles: { | ||
[K in Style]: string | ||
[K in Style]: string; | ||
}; | ||
@@ -69,25 +80,70 @@ let defaultOptions: InspectOptions; | ||
function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; | ||
function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; | ||
function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<TResult>( | ||
fn: () => Promise<TResult>, | ||
): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; | ||
function callbackify<T1>( | ||
fn: (arg1: T1) => Promise<void>, | ||
): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, TResult>( | ||
fn: (arg1: T1) => Promise<TResult>, | ||
): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; | ||
function callbackify<T1, T2>( | ||
fn: (arg1: T1, arg2: T2) => Promise<void>, | ||
): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, T2, TResult>( | ||
fn: (arg1: T1, arg2: T2) => Promise<TResult>, | ||
): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
function callbackify<T1, T2, T3>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>, | ||
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, T2, T3, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>, | ||
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
function callbackify<T1, T2, T3, T4>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, T2, T3, T4, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>, | ||
): ( | ||
arg1: T1, | ||
arg2: T2, | ||
arg3: T3, | ||
arg4: T4, | ||
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, | ||
) => void; | ||
function callbackify<T1, T2, T3, T4, T5>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
function callbackify<T1, T2, T3, T4, T5, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
): ( | ||
arg1: T1, | ||
arg2: T2, | ||
arg3: T3, | ||
arg4: T4, | ||
arg5: T5, | ||
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, | ||
) => void; | ||
function callbackify<T1, T2, T3, T4, T5, T6>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; | ||
): ( | ||
arg1: T1, | ||
arg2: T2, | ||
arg3: T3, | ||
arg4: T4, | ||
arg5: T5, | ||
arg6: T6, | ||
callback: (err: NodeJS.ErrnoException) => void, | ||
) => void; | ||
function callbackify<T1, T2, T3, T4, T5, T6, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult> | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>, | ||
): ( | ||
arg1: T1, | ||
arg2: T2, | ||
arg3: T3, | ||
arg4: T4, | ||
arg5: T5, | ||
arg6: T6, | ||
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, | ||
) => void; | ||
@@ -107,14 +163,24 @@ interface CustomPromisifyLegacy<TCustom extends Function> extends Function { | ||
function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>; | ||
function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>; | ||
function promisify<T1, TResult>( | ||
fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void, | ||
): (arg1: T1) => Promise<TResult>; | ||
function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>; | ||
function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>; | ||
function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>; | ||
function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): | ||
(arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>; | ||
function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>; | ||
function promisify<T1, T2, TResult>( | ||
fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void, | ||
): (arg1: T1, arg2: T2) => Promise<TResult>; | ||
function promisify<T1, T2>( | ||
fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void, | ||
): (arg1: T1, arg2: T2) => Promise<void>; | ||
function promisify<T1, T2, T3, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void, | ||
): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>; | ||
function promisify<T1, T2, T3>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void, | ||
): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>; | ||
function promisify<T1, T2, T3, T4, TResult>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>; | ||
function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): | ||
(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>; | ||
function promisify<T1, T2, T3, T4>( | ||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void, | ||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>; | ||
function promisify<T1, T2, T3, T4, T5, TResult>( | ||
@@ -153,6 +219,4 @@ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, | ||
object: T | {}, | ||
): object is T extends ReadonlyMap<any, any> | ||
? unknown extends T | ||
? never | ||
: ReadonlyMap<any, any> | ||
): object is T extends ReadonlyMap<any, any> ? unknown extends T ? never | ||
: ReadonlyMap<any, any> | ||
: Map<any, any>; | ||
@@ -168,6 +232,4 @@ function isMapIterator(object: any): boolean; | ||
object: T | {}, | ||
): object is T extends ReadonlySet<any> | ||
? unknown extends T | ||
? never | ||
: ReadonlySet<any> | ||
): object is T extends ReadonlySet<any> ? unknown extends T ? never | ||
: ReadonlySet<any> | ||
: Set<any>; | ||
@@ -192,8 +254,8 @@ function isSetIterator(object: any): boolean; | ||
constructor( | ||
encoding?: string, | ||
options?: { fatal?: boolean | undefined; ignoreBOM?: boolean | undefined } | ||
encoding?: string, | ||
options?: { fatal?: boolean | undefined; ignoreBOM?: boolean | undefined }, | ||
); | ||
decode( | ||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null, | ||
options?: { stream?: boolean | undefined } | ||
input?: NodeJS.ArrayBufferView | ArrayBuffer | null, | ||
options?: { stream?: boolean | undefined }, | ||
): string; | ||
@@ -220,4 +282,4 @@ } | ||
} | ||
declare module 'node:util' { | ||
export * from 'util'; | ||
declare module "node:util" { | ||
export * from "util"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'v8' { | ||
import { Readable } from 'stream'; | ||
declare module "v8" { | ||
import { Readable } from "stream"; | ||
@@ -55,3 +55,2 @@ interface HeapSpaceInfo { | ||
/** | ||
* | ||
* @param fileName The file path where the V8 heap snapshot is to be | ||
@@ -189,4 +188,4 @@ * saved. If not specified, a file name with the pattern | ||
} | ||
declare module 'node:v8' { | ||
export * from 'v8'; | ||
declare module "node:v8" { | ||
export * from "v8"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'vm' { | ||
interface Context extends NodeJS.Dict<any> { } | ||
declare module "vm" { | ||
interface Context extends NodeJS.Dict<any> {} | ||
interface BaseOptions { | ||
@@ -48,3 +48,3 @@ /** | ||
*/ | ||
microtaskMode?: 'afterEvaluate' | undefined; | ||
microtaskMode?: "afterEvaluate" | undefined; | ||
} | ||
@@ -102,6 +102,6 @@ interface CompileFunctionOptions extends BaseOptions { | ||
*/ | ||
microtaskMode?: 'afterEvaluate' | undefined; | ||
microtaskMode?: "afterEvaluate" | undefined; | ||
} | ||
type MeasureMemoryMode = 'summary' | 'detailed'; | ||
type MeasureMemoryMode = "summary" | "detailed"; | ||
@@ -155,4 +155,4 @@ interface MeasureMemoryOptions { | ||
} | ||
declare module 'node:vm' { | ||
export * from 'vm'; | ||
declare module "node:vm" { | ||
export * from "vm"; | ||
} |
@@ -1,2 +0,2 @@ | ||
declare module 'wasi' { | ||
declare module "wasi" { | ||
interface WASIOptions { | ||
@@ -55,3 +55,2 @@ /** | ||
/** | ||
* | ||
* Attempt to begin execution of `instance` by invoking its `_start()` export. | ||
@@ -88,4 +87,4 @@ * If `instance` does not contain a `_start()` export, then `start()` attempts to | ||
} | ||
declare module 'node:wasi' { | ||
export * from 'wasi'; | ||
declare module "node:wasi" { | ||
export * from "wasi"; | ||
} |
@@ -1,7 +0,7 @@ | ||
declare module 'worker_threads' { | ||
import { Context } from 'vm'; | ||
import EventEmitter = require('events'); | ||
import { Readable, Writable } from 'stream'; | ||
import { URL } from 'url'; | ||
import { FileHandle } from 'fs/promises'; | ||
declare module "worker_threads" { | ||
import { Context } from "vm"; | ||
import EventEmitter = require("events"); | ||
import { Readable, Writable } from "stream"; | ||
import { URL } from "url"; | ||
import { FileHandle } from "fs/promises"; | ||
@@ -239,4 +239,4 @@ const isMainThread: boolean; | ||
} | ||
declare module 'node:worker_threads' { | ||
export * from 'worker_threads'; | ||
declare module "node:worker_threads" { | ||
export * from "worker_threads"; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare module 'zlib' { | ||
import * as stream from 'stream'; | ||
declare module "zlib" { | ||
import * as stream from "stream"; | ||
@@ -66,11 +66,11 @@ interface ZlibOptions { | ||
interface BrotliCompress extends stream.Transform, Zlib { } | ||
interface BrotliDecompress extends stream.Transform, Zlib { } | ||
interface Gzip extends stream.Transform, Zlib { } | ||
interface Gunzip extends stream.Transform, Zlib { } | ||
interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { } | ||
interface Inflate extends stream.Transform, Zlib, ZlibReset { } | ||
interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { } | ||
interface InflateRaw extends stream.Transform, Zlib, ZlibReset { } | ||
interface Unzip extends stream.Transform, Zlib { } | ||
interface BrotliCompress extends stream.Transform, Zlib {} | ||
interface BrotliDecompress extends stream.Transform, Zlib {} | ||
interface Gzip extends stream.Transform, Zlib {} | ||
interface Gunzip extends stream.Transform, Zlib {} | ||
interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {} | ||
interface Inflate extends stream.Transform, Zlib, ZlibReset {} | ||
interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {} | ||
interface InflateRaw extends stream.Transform, Zlib, ZlibReset {} | ||
interface Unzip extends stream.Transform, Zlib {} | ||
@@ -363,4 +363,4 @@ function createBrotliCompress(options?: BrotliOptions): BrotliCompress; | ||
} | ||
declare module 'node:zlib' { | ||
export * from 'zlib'; | ||
declare module "node:zlib" { | ||
export * from "zlib"; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1608400
109.13%91
93.62%33004
127.32%