/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ // Adapted from https://github.com/flow-typed/flow-typed/blob/main/definitions/environments/node/flow_v0.261.x-/node.js interface ErrnoError extends Error { address?: string; code?: string; dest?: string; errno?: string | number; info?: Object; path?: string; port?: number; syscall?: string; } type Node$Conditional = T extends true ? IfTrue : T extends false ? IfFalse : IfTrue | IfFalse; type buffer$NonBufferEncoding = | 'hex' | 'HEX' | 'utf8' | 'UTF8' | 'utf-8' | 'UTF-8' | 'ascii' | 'ASCII' | 'binary' | 'BINARY' | 'base64' | 'BASE64' | 'ucs2' | 'UCS2' | 'ucs-2' | 'UCS-2' | 'utf16le' | 'UTF16LE' | 'utf-16le' | 'UTF-16LE' | 'latin1'; type buffer$Encoding = buffer$NonBufferEncoding | 'buffer'; type buffer$ToJSONRet = { type: string, data: Array, ... }; declare class Buffer extends Uint8Array { constructor( value: Array | number | string | Buffer | ArrayBuffer, encoding?: buffer$Encoding, ): void; [i: number]: number; length: number; compare(otherBuffer: Buffer): number; copy( targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number, ): number; entries(): Iterator<[number, number]>; equals(otherBuffer: Buffer): boolean; fill( value: string | Buffer | number, offset?: number, end?: number, encoding?: string, ): this; fill(value: string, encoding?: string): this; includes( value: string | Buffer | number, offsetOrEncoding?: number | buffer$Encoding, encoding?: buffer$Encoding, ): boolean; indexOf( value: string | Buffer | number, offsetOrEncoding?: number | buffer$Encoding, encoding?: buffer$Encoding, ): number; inspect(): string; keys(): Iterator; lastIndexOf( value: string | Buffer | number, offsetOrEncoding?: number | buffer$Encoding, encoding?: buffer$Encoding, ): number; readDoubleBE(offset?: number, noAssert?: boolean): number; readDoubleLE(offset?: number, noAssert?: boolean): number; readFloatBE(offset?: number, noAssert?: boolean): number; readFloatLE(offset?: number, noAssert?: boolean): number; readInt16BE(offset?: number, noAssert?: boolean): number; readInt16LE(offset?: number, noAssert?: boolean): number; readInt32BE(offset?: number, noAssert?: boolean): number; readInt32LE(offset?: number, noAssert?: boolean): number; readInt8(offset?: number, noAssert?: boolean): number; readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; readUInt16BE(offset?: number, noAssert?: boolean): number; readUInt16LE(offset?: number, noAssert?: boolean): number; readUInt32BE(offset?: number, noAssert?: boolean): number; readUInt32LE(offset?: number, noAssert?: boolean): number; readUInt8(offset?: number, noAssert?: boolean): number; readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; slice(start?: number, end?: number): this; swap16(): Buffer; swap32(): Buffer; swap64(): Buffer; toJSON(): buffer$ToJSONRet; toString(encoding?: buffer$Encoding, start?: number, end?: number): string; values(): Iterator; write( string: string, offset?: number, length?: number, encoding?: buffer$Encoding, ): number; writeDoubleBE(value: number, offset?: number, noAssert?: boolean): number; writeDoubleLE(value: number, offset?: number, noAssert?: boolean): number; writeFloatBE(value: number, offset?: number, noAssert?: boolean): number; writeFloatLE(value: number, offset?: number, noAssert?: boolean): number; writeInt16BE(value: number, offset?: number, noAssert?: boolean): number; writeInt16LE(value: number, offset?: number, noAssert?: boolean): number; writeInt32BE(value: number, offset?: number, noAssert?: boolean): number; writeInt32LE(value: number, offset?: number, noAssert?: boolean): number; writeInt8(value: number, offset?: number, noAssert?: boolean): number; writeIntBE( value: number, offset: number, byteLength: number, noAssert?: boolean, ): number; writeIntLE( value: number, offset: number, byteLength: number, noAssert?: boolean, ): number; writeUInt16BE(value: number, offset?: number, noAssert?: boolean): number; writeUInt16LE(value: number, offset?: number, noAssert?: boolean): number; writeUInt32BE(value: number, offset?: number, noAssert?: boolean): number; writeUInt32LE(value: number, offset?: number, noAssert?: boolean): number; writeUInt8(value: number, offset?: number, noAssert?: boolean): number; writeUIntBE( value: number, offset: number, byteLength: number, noAssert?: boolean, ): number; writeUIntLE( value: number, offset: number, byteLength: number, noAssert?: boolean, ): number; static alloc( size: number, fill?: string | number, encoding?: buffer$Encoding, ): Buffer; static allocUnsafe(size: number): Buffer; static allocUnsafeSlow(size: number): Buffer; static byteLength( string: string | Buffer | $TypedArray | DataView | ArrayBuffer, encoding?: buffer$Encoding, ): number; static compare(buf1: Buffer, buf2: Buffer): number; static concat(list: Array, totalLength?: number): Buffer; static from(value: Buffer): Buffer; static from(value: string, encoding?: buffer$Encoding): Buffer; static from( value: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number, ): Buffer; static from(value: Iterable): this; static isBuffer(obj: any): boolean; static isEncoding(encoding: string): boolean; } declare type Node$Buffer = typeof Buffer; declare module 'buffer' { declare var kMaxLength: number; declare var INSPECT_MAX_BYTES: number; declare var constants: Readonly<{ MAX_LENGTH: number, MAX_STRING_LENGTH: number, }>; declare function transcode( source: Node$Buffer, fromEnc: buffer$Encoding, toEnc: buffer$Encoding, ): Node$Buffer; declare function isUtf8(input: Buffer | ArrayBuffer | $TypedArray): boolean; declare function isAscii(input: Buffer | ArrayBuffer | $TypedArray): boolean; declare function resolveObjectURL(id: string): Blob | void; declare var Buffer: Node$Buffer; declare var Blob: typeof globalThis.Blob; declare var File: typeof globalThis.File; } type child_process$execOpts = Readonly<{ cwd?: string, env?: Readonly<{[key: string]: string | number | void}>, encoding?: buffer$NonBufferEncoding | 'buffer' | string, shell?: string, timeout?: number, maxBuffer?: number, killSignal?: string | number, uid?: number, gid?: number, windowsHide?: boolean, signal?: AbortSignal, }>; declare class child_process$Error extends Error { code: number | string | null; errno?: string; syscall?: string; path?: string; spawnargs?: Array; killed?: boolean; signal?: string | null; cmd: string; } type child_process$execCallback = ( error: ?child_process$Error, stdout: T, stderr: T, ) => void; type child_process$execSyncOpts = Readonly<{ cwd?: string, input?: string | Buffer | $TypedArray | DataView, stdio?: string | Array, env?: Readonly<{[key: string]: string | number | void}>, shell?: string, uid?: number, gid?: number, timeout?: number, killSignal?: string | number, maxBuffer?: number, encoding?: buffer$NonBufferEncoding | 'buffer' | string, windowsHide?: boolean, }>; type child_process$execFileOpts = Readonly<{ cwd?: string, env?: Readonly<{[key: string]: string | number | void}>, encoding?: buffer$NonBufferEncoding | 'buffer' | string, timeout?: number, maxBuffer?: number, killSignal?: string | number, uid?: number, gid?: number, windowsHide?: boolean, windowsVerbatimArguments?: boolean, shell?: boolean | string, signal?: AbortSignal, }>; type child_process$execFileCallback = child_process$execCallback; type child_process$execFileSyncOpts = Readonly<{ cwd?: string, input?: string | Buffer | $TypedArray | DataView, stdio?: string | Array, env?: {[key: string]: string | number | void}, uid?: number, gid?: number, timeout?: number, killSignal?: string | number, maxBuffer?: number, encoding?: buffer$NonBufferEncoding | 'buffer' | string, windowsHide?: boolean, shell?: boolean | string, }>; type child_process$forkOpts = Readonly<{ cwd?: string, env?: Readonly<{[key: string]: string | number | void}>, execPath?: string, execArgv?: ReadonlyArray, silent?: boolean, stdio?: | child_process$StdioPipe | string | Readonly< [ child_process$StdioPipe, child_process$StdioPipe, child_process$StdioPipe, ... ], > | Readonly< [ child_process$StdioPipe, child_process$StdioPipe, string | number, ... ], > | Readonly< [ child_process$StdioPipe, string | number, child_process$StdioPipe, ... ], > | Readonly< [ string | number, child_process$StdioPipe, child_process$StdioPipe, ... ], > | Readonly<[child_process$StdioPipe, string | number, string | number, ...]> | Readonly<[string | number, child_process$StdioPipe, string | number, ...]> | Readonly<[string | number, string | number, child_process$StdioPipe, ...]> | Readonly<[string | number, string | number, string | number, ...]>, windowsVerbatimArguments?: boolean, uid?: number, gid?: number, serialization?: 'json' | 'advanced', killSignal?: string | number, timeout?: number, signal?: AbortSignal, }>; type child_process$Handle = any; // TODO type child_process$StdioPipe = 'pipe' | 'overlapped'; type child_process$spawnOpts = Readonly<{ cwd?: string, env?: Readonly<{[key: string]: string | number | void}>, encoding?: buffer$NonBufferEncoding | 'buffer' | string, argv0?: string, stdio?: | child_process$StdioPipe | string | Readonly< [ child_process$StdioPipe, child_process$StdioPipe, child_process$StdioPipe, ... ], > | Readonly< [ child_process$StdioPipe, child_process$StdioPipe, string | number, ... ], > | Readonly< [ child_process$StdioPipe, string | number, child_process$StdioPipe, ... ], > | Readonly< [ string | number, child_process$StdioPipe, child_process$StdioPipe, ... ], > | Readonly<[child_process$StdioPipe, string | number, string | number, ...]> | Readonly<[string | number, child_process$StdioPipe, string | number, ...]> | Readonly<[string | number, string | number, child_process$StdioPipe, ...]> | Readonly<[string | number, string | number, string | number, ...]>, detached?: boolean, uid?: number, gid?: number, shell?: boolean | string, windowsVerbatimArguments?: boolean, windowsHide?: boolean, signal?: AbortSignal, killSignal?: string | number, timeout?: number, serialization?: 'json' | 'advanced', }>; type child_process$spawnSyncRet = Readonly<{ pid: number, output: Array, // TODO: subprocess.stdout may be null in case of error stdout: T, // TODO: subprocess.stderr may be null in case of error stderr: T, // TODO: subprocess.status may be null in case of error or signal status: number, signal: string | null, error: Error | void, }>; type child_process$spawnSyncOpts = Readonly<{ cwd?: string, input?: string | Buffer, stdio?: string | ReadonlyArray, env?: Readonly<{[key: string]: string | number | void}>, uid?: number, gid?: number, timeout?: number, killSignal?: string | number, maxBuffer?: number, encoding?: buffer$NonBufferEncoding | 'buffer' | string, shell?: boolean | string, windowsHide?: boolean, windowsVerbatimArguments?: boolean, }>; type child_process$Serializable = | string | number | boolean | bigint | {[key: string]: child_process$Serializable} | Array; type child_process$SendHandle = net$Server | net$Socket; declare class child_process$ChildProcessTyped< TStdin extends stream$Writable | null, TStdout extends stream$Readable | null, TStderr extends stream$Readable | null, > extends events$EventEmitter { +stdin: TStdin; +stdout: TStdout; +stderr: TStderr; +channel: unknown; +stdio: [TStdin, TStdout, TStderr, ...]; +killed: boolean; +pid: number; +connected: boolean; +exitCode: number | null; +signalCode: string | null; +spawnargs: Array; +spawnfile: string; disconnect(): void; kill(signal?: string | number): boolean; send( message: child_process$Serializable, callback?: (error: Error | null) => void, ): boolean; send( message: child_process$Serializable, sendHandle: child_process$SendHandle, callback?: (error: Error | null) => void, ): boolean; send( message: child_process$Serializable, sendHandle: child_process$SendHandle, options: Readonly<{keepOpen?: boolean}>, callback?: (error: Error | null) => void, ): boolean; unref(): void; ref(): void; } /** * @deprecated - Unsafely assumes stdio is piped */ declare type child_process$ChildProcess = child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare module 'child_process' { declare type ExecOptions = child_process$execOpts; declare type ExecFileOptions = child_process$execFileOpts; declare type ExecSyncOptions = child_process$execSyncOpts; declare type ForkOptions = child_process$forkOpts; declare type SpawnOptions = child_process$spawnOpts; declare type SpawnSyncOptions = child_process$spawnSyncOpts; declare var ChildProcess: typeof child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; type StringOrBuffer = Opts extends Readonly<{encoding: infer E, ...}> ? E extends buffer$NonBufferEncoding ? string : E extends 'buffer' ? Buffer : string | Buffer : Default; type StreamForChannel = Channel extends 0 ? stream$Writable : stream$Readable; type MaybeStream< Opts, FD extends 0 | 1 | 2, PipeByDefault extends true | false = true, > = Opts extends Readonly<{stdio: infer E, ...}> ? E extends child_process$StdioPipe ? StreamForChannel : E extends string ? null : E[FD] extends child_process$StdioPipe ? StreamForChannel : E[FD] extends string | number ? null : null | StreamForChannel : PipeByDefault extends true ? StreamForChannel : null; declare function exec( command: string, callback?: child_process$execCallback, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function exec( command: string, options: Opts, callback?: child_process$execCallback>, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function execSync( command: string, ): Buffer; declare function execSync( command: string, options: Opts, ): StringOrBuffer; declare function execFile( file: string, argsOrCallback?: | ReadonlyArray | child_process$execFileCallback, callback?: child_process$execFileCallback, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function execFile( file: string, args: ReadonlyArray, options: Opts, callback?: child_process$execFileCallback>, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function execFile( file: string, options: Opts, callback?: child_process$execFileCallback>, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function execFileSync( command: string, args?: ReadonlyArray, ): Buffer; declare function execFileSync( command: string, args: ReadonlyArray, options: Opts, ): StringOrBuffer; declare function execFileSync( command: string, options: Opts, ): StringOrBuffer; declare function fork( modulePath: string, args?: ReadonlyArray, ): child_process$ChildProcessTyped; declare function fork( modulePath: string, args: ReadonlyArray, options: Opts, ): child_process$ChildProcessTyped< MaybeStream, MaybeStream, MaybeStream, >; declare function fork( modulePath: string, options: Opts, ): child_process$ChildProcessTyped< MaybeStream, MaybeStream, MaybeStream, >; declare function spawn( command: string, args?: ReadonlyArray, ): child_process$ChildProcessTyped< stream$Writable, stream$Readable, stream$Readable, >; declare function spawn( command: string, args: ReadonlyArray, options: Opts, ): child_process$ChildProcessTyped< MaybeStream, MaybeStream, MaybeStream, >; declare function spawn( command: string, options: Opts, ): child_process$ChildProcessTyped< MaybeStream, MaybeStream, MaybeStream, >; declare function spawnSync( command: string, args?: ReadonlyArray, ): child_process$spawnSyncRet; declare function spawnSync( command: string, args: ReadonlyArray, options: Opts, ): child_process$spawnSyncRet>; declare function spawnSync( command: string, options: Opts, ): child_process$spawnSyncRet>; } declare module 'cluster' { declare type ClusterSettings = { execArgv: Array, exec: string, args: Array, cwd: string, serialization: 'json' | 'advanced', silent: boolean, stdio: Array, uid: number, gid: number, inspectPort: number | (() => number), windowsHide: boolean, ... }; declare type ClusterSettingsOpt = { execArgv?: Array, exec?: string, args?: Array, cwd?: string, serialization?: 'json' | 'advanced', silent?: boolean, stdio?: Array, uid?: number, gid?: number, inspectPort?: number | (() => number), windowsHide?: boolean, ... }; declare class Worker extends events$EventEmitter { id: number; process: child_process$ChildProcess; suicide: boolean; disconnect(): void; isConnected(): boolean; isDead(): boolean; kill(signal?: string): void; send( message: Object, sendHandleOrCallback?: child_process$Handle | Function, callback?: Function, ): boolean; } declare class Cluster extends events$EventEmitter { isMaster: boolean; isWorker: boolean; settings: ClusterSettings; worker: Worker; workers: {[id: number]: Worker}; disconnect(callback?: () => void): void; fork(env?: Object): Worker; setupMaster(settings?: ClusterSettingsOpt): void; } declare module.exports: Cluster; } type crypto$createCredentialsDetails = any; // TODO declare class crypto$Cipher extends stream$Duplex { final(output_encoding: 'latin1' | 'binary' | 'base64' | 'hex'): string; final(output_encoding: void): Buffer; getAuthTag(): Buffer; setAAD(buffer: Buffer): crypto$Cipher; setAuthTag(buffer: Buffer): void; setAutoPadding(auto_padding?: boolean): crypto$Cipher; update( data: string, input_encoding: 'utf8' | 'ascii' | 'latin1' | 'binary', output_encoding: 'latin1' | 'binary' | 'base64' | 'hex', ): string; update( data: string, input_encoding: 'utf8' | 'ascii' | 'latin1' | 'binary', output_encoding: void, ): Buffer; update( data: Buffer, input_encoding: void | 'utf8' | 'ascii' | 'latin1' | 'binary', output_encoding: 'latin1' | 'binary' | 'base64' | 'hex', ): string; update(data: Buffer, input_encoding: void, output_encoding: void): Buffer; } type crypto$Credentials = {...}; type crypto$DiffieHellman = { computeSecret( other_public_key: string, input_encoding?: string, output_encoding?: string, ): any, generateKeys(encoding?: string): any, getGenerator(encoding?: string): any, getPrime(encoding?: string): any, getPrivateKey(encoding?: string): any, getPublicKey(encoding?: string): any, setPrivateKey(private_key: any, encoding?: string): void, setPublicKey(public_key: any, encoding?: string): void, ... }; type crypto$ECDH$Encoding = 'latin1' | 'hex' | 'base64'; type crypto$ECDH$Format = 'compressed' | 'uncompressed'; declare class crypto$ECDH { computeSecret(other_public_key: Buffer | $TypedArray | DataView): Buffer; computeSecret( other_public_key: string, input_encoding: crypto$ECDH$Encoding, ): Buffer; computeSecret( other_public_key: Buffer | $TypedArray | DataView, output_encoding: crypto$ECDH$Encoding, ): string; computeSecret( other_public_key: string, input_encoding: crypto$ECDH$Encoding, output_encoding: crypto$ECDH$Encoding, ): string; generateKeys(format?: crypto$ECDH$Format): Buffer; generateKeys( encoding: crypto$ECDH$Encoding, format?: crypto$ECDH$Format, ): string; getPrivateKey(): Buffer; getPrivateKey(encoding: crypto$ECDH$Encoding): string; getPublicKey(format?: crypto$ECDH$Format): Buffer; getPublicKey( encoding: crypto$ECDH$Encoding, format?: crypto$ECDH$Format, ): string; setPrivateKey(private_key: Buffer | $TypedArray | DataView): void; setPrivateKey(private_key: string, encoding: crypto$ECDH$Encoding): void; } declare class crypto$Decipher extends stream$Duplex { final(output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8'): string; final(output_encoding: void): Buffer; getAuthTag(): Buffer; setAAD(buffer: Buffer): void; setAuthTag(buffer: Buffer): void; setAutoPadding(auto_padding?: boolean): crypto$Cipher; update( data: string, input_encoding: 'latin1' | 'binary' | 'base64' | 'hex', output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8', ): string; update( data: string, input_encoding: 'latin1' | 'binary' | 'base64' | 'hex', output_encoding: void, ): Buffer; update( data: Buffer, input_encoding: void, output_encoding: 'latin1' | 'binary' | 'ascii' | 'utf8', ): string; update(data: Buffer, input_encoding: void, output_encoding: void): Buffer; } declare class crypto$Hash extends stream$Duplex { digest(encoding: 'hex' | 'latin1' | 'binary' | 'base64'): string; digest(encoding: 'buffer'): Buffer; digest(encoding: void): Buffer; update( data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary', ): crypto$Hash; copy(options?: unknown): crypto$Hash; } declare class crypto$Hmac extends stream$Duplex { digest(encoding: 'hex' | 'latin1' | 'binary' | 'base64'): string; digest(encoding: 'buffer'): Buffer; digest(encoding: void): Buffer; update( data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary', ): crypto$Hmac; } type crypto$Sign$private_key = | string | { key: string, passphrase: string, ... }; declare class crypto$Sign extends stream$Writable { static (algorithm: string, options?: writableStreamOptions): crypto$Sign; constructor(algorithm: string, options?: writableStreamOptions): void; sign( private_key: crypto$Sign$private_key, output_format: 'latin1' | 'binary' | 'hex' | 'base64', ): string; sign(private_key: crypto$Sign$private_key, output_format: void): Buffer; update( data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary', ): crypto$Sign; } declare class crypto$Verify extends stream$Writable { static (algorithm: string, options?: writableStreamOptions): crypto$Verify; constructor(algorithm: string, options?: writableStreamOptions): void; update( data: string | Buffer, input_encoding?: 'utf8' | 'ascii' | 'latin1' | 'binary', ): crypto$Verify; verify( object: string, signature: string | Buffer | $TypedArray | DataView, signature_format: 'latin1' | 'binary' | 'hex' | 'base64', ): boolean; verify(object: string, signature: Buffer, signature_format: void): boolean; } type crypto$key = | string | { key: string, passphrase?: string, // TODO: enum type in crypto.constants padding?: string, ... }; declare class crypto$KeyObject { +asymmetricKeyType?: | 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; +asymmetricKeySize?: number; +symmetricKeySize?: number; +type: 'secret' | 'public' | 'private'; export( options: Readonly<{ type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1', format: 'pem', }>, ): string; export( options: Readonly<{ type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1', format: 'der', }>, ): Buffer; export(options: Readonly<{format: 'jwk'}>): unknown; equals(otherKeyObject: crypto$KeyObject): boolean; } declare class crypto$X509Certificate { constructor(buffer: string | Buffer | $TypedArray | DataView): void; +ca: boolean; +fingerprint: string; +fingerprint256: string; +fingerprint512: string; +issuer: string; +issuerCertificate?: crypto$X509Certificate; +keyUsage: Array; +publicKey: crypto$KeyObject; +raw: Buffer; +serialNumber: string; +subject: string; +subjectAltName: string; +validFrom: string; +validTo: string; +validFromDate: Date; +validToDate: Date; checkEmail( email: string, options?: Readonly<{subject?: 'always' | 'default' | 'never'}>, ): string | void; checkHost( name: string, options?: Readonly<{subject?: 'always' | 'default' | 'never'}>, ): string | void; checkIP(ip: string): string | void; checkIssued(otherCert: crypto$X509Certificate): boolean; checkPrivateKey(privateKey: crypto$KeyObject): boolean; toJSON(): string; toLegacyObject(): unknown; toString(): string; verify(publicKey: crypto$KeyObject): boolean; } declare class crypto$Certificate { static exportChallenge( spkac: string | Buffer | $TypedArray | DataView, ): Buffer; static exportPublicKey( spkac: string | Buffer | $TypedArray | DataView, ): Buffer; static verifySpkac(spkac: Buffer | $TypedArray | DataView): boolean; } declare module 'crypto' { declare var DEFAULT_ENCODING: string; declare class Sign extends crypto$Sign {} declare class Verify extends crypto$Verify {} declare function createCipher( algorithm: string, password: string | Buffer, ): crypto$Cipher; declare function createCipheriv( algorithm: string, key: string | Buffer, iv: string | Buffer, ): crypto$Cipher; declare function createCredentials( details?: crypto$createCredentialsDetails, ): crypto$Credentials; declare function createDecipher( algorithm: string, password: string | Buffer, ): crypto$Decipher; declare function createDecipheriv( algorithm: string, key: string | Buffer, iv: string | Buffer, ): crypto$Decipher; declare function createDiffieHellman( prime_length: number, ): crypto$DiffieHellman; declare function createDiffieHellman( prime: number, encoding?: string, ): crypto$DiffieHellman; declare function createECDH(curveName: string): crypto$ECDH; declare function createHash(algorithm: string): crypto$Hash; declare function createHmac( algorithm: string, key: string | Buffer, ): crypto$Hmac; declare function createSign(algorithm: string): crypto$Sign; declare function createVerify(algorithm: string): crypto$Verify; declare function getCiphers(): Array; declare function getCurves(): Array; declare function getDiffieHellman(group_name: string): crypto$DiffieHellman; declare function getHashes(): Array; declare function pbkdf2( password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: ?Error, derivedKey: Buffer) => void, ): void; declare function pbkdf2( password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, callback: (err: ?Error, derivedKey: Buffer) => void, ): void; declare function pbkdf2Sync( password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest?: string, ): Buffer; declare function scrypt( password: string | Buffer, salt: string | Buffer, keylen: number, options: | {|N?: number, r?: number, p?: number, maxmem?: number|} | {| cost?: number, blockSize?: number, parallelization?: number, maxmem?: number, |}, callback: (err: ?Error, derivedKey: Buffer) => void, ): void; declare function scrypt( password: string | Buffer, salt: string | Buffer, keylen: number, callback: (err: ?Error, derivedKey: Buffer) => void, ): void; declare function scryptSync( password: string | Buffer, salt: string | Buffer, keylen: number, options?: | {|N?: number, r?: number, p?: number, maxmem?: number|} | {| cost?: number, blockSize?: number, parallelization?: number, maxmem?: number, |}, ): Buffer; declare function privateDecrypt( private_key: crypto$key, buffer: Buffer, ): Buffer; declare function privateEncrypt( private_key: crypto$key, buffer: Buffer, ): Buffer; declare function publicDecrypt(key: crypto$key, buffer: Buffer): Buffer; declare function publicEncrypt(key: crypto$key, buffer: Buffer): Buffer; // `UNUSED` argument strictly enforces arity to enable overloading this // function with 1-arg and 2-arg variants. declare function pseudoRandomBytes(size: number, UNUSED: void): Buffer; declare function pseudoRandomBytes( size: number, callback: (err: ?Error, buffer: Buffer) => void, ): void; // `UNUSED` argument strictly enforces arity to enable overloading this // function with 1-arg and 2-arg variants. declare function randomBytes(size: number, UNUSED: void): Buffer; declare function randomBytes( size: number, callback: (err: ?Error, buffer: Buffer) => void, ): void; declare function randomFillSync( buffer: Buffer | $TypedArray | DataView, ): void; declare function randomFillSync( buffer: Buffer | $TypedArray | DataView, offset: number, ): void; declare function randomFillSync( buffer: Buffer | $TypedArray | DataView, offset: number, size: number, ): void; declare function randomFill( buffer: Buffer | $TypedArray | DataView, callback: (err: ?Error, buffer: Buffer) => void, ): void; declare function randomFill( buffer: Buffer | $TypedArray | DataView, offset: number, callback: (err: ?Error, buffer: Buffer) => void, ): void; declare function randomFill( buffer: Buffer | $TypedArray | DataView, offset: number, size: number, callback: (err: ?Error, buffer: Buffer) => void, ): void; declare function randomUUID( options?: Readonly<{disableEntropyCache?: boolean}>, ): string; declare function timingSafeEqual( a: Buffer | $TypedArray | DataView, b: Buffer | $TypedArray | DataView, ): boolean; declare function hash( algorithm: string, data: string | Buffer | $TypedArray | DataView, ): Buffer; declare function hash( algorithm: string, data: string | Buffer | $TypedArray | DataView, outputEncoding: buffer$Encoding, ): string; declare function createSecretKey( key: Buffer | $TypedArray | DataView, ): crypto$KeyObject; declare function createSecretKey( key: string, encoding: buffer$Encoding, ): crypto$KeyObject; declare function createPublicKey( key: string | Buffer | crypto$KeyObject | unknown, ): crypto$KeyObject; declare function createPrivateKey( key: string | Buffer | unknown, ): crypto$KeyObject; declare function generateKeyPair( type: | 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448', options: unknown, callback: ( err: ?Error, publicKey: crypto$KeyObject, privateKey: crypto$KeyObject, ) => void, ): void; declare function generateKeyPairSync( type: | 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448', options: unknown, ): {publicKey: crypto$KeyObject, privateKey: crypto$KeyObject, ...}; declare function generateKey( type: 'hmac' | 'aes', options: Readonly<{length: number}>, callback: (err: ?Error, key: crypto$KeyObject) => void, ): void; declare function generateKeySync( type: 'hmac' | 'aes', options: Readonly<{length: number}>, ): crypto$KeyObject; declare function checkPrime( candidate: Buffer | $TypedArray | DataView | bigint, options?: Readonly<{checks?: number}>, callback: (err: ?Error, result: boolean) => void, ): void; declare function checkPrimeSync( candidate: Buffer | $TypedArray | DataView | bigint, options?: Readonly<{checks?: number}>, ): boolean; declare class Certificate extends crypto$Certificate {} declare class X509Certificate extends crypto$X509Certificate {} declare class KeyObject extends crypto$KeyObject {} declare var webcrypto: unknown; } type net$Socket$address = { address: string, family: string, port: number, ... }; type dgram$Socket$rinfo = { address: string, family: 'IPv4' | 'IPv6', port: number, size: number, ... }; declare class dgram$Socket extends events$EventEmitter { addMembership(multicastAddress: string, multicastInterface?: string): void; address(): net$Socket$address; bind(port?: number, address?: string, callback?: () => void): void; close(callback?: () => void): void; dropMembership(multicastAddress: string, multicastInterface?: string): void; ref(): void; send( msg: Buffer, port: number, address: string, callback?: (err: ?Error, bytes: any) => unknown, ): void; send( msg: Buffer, offset: number, length: number, port: number, address: string, callback?: (err: ?Error, bytes: any) => unknown, ): void; setBroadcast(flag: boolean): void; setMulticastLoopback(flag: boolean): void; setMulticastTTL(ttl: number): void; setTTL(ttl: number): void; unref(): void; } declare module 'dgram' { declare function createSocket( options: string | {type: string, ...}, callback?: () => void, ): dgram$Socket; } declare module 'dns' { declare var ADDRGETNETWORKPARAMS: string; declare var BADFAMILY: string; declare var BADFLAGS: string; declare var BADHINTS: string; declare var BADQUERY: string; declare var BADNAME: string; declare var BADRESP: string; declare var BADSTR: string; declare var CANCELLED: string; declare var CONNREFUSED: string; declare var DESTRUCTION: string; declare var EOF: string; declare var FILE: string; declare var FORMER: string; declare var LOADIPHLPAPI: string; declare var NODATA: string; declare var NOMEM: string; declare var NONAME: string; declare var NOTFOUND: string; declare var NOTIMP: string; declare var NOTINITIALIZED: string; declare var REFUSED: string; declare var SERVFAIL: string; declare var TIMEOUT: string; declare var ADDRCONFIG: number; declare var V4MAPPED: number; declare type LookupOptions = { family?: number, hints?: number, verbatim?: boolean, all?: boolean, ... }; declare function lookup( domain: string, options: number | LookupOptions, callback: (err: ?Error, address: string, family: number) => void, ): void; declare function lookup( domain: string, callback: (err: ?Error, address: string, family: number) => void, ): void; declare function resolve( domain: string, rrtype?: string, callback?: (err: ?Error, addresses: Array) => void, ): void; declare function resolve4( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolve6( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolveCname( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolveMx( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolveNs( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolveSrv( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function resolveTxt( domain: string, callback: (err: ?Error, addresses: Array) => void, ): void; declare function reverse( ip: string, callback: (err: ?Error, domains: Array) => void, ): void; declare function timingSafeEqual( a: Buffer | $TypedArray | DataView, b: Buffer | $TypedArray | DataView, ): boolean; } declare class events$EventEmitter { // deprecated static listenerCount(emitter: events$EventEmitter, event: string): number; static defaultMaxListeners: number; addListener(event: string, listener: Function): this; emit(event: string, ...args: Array): boolean; eventNames(): Array; listeners(event: string): Array; listenerCount(event: string): number; on(event: string, listener: Function): this; once(event: string, listener: Function): this; prependListener(event: string, listener: Function): this; prependOnceListener(event: string, listener: Function): this; removeAllListeners(event?: string): this; removeListener(event: string, listener: Function): this; off(event: string, listener: Function): this; setMaxListeners(n: number): this; getMaxListeners(): number; rawListeners(event: string): Array; } declare module 'events' { // TODO: See the comment above the events$EventEmitter declaration declare class EventEmitter extends events$EventEmitter { static EventEmitter: typeof EventEmitter; } declare module.exports: typeof EventEmitter; } declare class domain$Domain extends events$EventEmitter { members: Array; add(emitter: events$EventEmitter): void; bind(callback: Function): Function; dispose(): void; enter(): void; exit(): void; intercept(callback: Function): Function; remove(emitter: events$EventEmitter): void; run(fn: Function): void; } declare module 'domain' { declare function create(): domain$Domain; } declare module 'fs' { declare class Stats { dev: number; ino: number; mode: number; nlink: number; uid: number; gid: number; rdev: number; size: number; blksize: number; blocks: number; atimeMs: number; mtimeMs: number; ctimeMs: number; birthtimeMs: number; atime: Date; mtime: Date; ctime: Date; birthtime: Date; isFile(): boolean; isDirectory(): boolean; isBlockDevice(): boolean; isCharacterDevice(): boolean; isSymbolicLink(): boolean; isFIFO(): boolean; isSocket(): boolean; } declare type PathLike = string | Buffer | URL; declare class FSWatcher extends events$EventEmitter { close(): void; ref(): this; unref(): this; } declare class ReadStream extends stream$Readable { close(): void; } declare class WriteStream extends stream$Writable { close(): void; bytesWritten: number; } declare class Dirent { name: string | Buffer; parentPath: string; isBlockDevice(): boolean; isCharacterDevice(): boolean; isDirectory(): boolean; isFIFO(): boolean; isFile(): boolean; isSocket(): boolean; isSymbolicLink(): boolean; } declare function rename( oldPath: string, newPath: string, callback?: (err: ?ErrnoError) => void, ): void; declare function renameSync(oldPath: string, newPath: string): void; declare function ftruncate( fd: number, len: number, callback?: (err: ?ErrnoError) => void, ): void; declare function ftruncateSync(fd: number, len: number): void; declare function truncate( path: string, len: number, callback?: (err: ?ErrnoError) => void, ): void; declare function truncateSync(path: string, len: number): void; declare function chown( path: string, uid: number, gid: number, callback?: (err: ?ErrnoError) => void, ): void; declare function chownSync(path: string, uid: number, gid: number): void; declare function fchown( fd: number, uid: number, gid: number, callback?: (err: ?ErrnoError) => void, ): void; declare function fchownSync(fd: number, uid: number, gid: number): void; declare function lchown( path: string, uid: number, gid: number, callback?: (err: ?ErrnoError) => void, ): void; declare function lchownSync(path: string, uid: number, gid: number): void; declare function chmod( path: string, mode: number | string, callback?: (err: ?ErrnoError) => void, ): void; declare function chmodSync(path: string, mode: number | string): void; declare function fchmod( fd: number, mode: number | string, callback?: (err: ?ErrnoError) => void, ): void; declare function fchmodSync(fd: number, mode: number | string): void; declare function lchmod( path: string, mode: number | string, callback?: (err: ?ErrnoError) => void, ): void; declare function lchmodSync(path: string, mode: number | string): void; declare function stat( path: string, callback?: (err: ?ErrnoError, stats: Stats) => any, ): void; declare function statSync(path: string): Stats; declare function fstat( fd: number, callback?: (err: ?ErrnoError, stats: Stats) => any, ): void; declare function fstatSync(fd: number): Stats; declare function lstat( path: string, callback?: (err: ?ErrnoError, stats: Stats) => any, ): void; declare function lstatSync(path: string): Stats; declare function link( srcpath: string, dstpath: string, callback?: (err: ?ErrnoError) => void, ): void; declare function linkSync(srcpath: string, dstpath: string): void; declare function symlink( srcpath: string, dtspath: string, type?: string, callback?: (err: ?ErrnoError) => void, ): void; declare function symlinkSync( srcpath: string, dstpath: string, type?: string, ): void; declare function readlink( path: string, callback: (err: ?ErrnoError, linkString: string) => void, ): void; declare function readlinkSync(path: string): string; declare function realpath( path: string, cache?: Object, callback?: (err: ?ErrnoError, resolvedPath: string) => void, ): void; declare function realpathSync(path: string, cache?: Object): string; declare function unlink( path: string, callback?: (err: ?ErrnoError) => void, ): void; declare function unlinkSync(path: string): void; declare type RmDirOptions = {| /** * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or * `EPERM` error is encountered, Node.js will retry the operation with a linear * backoff wait of `retryDelay` ms longer on each try. This option represents the * number of retries. This option is ignored if the `recursive` option is not * `true`. * @default 0 */ maxRetries?: number | void, /** * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. * Use `fs.rm(path, { recursive: true, force: true })` instead. * * If `true`, perform a recursive directory removal. In * recursive mode soperations are retried on failure. * @default false */ recursive?: boolean | void, /** * The amount of time in milliseconds to wait between retries. * This option is ignored if the `recursive` option is not `true`. * @default 100 */ retryDelay?: number | void, |}; declare function rmdir( path: PathLike, callback?: (err: ?ErrnoError) => void, ): void; declare function rmdir( path: PathLike, options: RmDirOptions, callback?: (err: ?ErrnoError) => void, ): void; declare function rmdirSync(path: PathLike, options?: RmDirOptions): void; declare type RmOptions = {| /** * When `true`, exceptions will be ignored if `path` does not exist. * @default false */ force?: boolean | void, /** * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or * `EPERM` error is encountered, Node.js will retry the operation with a linear * backoff wait of `retryDelay` ms longer on each try. This option represents the * number of retries. This option is ignored if the `recursive` option is not * `true`. * @default 0 */ maxRetries?: number | void, /** * If `true`, perform a recursive directory removal. In * recursive mode, operations are retried on failure. * @default false */ recursive?: boolean | void, /** * The amount of time in milliseconds to wait between retries. * This option is ignored if the `recursive` option is not `true`. * @default 100 */ retryDelay?: number | void, |}; /** * Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the * completion callback. * @since v14.14.0 */ declare function rm( path: PathLike, callback?: (err: ?ErrnoError) => void, ): void; declare function rm( path: PathLike, options: RmOptions, callback?: (err: ?ErrnoError) => void, ): void; /** * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. * @since v14.14.0 */ declare function rmSync(path: PathLike, options?: RmOptions): void; declare function mkdir( path: string, mode?: | number | { recursive?: boolean, mode?: number, ... }, callback?: (err: ?ErrnoError) => void, ): void; declare function mkdirSync( path: string, mode?: | number | { recursive?: boolean, mode?: number, ... }, ): void; declare function mkdtemp( prefix: string, callback: (err: ?ErrnoError, folderPath: string) => void, ): void; declare function mkdtempSync(prefix: string): string; declare function readdir( path: string, options: | string | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, ... }>, callback: (err: ?ErrnoError, files: Array) => void, ): void; declare function readdir( path: string, options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, ... }>, callback: (err: ?ErrnoError, files: Array) => void, ): void; declare function readdir( path: string, callback: (err: ?ErrnoError, files: Array) => void, ): void; declare function readdirSync( path: string, options?: | string | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, }>, ): Array; declare function readdirSync( path: string, options?: | string | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, }>, ): Array; declare function close( fd: number, callback: (err: ?ErrnoError) => void, ): void; declare function closeSync(fd: number): void; declare function open( path: string | Buffer | URL, flags: string | number, mode: number, callback: (err: ?ErrnoError, fd: number) => void, ): void; declare function open( path: string | Buffer | URL, flags: string | number, callback: (err: ?ErrnoError, fd: number) => void, ): void; declare function openAsBlob( path: string | Buffer | URL, options?: Readonly<{ type?: string, // Optional MIME type hint }>, ): Promise; declare function opendir( path: string, options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, }>, callback: (err: ?ErrnoError, dir: Dir) => void, ): void; declare function opendirSync( path: string, options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, }>, ): Dir; declare function openSync( path: string | Buffer, flags: string | number, mode?: number, ): number; declare function utimes( path: string, atime: number, mtime: number, callback?: (err: ?ErrnoError) => void, ): void; declare function utimesSync(path: string, atime: number, mtime: number): void; declare function futimes( fd: number, atime: number, mtime: number, callback?: (err: ?ErrnoError) => void, ): void; declare function futimesSync(fd: number, atime: number, mtime: number): void; declare function fsync( fd: number, callback?: (err: ?ErrnoError) => void, ): void; declare function fsyncSync(fd: number): void; declare function write( fd: number, buffer: Buffer, offset: number, length: number, position: number, callback: (err: ?ErrnoError, write: number, buf: Buffer) => void, ): void; declare function write( fd: number, buffer: Buffer, offset: number, length: number, callback: (err: ?ErrnoError, write: number, buf: Buffer) => void, ): void; declare function write( fd: number, buffer: Buffer, offset: number, callback: (err: ?ErrnoError, write: number, buf: Buffer) => void, ): void; declare function write( fd: number, buffer: Buffer, callback: (err: ?ErrnoError, write: number, buf: Buffer) => void, ): void; declare function write( fd: number, data: string, position: number, encoding: string, callback: (err: ?ErrnoError, write: number, str: string) => void, ): void; declare function write( fd: number, data: string, position: number, callback: (err: ?ErrnoError, write: number, str: string) => void, ): void; declare function write( fd: number, data: string, callback: (err: ?ErrnoError, write: number, str: string) => void, ): void; declare function writeSync( fd: number, buffer: Buffer, offset: number, length: number, position: number, ): number; declare function writeSync( fd: number, buffer: Buffer, offset: number, length: number, ): number; declare function writeSync( fd: number, buffer: Buffer, offset?: number, ): number; declare function writeSync( fd: number, str: string, position: number, encoding: string, ): number; declare function writeSync( fd: number, str: string, position?: number, ): number; declare function read( fd: number, buffer: Buffer, offset: number, length: number, position: ?number, callback: (err: ?ErrnoError, bytesRead: number, buffer: Buffer) => void, ): void; declare function readSync( fd: number, buffer: Buffer, offset: number, length: number, position: number, ): number; declare function readFile( path: string | Buffer | URL | number, callback: (err: ?ErrnoError, data: Buffer) => void, ): void; declare function readFile( path: string | Buffer | URL | number, encoding: string, callback: (err: ?ErrnoError, data: string) => void, ): void; declare function readFile( path: string | Buffer | URL | number, options: { encoding: string, flag?: string, ... }, callback: (err: ?ErrnoError, data: string) => void, ): void; declare function readFile( path: string | Buffer | URL | number, options: {encoding?: null | void, flag?: string, ...}, callback: (err: ?ErrnoError, data: Buffer) => void, ): void; declare function readFileSync(path: string | Buffer | URL | number): Buffer; declare function readFileSync( path: string | Buffer | URL | number, encoding: string, ): string; declare function readFileSync( path: string | Buffer | URL | number, options: { encoding: string, flag?: string, ... }, ): string; declare function readFileSync( path: string | Buffer | URL | number, options: { encoding?: void, flag?: string, ... }, ): Buffer; declare function writeFile( filename: string | Buffer | number, data: Buffer | string, options: | string | { encoding?: ?string, mode?: number, flag?: string, ... }, callback: (err: ?ErrnoError) => void, ): void; declare function writeFile( filename: string | Buffer | number, data: Buffer | string, callback?: (err: ?ErrnoError) => void, ): void; declare function writeFileSync( filename: string, data: Buffer | string, options?: | string | { encoding?: ?string, mode?: number, flag?: string, ... }, ): void; declare function appendFile( filename: string | Buffer | number, data: string | Buffer, options: | string | { encoding?: ?string, mode?: number, flag?: string, ... }, callback: (err: ?ErrnoError) => void, ): void; declare function appendFile( filename: string | Buffer | number, data: string | Buffer, callback: (err: ?ErrnoError) => void, ): void; declare function appendFileSync( filename: string | Buffer | number, data: string | Buffer, options?: | string | { encoding?: ?string, mode?: number, flag?: string, ... }, ): void; declare function watchFile( filename: string, listener?: (curr: Stats, prev: Stats) => void, ): void; declare function watchFile( filename: string, options?: Readonly<{ bigint?: boolean, persistent?: boolean, interval?: number, }>, listener?: (curr: Stats, prev: Stats) => void, ): void; declare function unwatchFile( filename: string, listener?: (curr: Stats, prev: Stats) => void, ): void; declare function watch( filename: string, listener?: (event: string, filename: string) => void, ): FSWatcher; declare function watch( filename: string, options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, signal?: AbortSignal, }>, listener?: (event: string, filename: string) => void, ): FSWatcher; declare function exists( path: string, callback?: (exists: boolean) => void, ): void; declare function existsSync(path: string): boolean; declare function access( path: string, mode?: number, callback?: (err: ?ErrnoError) => void, ): void; declare function accessSync(path: string, mode?: number): void; declare function createReadStream(path: string, options?: Object): ReadStream; declare function createWriteStream( path: string, options?: Object, ): WriteStream; declare function fdatasync( fd: number, callback: (err: ?ErrnoError) => void, ): void; declare function fdatasyncSync(fd: number): void; declare function copyFile( src: string, dest: string, callback: (err: ErrnoError) => void, ): void; declare function copyFile( src: string, dest: string, flags?: number, callback: (err: ErrnoError) => void, ): void; declare function copyFileSync( src: string, dest: string, flags?: number, ): void; declare function cp( src: string | URL, dest: string | URL, options: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, force?: boolean, mode?: number, preserveTimestamps?: boolean, recursive?: boolean, verbatimSymlinks?: boolean, }>, callback: (err: ?Error) => void, ): void; declare function cp( src: string | URL, dest: string | URL, callback: (err: ?Error) => void, ): void; declare function cpSync( src: string | URL, dest: string | URL, options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean, force?: boolean, mode?: number, preserveTimestamps?: boolean, recursive?: boolean, verbatimSymlinks?: boolean, }>, ): void; declare type GlobOptions = Readonly<{ /** * Current working directory. * @default process.cwd() */ cwd?: string | void, /** * `true` if the glob should return paths as `Dirent`s, `false` otherwise. * @default false * @since v22.2.0 */ withFileTypes?: WithFileTypes, /** * Function to filter out files/directories or a * list of glob patterns to be excluded. If a function is provided, return * `true` to exclude the item, `false` to include it. * @default undefined */ exclude?: | ((fileName: Node$Conditional) => boolean) | ReadonlyArray, ... }>; /** * Retrieves the files matching the specified pattern. * * ```js * import { glob } from 'node:fs'; * * glob('*.js', (err, matches) => { * if (err) throw err; * console.log(matches); * }); * ``` * @since v22.0.0 */ declare function glob( pattern: string | ReadonlyArray, callback: (err: ?ErrnoError, matches: Array) => void, ): void; declare function glob( pattern: string | ReadonlyArray, options: GlobOptions, callback: ( err: ?ErrnoError, matches: Node$Conditional, Array>, ) => void, ): void; /** * ```js * import { globSync } from 'node:fs'; * * console.log(globSync('*.js')); * ``` * @since v22.0.0 * @returns paths of files that match the pattern. */ declare function globSync( pattern: string | ReadonlyArray, options?: GlobOptions, ): Node$Conditional, Array>; declare var F_OK: number; declare var R_OK: number; declare var W_OK: number; declare var X_OK: number; // new var from node 6.x // https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_constants_1 declare var constants: { F_OK: number, // 0 R_OK: number, // 4 W_OK: number, // 2 X_OK: number, // 1 COPYFILE_EXCL: number, // 1 COPYFILE_FICLONE: number, // 2 COPYFILE_FICLONE_FORCE: number, // 4 O_RDONLY: number, // 0 O_WRONLY: number, // 1 O_RDWR: number, // 2 S_IFMT: number, // 61440 S_IFREG: number, // 32768 S_IFDIR: number, // 16384 S_IFCHR: number, // 8192 S_IFBLK: number, // 24576 S_IFIFO: number, // 4096 S_IFLNK: number, // 40960 S_IFSOCK: number, // 49152 O_CREAT: number, // 64 O_EXCL: number, // 128 O_NOCTTY: number, // 256 O_TRUNC: number, // 512 O_APPEND: number, // 1024 O_DIRECTORY: number, // 65536 O_NOATIME: number, // 262144 O_NOFOLLOW: number, // 131072 O_SYNC: number, // 1052672 O_DSYNC: number, // 4096 O_SYMLINK: number, // 2097152 O_DIRECT: number, // 16384 O_NONBLOCK: number, // 2048 S_IRWXU: number, // 448 S_IRUSR: number, // 256 S_IWUSR: number, // 128 S_IXUSR: number, // 64 S_IRWXG: number, // 56 S_IRGRP: number, // 32 S_IWGRP: number, // 16 S_IXGRP: number, // 8 S_IRWXO: number, // 7 S_IROTH: number, // 4 S_IWOTH: number, // 2 S_IXOTH: number, // 1 ... }; declare type BufferEncoding = 'buffer' | {encoding: 'buffer', ...}; declare type EncodingOptions = {encoding?: string, ...}; declare type EncodingFlag = EncodingOptions & {flag?: string, ...}; declare type WriteOptions = EncodingFlag & {mode?: number, ...}; declare type RemoveOptions = { force?: boolean, maxRetries?: number, recursive?: boolean, retryDelay?: number, ... }; declare class Dir { +path: string; close(): Promise; closeSync(): void; read(): Promise; read(cb: (err?: Error, dirent: ?Dirent) => void): void; readSync(): ?Dirent; @@asyncIterator(): AsyncIterator; } type AppendOrWriteToFileHandle = ( data: | string | Buffer | Uint8Array | DataView | AsyncIterable | Iterable | stream$Readable, options: WriteOptions | string, ) => Promise; declare class FileHandle { appendFile: AppendOrWriteToFileHandle; chmod(mode: number): Promise; chown(uid: number, guid: number): Promise; close(): Promise; createReadStream( options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, start?: number, end?: number, highWaterMark?: number, signal?: AbortSignal, }>, ): ReadStream; createWriteStream( options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, start?: number, highWaterMark?: number, flush?: boolean, }>, ): WriteStream; datasync(): Promise; fd: number; read( buffer: T, offset: number, length: number, position: number, ): Promise<{ bytesRead: number, buffer: T, ... }>; readableWebStream( options?: Readonly<{autoClose?: boolean}>, ): ReadableStream; readFile(options: EncodingFlag): Promise; readFile(options: string): Promise; readLines( options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, start?: number, end?: number, highWaterMark?: number, }>, ): readline$Interface; readv | Array | Array>( buffers: T, position?: number | null, ): Promise<{buffers: T, bytesRead: number}>; stat(): Promise; sync(): Promise; truncate(len?: number): Promise; utimes( atime: number | string | Date, mtime: number | string | Date, ): Promise; write( buffer: Buffer | Uint8Array | DataView, offset: number, length: number, position: number, ): Promise; write( buffer: Buffer | Uint8Array | DataView, options?: Readonly<{ offset?: number, length?: number, position?: number, }>, ): Promise; writeFile: AppendOrWriteToFileHandle; writev | Array | Array>( buffers: T, position?: number | null, ): Promise<{buffers: T, bytesWritten: number}>; } declare type FSPromisePath = string | Buffer | URL; declare type FSPromise = { access(path: FSPromisePath, mode?: number): Promise, appendFile( path: FSPromisePath | FileHandle, data: string | Buffer, options?: WriteOptions | string, ): Promise, chmod(path: FSPromisePath, mode: number): Promise, chown(path: FSPromisePath, uid: number, gid: number): Promise, copyFile( src: FSPromisePath, dest: FSPromisePath, flags?: number, ): Promise, cp( src: string | URL, dest: string | URL, options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, force?: boolean, mode?: number, preserveTimestamps?: boolean, recursive?: boolean, verbatimSymlinks?: boolean, }>, ): Promise, fchmod(filehandle: FileHandle, mode: number): Promise, fchown(filehandle: FileHandle, uid: number, guid: number): Promise, fdatasync(filehandle: FileHandle): Promise, fstat(filehandle: FileHandle): Promise, fsync(filehandle: FileHandle): Promise, ftruncate(filehandle: FileHandle, len?: number): Promise, futimes( filehandle: FileHandle, atime: number | string | Date, mtime: number | string | Date, ): Promise, glob( pattern: string | ReadonlyArray, options?: GlobOptions, ): Node$Conditional< WithFileTypes, AsyncIterator, AsyncIterator, >, lchmod(path: FSPromisePath, mode: number): Promise, lchown(path: FSPromisePath, uid: number, guid: number): Promise, link(existingPath: FSPromisePath, newPath: FSPromisePath): Promise, lstat(path: FSPromisePath): Promise, mkdir( path: FSPromisePath, mode?: | number | { recursive?: boolean, mode?: number, ... }, ): Promise, mkdtemp(prefix: string, options?: EncodingOptions): Promise, open( path: FSPromisePath, flags?: string | number, mode?: number, ): Promise, opendir( path: string, options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, }>, ): Promise, read( filehandle: FileHandle, buffer: T, offset: number, length: number, position?: number, ): Promise<{ bytesRead: number, buffer: T, ... }>, readdir: (( path: FSPromisePath, options: | string | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, }>, ) => Promise>) & (( path: FSPromisePath, options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, }>, ) => Promise>) & ((path: FSPromisePath) => Promise>), readFile: (( path: FSPromisePath | FileHandle, options: string, ) => Promise) & (( path: FSPromisePath | FileHandle, options?: EncodingFlag, ) => Promise), readlink: (( path: FSPromisePath, options: BufferEncoding, ) => Promise) & (( path: FSPromisePath, options?: string | EncodingOptions, ) => Promise), realpath: (( path: FSPromisePath, options: BufferEncoding, ) => Promise) & (( path: FSPromisePath, options?: string | EncodingOptions, ) => Promise), rename(oldPath: FSPromisePath, newPath: FSPromisePath): Promise, rm(path: FSPromisePath, options?: RemoveOptions): Promise, rmdir(path: FSPromisePath): Promise, stat(path: FSPromisePath): Promise, symlink( target: FSPromisePath, path: FSPromisePath, type?: 'dir' | 'file' | 'junction', ): Promise, truncate(path: FSPromisePath, len?: number): Promise, unlink(path: FSPromisePath): Promise, utimes( path: FSPromisePath, atime: number | string | Date, mtime: number | string | Date, ): Promise, watch( filename: FSPromisePath, options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, signal?: AbortSignal, maxQueue?: number, overflow?: 'ignore' | 'throw', }>, ): AsyncIterator<{eventType: string, filename: ?string}>, write( filehandle: FileHandle, buffer: T, offset: number, length: number, position?: number, ): Promise<{ bytesRead: number, buffer: T, ... }>, writeFile( FSPromisePath | FileHandle, data: string | Buffer | Uint8Array, options?: string | WriteOptions, ): Promise, ... }; declare var promises: FSPromise; } declare module 'fs/promises' { declare module.exports: $Exports<'fs'>['promises']; } type http$agentOptions = { keepAlive?: boolean, keepAliveMsecs?: number, maxSockets?: number, maxFreeSockets?: number, ... }; declare class http$Agent<+SocketT = net$Socket> { constructor(options: http$agentOptions): void; destroy(): void; // $FlowFixMe[incompatible-variance] freeSockets: {[name: string]: ReadonlyArray, ...}; getName(options: { host: string, port: number, localAddress: string, ... }): string; maxFreeSockets: number; maxSockets: number; // $FlowFixMe[incompatible-variance] requests: {[name: string]: ReadonlyArray>, ...}; // $FlowFixMe[incompatible-variance] sockets: {[name: string]: ReadonlyArray, ...}; } declare class http$IncomingMessage extends stream$Readable { headers: Object; rawHeaders: Array; httpVersion: string; method: string; trailers: Object; setTimeout(msecs: number, callback: Function): void; socket: SocketT; statusCode: number; statusMessage: string; url: string; aborted: boolean; complete: boolean; rawTrailers: Array; } declare class http$ClientRequest<+SocketT = net$Socket> extends stream$Writable { abort(): void; aborted: boolean; +connection: SocketT | null; flushHeaders(): void; getHeader(name: string): string; removeHeader(name: string): void; setHeader(name: string, value: string | Array): void; setNoDelay(noDelay?: boolean): void; setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; setTimeout(msecs: number, callback?: Function): void; +socket: SocketT | null; } declare class http$ServerResponse extends stream$Writable { addTrailers(headers: {[key: string]: string, ...}): void; connection: net$Socket; finished: boolean; flushHeaders(): void; getHeader(name: string): string; getHeaderNames(): Array; getHeaders(): {[key: string]: string | Array, ...}; hasHeader(name: string): boolean; headersSent: boolean; removeHeader(name: string): void; sendDate: boolean; setHeader(name: string, value: string | Array): void; setTimeout(msecs: number, callback?: Function): http$ServerResponse; socket: net$Socket; statusCode: number; statusMessage: string; writeContinue(): void; writeHead( status: number, statusMessage?: string, headers?: {[key: string]: string, ...}, ): void; writeHead(status: number, headers?: {[key: string]: string, ...}): void; writeProcessing(): void; } declare class http$Server extends net$Server { listen( port?: number, hostname?: string, backlog?: number, callback?: Function, ): this; // The following signatures are added to allow omitting intermediate arguments listen(port?: number, backlog?: number, callback?: Function): this; listen(port?: number, hostname?: string, callback?: Function): this; listen(port?: number, callback?: Function): this; listen(path: string, callback?: Function): this; listen( handle: { port?: number, host?: string, path?: string, backlog?: number, exclusive?: boolean, readableAll?: boolean, writableAll?: boolean, ipv6Only?: boolean, ... }, callback?: Function, ): this; listening: boolean; close(callback?: (error: ?Error) => unknown): this; closeAllConnections(): void; closeIdleConnections(): void; maxHeadersCount: number; keepAliveTimeout: number; headersTimeout: number; setTimeout(msecs: number, callback: Function): this; timeout: number; } declare class https$Server extends tls$Server { listen( port?: number, hostname?: string, backlog?: number, callback?: Function, ): this; // The following signatures are added to allow omitting intermediate arguments listen(port?: number, backlog?: number, callback?: Function): this; listen(port?: number, hostname?: string, callback?: Function): this; listen(port?: number, callback?: Function): this; listen(path: string, callback?: Function): this; listen( handle: { port?: number, host?: string, path?: string, backlog?: number, exclusive?: boolean, readableAll?: boolean, writableAll?: boolean, ipv6Only?: boolean, ... }, callback?: Function, ): this; close(callback?: (error: ?Error) => unknown): this; closeAllConnections(): void; closeIdleConnections(): void; keepAliveTimeout: number; headersTimeout: number; setTimeout(msecs: number, callback: Function): this; timeout: number; } type requestOptions = {| auth?: string, defaultPort?: number, family?: number, headers?: {[key: string]: unknown, ...}, host?: string, hostname?: string, localAddress?: string, method?: string, path?: string, port?: number, protocol?: string, setHost?: boolean, socketPath?: string, timeout?: number, |}; type http$requestOptions = { ...requestOptions, agent?: boolean | http$Agent, createConnection?: ( options: net$connectOptions, callback?: Function, ) => net$Socket, ... }; type http$createServerOptions = Readonly<{ ...net$createServerOptions, connectionsCheckingInterval?: number, headersTimeout?: number, insecureHTTPParser?: boolean, IncomingMessage?: Class>, joinDuplicateHeaders?: boolean, keepAliveTimeout?: number, maxHeaderSize?: number, requestTimeout?: number, requireHostHeader?: boolean, rejectNonStandardBodyWrites?: boolean, ServerResponse?: Class, uniqueHeaders?: ReadonlyArray>, }>; declare module 'http' { export type ServerOptions = http$createServerOptions; declare class Server extends http$Server {} declare class Agent extends http$Agent { createConnection( options: net$connectOptions, callback?: Function, ): net$Socket; } declare class ClientRequest extends http$ClientRequest {} declare class IncomingMessage extends http$IncomingMessage {} declare class ServerResponse extends http$ServerResponse {} declare function createServer( options: http$createServerOptions, requestListener?: ( request: IncomingMessage, response: ServerResponse, ) => void, ): Server; declare function createServer( requestListener?: ( request: IncomingMessage, response: ServerResponse, ) => void, ): Server; declare function request( options: http$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function request( url: string, options?: http$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function get( options: http$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function get( url: string, options?: http$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare var METHODS: Array; declare var STATUS_CODES: {[key: number]: string, ...}; declare var globalAgent: Agent; } type https$createServerOptions = Readonly<{ ...http$createServerOptions, ...tls$createServerOptions, }>; type https$requestOptions = { ...requestOptions, agent?: boolean | http$Agent, createConnection?: ( options: tls$connectOptions, callback?: Function, ) => tls$TLSSocket, ... }; declare module 'https' { export type ServerOptions = https$createServerOptions; declare class Server extends https$Server {} declare class Agent extends http$Agent { createConnection( port: ?number, host: ?string, options: tls$connectOptions, ): tls$TLSSocket; createConnection(port: ?number, options: tls$connectOptions): tls$TLSSocket; createConnection(options: tls$connectOptions): tls$TLSSocket; } declare class ClientRequest extends http$ClientRequest {} declare class IncomingMessage extends http$IncomingMessage {} declare class ServerResponse extends http$ServerResponse {} declare function createServer( options: https$createServerOptions, requestListener?: ( request: IncomingMessage, response: ServerResponse, ) => void, ): Server; declare function request( options: https$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function request( url: string, options?: https$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function get( options: https$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare function get( url: string, options?: https$requestOptions, callback?: (response: IncomingMessage) => void, ): ClientRequest; declare var globalAgent: Agent; } type module$Module = { builtinModules: Array, createRequire(filename: string | URL): typeof require, syncBuiltinESMExports(): void, Module: module$Module, ... }; declare module 'module' { declare module.exports: module$Module; } declare class net$Socket extends stream$Duplex { constructor(options?: Object): void; address(): net$Socket$address; bufferSize: number; bytesRead: number; bytesWritten: number; connect(path: string, connectListener?: () => unknown): net$Socket; connect( port: number, host?: string, connectListener?: () => unknown, ): net$Socket; connect(port: number, connectListener?: () => unknown): net$Socket; connect(options: Object, connectListener?: () => unknown): net$Socket; destroyed: boolean; end( chunkOrEncodingOrCallback?: | Buffer | Uint8Array | string | ((data: any) => void), encodingOrCallback?: string | ((data: any) => void), callback?: (data: any) => void, ): this; localAddress: string; localPort: number; pause(): this; ref(): this; remoteAddress: string | void; remoteFamily: string; remotePort: number; resume(): this; setEncoding(encoding?: string): this; setKeepAlive(enable?: boolean, initialDelay?: number): this; setNoDelay(noDelay?: boolean): this; setTimeout(timeout: number, callback?: Function): this; unref(): this; write( chunk: Buffer | Uint8Array | string, encodingOrCallback?: string | ((data: any) => void), callback?: (data: any) => void, ): boolean; } declare class net$Server extends events$EventEmitter { listen( port?: number, hostname?: string, backlog?: number, callback?: Function, ): net$Server; listen(path: string, callback?: Function): net$Server; listen(handle: Object, callback?: Function): net$Server; listening: boolean; close(callback?: Function): net$Server; address(): net$Socket$address; connections: number; maxConnections: number; getConnections(callback: Function): void; ref(): net$Server; unref(): net$Server; } type net$connectOptions = { port?: number, host?: string, localAddress?: string, localPort?: number, family?: number, lookup?: ( domain: string, options?: ?number | ?Object, callback?: (err: ?Error, address: string, family: number) => void, ) => unknown, path?: string, ... }; type net$createServerOptions = Readonly<{ allowHalfOpen?: boolean, highWaterMark?: number, keepAlive?: boolean, keepAliveInitialDelay?: number, noDelay?: boolean, pauseOnConnect?: boolean, }>; declare module 'net' { export type ServerOptions = net$createServerOptions; declare class Server extends net$Server {} declare class Socket extends net$Socket {} declare function isIP(input: string): number; declare function isIPv4(input: string): boolean; declare function isIPv6(input: string): boolean; declare type connectionListener = (socket: Socket) => any; declare function createServer( options: net$createServerOptions, connectionListener?: connectionListener, ): Server; declare function createServer( connectionListener?: connectionListener, ): Server; declare type connectListener = () => any; declare function connect( pathOrPortOrOptions: string | number | net$connectOptions, hostOrConnectListener?: string | connectListener, connectListener?: connectListener, ): Socket; declare function createConnection( pathOrPortOrOptions: string | number | net$connectOptions, hostOrConnectListener?: string | connectListener, connectListener?: connectListener, ): Socket; } type os$CPU = { model: string, speed: number, times: { idle: number, irq: number, nice: number, sys: number, user: number, }, }; type os$NetIFAddr = { address: string, family: string, internal: boolean, mac: string, netmask: string, scopeid?: number, cidr: ?string, }; type os$UserInfo$buffer = { uid: number, gid: number, username: Buffer, homedir: Buffer, shell: ?Buffer, }; type os$UserInfo$string = { uid: number, gid: number, username: string, homedir: string, shell: ?string, }; declare module 'os' { declare function arch(): | 'arm' | 'arm64' | 'ia32' | 'loong64' | 'mips' | 'mipsel' | 'ppc64' | 'riscv64' | 's390x' | 'x64'; declare function availableParallelism(): number; declare function cpus(): Array; declare function endianness(): 'BE' | 'LE'; declare function freemem(): number; declare function getPriority(pid?: number): number; declare function homedir(): string; declare function hostname(): string; declare function loadavg(): [number, number, number]; declare function machine(): string; declare function networkInterfaces(): { [ifName: string]: Array, }; declare function platform(): | 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin'; declare function release(): string; declare function setPriority(priority: number): void; declare function setPriority(pid: number, priority: number): void; declare function tmpdir(): string; declare function totalmem(): number; declare function type(): string; declare function uptime(): number; declare function userInfo( options: Readonly<{ encoding: 'buffer', }>, ): os$UserInfo$buffer; declare function userInfo( options?: Readonly<{ encoding: 'utf8', }>, ): os$UserInfo$string; declare function version(): string; declare var EOL: string; declare var devNull: string; declare var constants: Readonly<{ signals: {[key: string]: number, ...}, errno: {[key: string]: number, ...}, priority: Readonly<{ PRIORITY_LOW: number, PRIORITY_BELOW_NORMAL: number, PRIORITY_NORMAL: number, PRIORITY_ABOVE_NORMAL: number, PRIORITY_HIGH: number, PRIORITY_HIGHEST: number, }>, dlopen: {[key: string]: number, ...}, }>; } type path$PlatformPath = { normalize(path: string): string, join(...parts: Array): string, resolve(...parts: Array): string, matchesGlob(path: string, pattern: string): boolean, isAbsolute(path: string): boolean, relative(from: string, to: string): string, dirname(path: string): string, basename(path: string, ext?: string): string, extname(path: string): string, sep: string, delimiter: string, parse(pathString: string): Readonly<{ root: string, dir: string, base: string, ext: string, name: string, }>, format( pathObject: Readonly<{ root?: string, dir?: string, base?: string, ext?: string, name?: string, }>, ): string, toNamespacedPath(path: string): string, posix: path$PlatformPath, win32: path$PlatformPath, ... }; declare module 'path' { declare function normalize(path: string): string; declare function join(...parts: Array): string; declare function resolve(...parts: Array): string; declare function matchesGlob(path: string, pattern: string): boolean; declare function isAbsolute(path: string): boolean; declare function relative(from: string, to: string): string; declare function dirname(path: string): string; declare function basename(path: string, ext?: string): string; declare function extname(path: string): string; declare var sep: string; declare var delimiter: string; declare function parse(pathString: string): { root: string, dir: string, base: string, ext: string, name: string, }; declare function format( pathObject: Readonly<{ root?: string, dir?: string, base?: string, ext?: string, name?: string, }>, ): string; declare function toNamespacedPath(path: string): string; declare var posix: path$PlatformPath; declare var win32: path$PlatformPath; } declare module 'perf_hooks' { declare export type EntryType = | 'function' | 'gc' | 'http' | 'http2' | 'mark' | 'measure' | 'navigation' | 'node' | 'resource'; declare export interface Histogram { +count: number; +countBigInt: bigint; +exceeds: number; +exceedsBigInt: bigint; +max: number; +maxBigInt: bigint; +mean: number; +min: number; +minBigInt: bigint; +stddev: number; +percentiles: Map; +percentilesBigInt: Map; percentile(percentile: number): number; percentileBigInt(percentile: number): bigint; reset(): void; } declare export interface IntervalHistogram extends Histogram { enable(): boolean; disable(): boolean; } declare export interface RecordableHistogram extends Histogram { record(val: number | bigint): void; recordDelta(): void; } declare export class PerformanceEntry { +duration: number; +entryType: EntryType; +name: string; +startTime: number; +detail?: unknown; toJSON(): unknown; } declare export class PerformanceMark extends PerformanceEntry { +entryType: 'mark'; +duration: 0; +detail?: T; } declare export class PerformanceMeasure extends PerformanceEntry { +entryType: 'measure'; +detail?: T; } declare export class PerformanceNodeEntry extends PerformanceEntry { +entryType: 'node'; } declare export class PerformanceNodeTiming extends PerformanceEntry { +entryType: 'node'; +bootstrapComplete: number; +environment: number; +idleTime: number; +loopExit: number; +loopStart: number; +nodeStart: number; +v8Start: number; } declare export class PerformanceResourceTiming extends PerformanceEntry { +entryType: 'resource'; +connectEnd: number; +connectStart: number; +decodedBodySize: number; +domainLookupEnd: number; +domainLookupStart: number; +encodedBodySize: number; +fetchStart: number; +redirectEnd: number; +redirectStart: number; +requestStart: number; +responseEnd: number; +secureConnectionStart: number; +transferSize: number; +workerStart: number; } declare export class PerformanceObserverEntryList { getEntries(): Array; getEntriesByName(name: string, type?: EntryType): Array; getEntriesByType(type: EntryType): Array; } declare export type PerformanceObserverCallback = ( list: PerformanceObserverEntryList, observer: PerformanceObserver, ) => void; declare export class PerformanceObserver { static supportedEntryTypes: ReadonlyArray; constructor(callback: PerformanceObserverCallback): this; observe( options: Readonly<{ entryTypes?: ReadonlyArray, type?: EntryType, buffered?: boolean, }>, ): void; disconnect(): void; takeRecords(): Array; } declare export type EventLoopUtilization = { +utilization: number, +idle: number, +active: number, }; declare export type PerformanceMarkOptions = Readonly<{ detail?: T, startTime?: number, }>; declare export type PerformanceMeasureOptions = Readonly<{ detail?: T, duration?: number, end?: number | string, start?: number | string, }>; declare class Performance { clearMarks(name?: string): void; clearMeasures(name?: string): void; clearResourceTimings(name?: string): void; eventLoopUtilization( elu1?: EventLoopUtilization, elu2?: EventLoopUtilization, ): EventLoopUtilization; getEntries(): Array; getEntriesByName(name: string, type?: EntryType): Array; getEntriesByType(type: EntryType): Array; mark( name: string, options?: PerformanceMarkOptions, ): PerformanceMark; measure( name: string, startMarkOrOptions?: string | PerformanceMeasureOptions, endMark?: string, ): PerformanceMeasure; +nodeTiming: PerformanceNodeTiming; now(): number; setResourceTimingBufferSize(maxSize: number): void; +timeOrigin: number; timerify, TReturn>( fn: (...TArgs) => TReturn, options?: Readonly<{histogram?: RecordableHistogram}>, ): (...TArgs) => TReturn; toJSON(): unknown; } declare export var performance: Performance; declare export var constants: Readonly<{ NODE_PERFORMANCE_GC_MAJOR: number, NODE_PERFORMANCE_GC_MINOR: number, NODE_PERFORMANCE_GC_INCREMENTAL: number, NODE_PERFORMANCE_GC_WEAKCB: number, NODE_PERFORMANCE_GC_FLAGS_NO: number, NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number, NODE_PERFORMANCE_GC_FLAGS_FORCED: number, NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number, NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number, NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number, NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number, }>; declare export function monitorEventLoopDelay( options?: Readonly<{resolution?: number}>, ): IntervalHistogram; declare export function createHistogram( options?: Readonly<{ lowest?: number | bigint, highest?: number | bigint, figures?: number, }>, ): RecordableHistogram; } declare module 'process' { declare module.exports: Process; } declare module 'punycode' { declare function decode(string: string): string; declare function encode(string: string): string; declare function toASCII(domain: string): string; declare function toUnicode(domain: string): string; declare var ucs2: { decode: (str: string) => Array, encode: (codePoints: Array) => string, ... }; declare var version: string; } declare module 'querystring' { declare function stringify( obj: Object, separator?: string, equal?: string, options?: {encodeURIComponent?: (str: string) => string, ...}, ): string; declare function parse( str: string, separator: ?string, equal: ?string, options?: { decodeURIComponent?: (str: string) => string, maxKeys?: number, ... }, ): any; declare function escape(str: string): string; declare function unescape(str: string, decodeSpaces?: boolean): string; } /** * Node.js sqlite module (only available with node: prefix) * @since v22.5.0 */ declare module 'node:sqlite' { declare export type SupportedValueType = | null | number | bigint | string | Uint8Array; declare export type DatabaseSyncOptions = Readonly<{ open?: boolean, enableForeignKeyConstraints?: boolean, enableDoubleQuotedStringLiterals?: boolean, readOnly?: boolean, allowExtension?: boolean, }>; declare export type CreateSessionOptions = Readonly<{ table?: string, db?: string, }>; declare export type ApplyChangesetOptions = Readonly<{ filter?: (tableName: string) => boolean, onConflict?: number, }>; declare export type FunctionOptions = Readonly<{ deterministic?: boolean, directOnly?: boolean, useBigIntArguments?: boolean, varargs?: boolean, }>; declare export type StatementResultingChanges = { changes: number | bigint, lastInsertRowid: number | bigint, }; declare export interface Session { changeset(): Uint8Array; patchset(): Uint8Array; close(): void; } declare export class StatementSync { all(...anonymousParameters: ReadonlyArray): Array; all( namedParameters: {[key: string]: SupportedValueType, ...}, ...anonymousParameters: ReadonlyArray ): Array; +expandedSQL: string; get(...anonymousParameters: ReadonlyArray): any; get( namedParameters: {[key: string]: SupportedValueType, ...}, ...anonymousParameters: ReadonlyArray ): any; iterate( ...anonymousParameters: ReadonlyArray ): Iterator; iterate( namedParameters: {[key: string]: SupportedValueType, ...}, ...anonymousParameters: ReadonlyArray ): Iterator; run( ...anonymousParameters: ReadonlyArray ): StatementResultingChanges; run( namedParameters: {[key: string]: SupportedValueType, ...}, ...anonymousParameters: ReadonlyArray ): StatementResultingChanges; setAllowBareNamedParameters(enabled: boolean): void; setReadBigInts(enabled: boolean): void; +sourceSQL: string; } declare export class DatabaseSync { constructor(location: string, options?: DatabaseSyncOptions): void; close(): void; loadExtension(path: string): void; enableLoadExtension(allow: boolean): void; exec(sql: string): void; function( name: string, options: FunctionOptions, func: (...args: ReadonlyArray) => SupportedValueType, ): void; function( name: string, func: (...args: ReadonlyArray) => SupportedValueType, ): void; open(): void; prepare(sql: string): StatementSync; createSession(options?: CreateSessionOptions): Session; applyChangeset( changeset: Uint8Array, options?: ApplyChangesetOptions, ): boolean; } declare export var constants: {| +SQLITE_CHANGESET_OMIT: number, +SQLITE_CHANGESET_REPLACE: number, +SQLITE_CHANGESET_ABORT: number, |}; } type readline$InterfaceCompleter = ( line: string, ) => | [Array, string] | (( line: string, ((err: ?Error, data: [Array, string]) => void), ) => void); declare class readline$Interface extends events$EventEmitter { close(): void; pause(): void; prompt(preserveCursor?: boolean): void; question( query: string, optionsOrCallback: {|signal?: AbortSignal|} | ((answer: string) => void), callback?: (answer: string) => void, ): void; resume(): void; setPrompt(prompt: string): void; write( val: string | void | null, key?: { name: string, ctrl?: boolean, shift?: boolean, meta?: boolean, ... }, ): void; @@asyncIterator(): AsyncIterator; } declare module 'readline' { declare var Interface: typeof readline$Interface; declare function clearLine( stream: stream$Stream, dir: -1 | 1 | 0, callback?: () => void, ): void; declare function clearScreenDown( stream: stream$Stream, callback?: () => void, ): void; declare function createInterface(opts: { completer?: readline$InterfaceCompleter, crlfDelay?: number, escapeCodeTimeout?: number, historySize?: number, input: stream$Readable, output?: ?stream$Stream, prompt?: string, removeHistoryDuplicates?: boolean, terminal?: boolean, ... }): readline$Interface; declare function cursorTo( stream: stream$Stream, x?: number, y?: number, callback?: () => void, ): void; declare function moveCursor( stream: stream$Stream, dx: number, dy: number, callback?: () => void, ): void; declare function emitKeypressEvents( stream: stream$Stream, readlineInterface?: readline$Interface, ): void; } declare class stream$Stream extends events$EventEmitter {} type readableStreamOptions = { highWaterMark?: number, encoding?: string, objectMode?: boolean, read?: (size: number) => void, destroy?: (error: ?Error, callback: (error?: Error) => void) => void, autoDestroy?: boolean, ... }; declare class stream$Readable extends stream$Stream { static from( iterable: Iterable | AsyncIterable, options?: readableStreamOptions, ): this; static fromWeb( readableStream: ReadableStream, options?: readableStreamOptions, ): this; static toWeb(streamReadable: stream$Readable): ReadableStream; constructor(options?: readableStreamOptions): void; destroy(error?: Error): this; isPaused(): boolean; pause(): this; pipe(dest: T, options?: {end?: boolean, ...}): T; read(size?: number): ?(string | Buffer); readable: boolean; readableHighWaterMark: number; readableLength: number; resume(): this; setEncoding(encoding: string): this; unpipe(dest?: stream$Writable): this; unshift(chunk: Buffer | Uint8Array | string): void; wrap(oldReadable: stream$Stream): this; _read(size: number): void; _destroy(error: ?Error, callback: (error?: Error) => void): void; push(chunk: ?(Buffer | Uint8Array | string), encoding?: string): boolean; @@asyncIterator(): AsyncIterator; } type writableStreamOptions = { highWaterMark?: number, decodeStrings?: boolean, defaultEncoding?: string, objectMode?: boolean, emitClose?: boolean, write?: ( chunk: Buffer | string, encoding: string, callback: (error?: Error) => void, ) => void, writev?: ( chunks: Array<{ chunk: Buffer | string, encoding: string, ... }>, callback: (error?: Error) => void, ) => void, destroy?: (error: ?Error, callback: (error?: Error) => void) => void, final?: (callback: (error?: Error) => void) => void, autoDestroy?: boolean, ... }; declare class stream$Writable extends stream$Stream { static fromWeb( writableStream: WritableStream, options?: writableStreamOptions, ): this; static toWeb(streamWritable: stream$Writable): WritableStream; constructor(options?: writableStreamOptions): void; cork(): void; destroy(error?: Error): this; end(callback?: () => void): this; end(chunk?: string | Buffer | Uint8Array, callback?: () => void): this; end( chunk?: string | Buffer | Uint8Array, encoding?: string, callback?: () => void, ): this; setDefaultEncoding(encoding: string): this; uncork(): void; writable: boolean; writableHighWaterMark: number; writableLength: number; write( chunk: string | Buffer | Uint8Array, callback?: (error?: Error) => void, ): boolean; write( chunk: string | Buffer | Uint8Array, encoding?: string, callback?: (error?: Error) => void, ): boolean; _write( chunk: Buffer | string, encoding: string, callback: (error?: Error) => void, ): void; _writev( chunks: Array<{ chunk: Buffer | string, encoding: string, ... }>, callback: (error?: Error) => void, ): void; _destroy(error: ?Error, callback: (error?: Error) => void): void; _final(callback: (error?: Error) => void): void; } type duplexStreamOptions = writableStreamOptions & readableStreamOptions & { allowHalfOpen?: boolean, readableObjectMode?: boolean, writableObjectMode?: boolean, readableHighWaterMark?: number, writableHighWaterMark?: number, ... }; declare class stream$Duplex extends stream$Readable mixins stream$Writable { // This is an unusual class at runtime, per the docs it "prototypally extends from Readable, // and then parasitically from Writable." Its static methods have incompatible signatures // with Readable's, which Flow doesn't like. // See https://nodejs.org/api/stream.html#stream_class_stream_duplex_1 // $FlowFixMe[incompatible-exact] See above // $FlowFixMe[incompatible-type] See above static fromWeb( pair: Readonly<{ readable: ReadableStream, writable: WritableStream, }>, options?: duplexStreamOptions, ): this; // $FlowFixMe[incompatible-type] See above static toWeb(streamDuplex: stream$Duplex): { readable: ReadableStream, writable: WritableStream, ... }; constructor(options?: duplexStreamOptions): void; } type transformStreamOptions = duplexStreamOptions & { flush?: (callback: (error: ?Error, data: ?(Buffer | string)) => void) => void, transform?: ( chunk: Buffer | string, encoding: string, callback: (error: ?Error, data: ?(Buffer | string)) => void, ) => void, ... }; declare class stream$Transform extends stream$Duplex { constructor(options?: transformStreamOptions): void; _flush(callback: (error: ?Error, data: ?(Buffer | string)) => void): void; _transform( chunk: Buffer | string, encoding: string, callback: (error: ?Error, data: ?(Buffer | string)) => void, ): void; } declare class stream$PassThrough extends stream$Transform {} declare module 'stream' { declare var Stream: typeof stream$Stream; declare var Readable: typeof stream$Readable; declare var Writable: typeof stream$Writable; declare var Duplex: typeof stream$Duplex; declare var Transform: typeof stream$Transform; declare var PassThrough: typeof stream$PassThrough; declare function finished( stream: stream$Stream, callback: (error?: Error) => void, ): () => void; declare function finished( stream: stream$Stream, options: ?{ error?: boolean, readable?: boolean, writable?: boolean, ... }, callback: (error?: Error) => void, ): () => void; declare function pipeline( s1: stream$Readable, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, s5: stream$Duplex, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, s5: stream$Duplex, s6: stream$Duplex, last: T, cb: (error?: Error) => void, ): T; declare function pipeline( streams: Array, cb: (error?: Error) => void, ): stream$Stream; declare interface StreamPipelineOptions { +signal?: AbortSignal; +end?: boolean; } declare type StreamPromise = { pipeline( s1: stream$Readable, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, s5: stream$Duplex, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( s1: stream$Readable, s2: stream$Duplex, s3: stream$Duplex, s4: stream$Duplex, s5: stream$Duplex, s6: stream$Duplex, last: stream$Writable, options?: StreamPipelineOptions, ): Promise, pipeline( streams: ReadonlyArray, options?: StreamPipelineOptions, ): Promise, ... }; declare var promises: StreamPromise; } declare class tty$ReadStream extends net$Socket { constructor(fd: number, options?: Object): void; isRaw: boolean; setRawMode(mode: boolean): void; isTTY: true; } declare class tty$WriteStream extends net$Socket { constructor(fd: number): void; /** * Clears the current line of this `WriteStream` in a direction identified by `dir`. * * TODO: takes a callback and returns `boolean` in v12+ */ clearLine(dir: -1 | 0 | 1): void; columns: number; /** * Moves this WriteStream's cursor to the specified position * * TODO: takes a callback and returns `boolean` in v12+ */ cursorTo(x: number, y?: number): void; isTTY: true; /** * Moves this WriteStream's cursor relative to its current position * * TODO: takes a callback and returns `boolean` in v12+ */ moveCursor(dx: number, dy: number): void; rows: number; /** * Clears this WriteStream from the current cursor down. */ clearScreenDown(callback?: () => void): boolean; /** * Use this to determine what colors the terminal supports. Due to the nature of colors in terminals it is possible to either have false positives or false negatives. It depends on process information and the environment variables that may lie about what terminal is used. It is possible to pass in an env object to simulate the usage of a specific terminal. This can be useful to check how specific environment settings behave. * To enforce a specific color support, use one of the below environment settings. * * 2 colors: FORCE_COLOR = 0 (Disables colors) * 16 colors: FORCE_COLOR = 1 * 256 colors: FORCE_COLOR = 2 * 16,777,216 colors: FORCE_COLOR = 3 * Disabling color support is also possible by using the NO_COLOR and NODE_DISABLE_COLORS environment variables. */ getColorDepth(env?: typeof process.env): | 1 // 2 | 4 // 16 | 8 // 256 | 24; // 16,777,216 /** * Returns the size of the TTY corresponding to this WriteStream. The array is of the type [numColumns, numRows] where numColumns and numRows represent the number of columns and rows in the corresponding TTY. */ getWindowSize(): [ number, // columns number, // rows ]; /** * - count The number of colors that are requested (minimum 2). Default: 16. * - env An object containing the environment variables to check. This enables simulating the usage of a specific terminal. Default: process.env. * - Returns: * * Returns true if the writeStream supports at least as many colors as provided in count. Minimum support is 2 (black and white). * * This has the same false positives and negatives as described in tty$WriteStream#getColorDepth(). */ hasColors(count?: number, env?: typeof process.env): boolean; } declare module 'tty' { declare function isatty(fd: number): boolean; declare function setRawMode(mode: boolean): void; declare var ReadStream: typeof tty$ReadStream; declare var WriteStream: typeof tty$WriteStream; } declare class string_decoder$StringDecoder { constructor(encoding?: 'utf8' | 'ucs2' | 'utf16le' | 'base64'): void; end(): string; write(buffer: Buffer): string; } declare module 'string_decoder' { declare var StringDecoder: typeof string_decoder$StringDecoder; } type tls$connectOptions = { port?: number, host?: string, socket?: net$Socket, rejectUnauthorized?: boolean, path?: string, lookup?: ( domain: string, options?: ?number | ?Object, callback?: (err: ?Error, address: string, family: number) => void, ) => unknown, requestOCSP?: boolean, ... }; type tls$SecureContext = interface {}; type tls$createServerOptions = Readonly<{ ALPNProtocols?: ReadonlyArray | Uint8Array, ca?: string | Buffer | ReadonlyArray, cert?: string | Buffer | ReadonlyArray, ciphers?: string, clientCertEngine?: string, crl?: string | Buffer | ReadonlyArray, dhparam?: string | Buffer, ecdhCurve?: string, enableTrace?: boolean, handshakeTimeout?: number, honorCipherOrder?: boolean, key?: | string | Buffer | ReadonlyArray< | string | Buffer | Readonly<{pem: string | Buffer, passphrase?: string, ...}>, >, maxVersion?: 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1', minVersion?: 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1', passphrase?: string, pfx?: | string | Buffer | ReadonlyArray< | string | Buffer | Readonly<{buf: string | Buffer, passphrase?: string, ...}>, >, privateKeyIdentifier?: string, privateKeyEngine?: string, pskCallback?: (socket: tls$TLSSocket, identity: string) => Buffer | null, pskIdentityHint?: string, rejectUnauthorized?: boolean, requestCert?: boolean, secureContext?: tls$SecureContext, secureOptions?: number, secureProtocol?: string, sessionIdContext?: string, sessionTimeout?: number, sigalgs?: string, SNICallback?: ( servername: string, callback: (err: Error | null, ctx?: tls$SecureContext) => void, ) => void, ticketKeys?: Buffer, }>; type tls$Certificate$Subject = { C?: string, ST?: string, L?: string, O?: string, OU?: string, CN?: string, ... }; type tls$Certificate = { raw: Buffer, subject: tls$Certificate$Subject, issuer: tls$Certificate$Subject, valid_from: string, valid_to: string, serialNumber: string, fingerprint: string, fingerprint256: string, ext_key_usage?: Array, subjectaltname?: string, infoAccess?: {[string]: Array, ...}, issuerCertificate?: tls$Certificate, ... }; declare class tls$TLSSocket extends net$Socket { constructor(socket: net$Socket, options?: Object): void; authorized: boolean; authorizationError: string | null; encrypted: true; getCipher(): { name: string, version: string, ... } | null; getEphemeralKeyInfo(): | { type: 'DH', size: number, ... } | { type: 'EDHC', name: string, size: number, ... } | null; getPeerCertificate(detailed?: boolean): tls$Certificate | null; getSession(): ?Buffer; getTLSTicket(): Buffer | void; renegotiate(options: Object, callback: Function): boolean | void; setMaxSendFragment(size: number): boolean; } declare class tls$Server extends net$Server { listen( port?: number, hostname?: string, backlog?: number, callback?: Function, ): tls$Server; listen(path: string, callback?: Function): tls$Server; listen(handle: Object, callback?: Function): tls$Server; close(callback?: Function): tls$Server; addContext(hostname: string, context: Object): void; getTicketKeys(): Buffer; setTicketKeys(keys: Buffer): void; } declare module 'tls' { export type ServerOptions = tls$createServerOptions; declare var CLIENT_RENEG_LIMIT: number; declare var CLIENT_RENEG_WINDOW: number; declare var SLAB_BUFFER_SIZE: number; declare var DEFAULT_CIPHERS: string; declare var DEFAULT_ECDH_CURVE: string; declare function getCiphers(): Array; declare function convertNPNProtocols( NPNProtocols: Array, out: Object, ): void; declare function checkServerIdentity( servername: string, cert: string, ): Error | void; declare function parseCertString(s: string): Object; declare function createSecureContext(details: Object): Object; declare var SecureContext: tls$SecureContext; declare var TLSSocket: typeof tls$TLSSocket; declare var Server: typeof tls$Server; declare function createServer( options: tls$createServerOptions, secureConnectionListener?: (socket: tls$TLSSocket) => void, ): tls$Server; declare function createServer( secureConnectionListener?: (socket: tls$TLSSocket) => void, ): tls$Server; declare function connect( options: tls$connectOptions, callback?: Function, ): tls$TLSSocket; declare function connect( port: number, host?: string, options?: tls$connectOptions, callback?: Function, ): tls$TLSSocket; declare function createSecurePair( context?: Object, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean, options?: Object, ): Object; } type url$urlObject = { +href?: string, +protocol?: string | null, +slashes?: boolean | null, +auth?: string | null, +hostname?: string | null, +port?: string | number | null, +host?: string | null, +pathname?: string | null, +search?: string | null, +query?: Object | null, +hash?: string | null, ... }; declare module 'timers' { declare export class Timeout { close(): this; hasRef(): boolean; ref(): this; refresh(): this; unref(): this; [key: $SymbolToPrimitive]: () => number; // [key: $SymbolDispose]: () => void; } declare export class Immediate { hasRef(): boolean; ref(): this; unref(): this; // [key: $SymbolDispose]: () => void; } declare export function setTimeout>( callback: (...args: TArgs) => unknown, delay?: number, ...args: TArgs ): Timeout; declare export function setInterval>( callback: (...args: TArgs) => unknown, delay?: number, ...args: TArgs ): Timeout; declare export function setImmediate>( callback: (...args: TArgs) => unknown, ...args: TArgs ): Immediate; declare export function clearTimeout(timeout?: Timeout | number): void; declare export function clearInterval(timeout?: Timeout | number): void; declare export function clearImmediate(immediate?: Immediate | number): void; } declare module 'timers/promises' { declare export type TimerOptions = Readonly<{ ref?: boolean, signal?: AbortSignal, }>; declare export function setTimeout( delay?: number, value?: T, options?: TimerOptions, ): Promise; declare export function setImmediate( value?: T, options?: TimerOptions, ): Promise; declare export function setInterval( delay?: number, value?: T, options?: TimerOptions, ): AsyncIterator; declare export var scheduler: Readonly<{ wait(delay: number, options?: TimerOptions): Promise, yield(): Promise, }>; } declare module 'url' { declare type Url = {| protocol: string | null, slashes: boolean | null, auth: string | null, host: string | null, port: string | null, hostname: string | null, hash: string | null, search: string | null, query: string | null | {[string]: string, ...}, pathname: string | null, path: string | null, href: string, |}; declare type UrlWithStringQuery = {| ...Url, query: string | null, |}; declare type UrlWithParsedQuery = {| ...Url, query: {[string]: string, ...}, |}; declare function parse( urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean, ): UrlWithParsedQuery; declare function parse( urlStr: string, parseQueryString?: false | void, slashesDenoteHost?: boolean, ): UrlWithStringQuery; declare function parse( urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean, ): Url; declare function format(urlObj: url$urlObject): string; declare function resolve(from: string, to: string): string; declare function domainToASCII(domain: string): string; declare function domainToUnicode(domain: string): string; declare function pathToFileURL( path: string, options?: Readonly<{windows?: boolean}>, ): url$urlObject; declare function fileURLToPath( path: url$urlObject | string, options?: Readonly<{windows?: boolean}>, ): string; declare class URLSearchParams { @@iterator(): Iterator<[string, string]>; size: number; constructor( init?: | string | URLSearchParams | Array<[string, string]> | {[string]: string, ...}, ): void; append(name: string, value: string): void; delete(name: string, value?: void): void; entries(): Iterator<[string, string]>; forEach( callback: ( this: This, value: string, name: string, searchParams: URLSearchParams, ) => unknown, thisArg?: This, ): void; get(name: string): string | null; getAll(name: string): string[]; has(name: string, value?: string): boolean; keys(): Iterator; set(name: string, value: string): void; sort(): void; values(): Iterator; toString(): string; } declare class URL { static canParse(url: string, base?: string): boolean; static parse(input: string, base?: string): URL | null; static createObjectURL(blob: Blob): string; static createObjectURL(mediaSource: MediaSource): string; static revokeObjectURL(url: string): void; constructor(input: string, base?: string | URL): void; hash: string; host: string; hostname: string; href: string; +origin: string; password: string; pathname: string; port: string; protocol: string; search: string; +searchParams: URLSearchParams; username: string; toString(): string; toJSON(): string; } declare type url$URLPatternInit = { protocol?: string, username?: string, password?: string, hostname?: string, port?: string, pathname?: string, search?: string, hash?: string, baseURL?: string, }; declare type url$URLPatternComponentResult = { input: string, groups: {[key: string]: string | void}, }; declare type url$URLPatternResult = { inputs: ReadonlyArray, protocol: url$URLPatternComponentResult, username: url$URLPatternComponentResult, password: url$URLPatternComponentResult, hostname: url$URLPatternComponentResult, port: url$URLPatternComponentResult, pathname: url$URLPatternComponentResult, search: url$URLPatternComponentResult, hash: url$URLPatternComponentResult, }; declare class URLPattern { constructor( input?: string | url$URLPatternInit, options?: Readonly<{ignoreCase?: boolean}>, ): void; constructor( input: string | url$URLPatternInit, baseURL: string, options?: Readonly<{ignoreCase?: boolean}>, ): void; +hasRegExpGroups: boolean; +hash: string; +hostname: string; +password: string; +pathname: string; +port: string; +protocol: string; +search: string; +username: string; exec( input?: string | url$URLPatternInit, baseURL?: string, ): url$URLPatternResult | null; test(input?: string | url$URLPatternInit, baseURL?: string): boolean; } } type util$InspectOptions = { showHidden?: boolean, depth?: ?number, colors?: boolean, customInspect?: boolean, ... }; declare type util$ParseArgsOption = | Readonly<{ type: 'boolean', multiple?: false, short?: string, default?: boolean, }> | Readonly<{ type: 'boolean', multiple: true, short?: string, default?: Array, }> | Readonly<{ type: 'string', multiple?: false, short?: string, default?: string, }> | Readonly<{ type: 'string', multiple: true, short?: string, default?: Array, }>; type util$ParseArgsOptionToValue = TOption['type'] extends 'boolean' ? TOption['multiple'] extends true ? Array : boolean : TOption['type'] extends 'string' ? TOption['multiple'] extends true ? Array : string : empty; type util$ParseArgsOptionsToValues = { [key in keyof TOptions]: util$ParseArgsOptionToValue<{| multiple: false, ...TOptions[key], |}>, }; type util$ParseArgsToken = | {| kind: 'option', index: number, name: string, rawName: string, value?: string, inlineValue?: boolean, |} | {| kind: 'positional', index: number, value: string, |} | {| kind: 'option-terminator', index: number, |}; declare module 'util' { declare function debuglog(section: string): (data: any, ...args: any) => void; declare function format(format: string, ...placeholders: any): string; declare function log(string: string): void; declare function inspect(object: any, options?: util$InspectOptions): string; declare function isArray(object: any): boolean; declare function isRegExp(object: any): boolean; declare function isDate(object: any): boolean; declare function isError(object: any): boolean; declare function inherits( constructor: Function, superConstructor: Function, ): void; declare function deprecate(f: Function, string: string): Function; declare function promisify(f: Function): Function; declare function callbackify(f: Function): Function; declare function stripVTControlCharacters(str: string): string; declare function parseArgs< TOptions extends {+[string]: util$ParseArgsOption} = {}, >(config: { args?: Array, options?: TOptions, strict?: boolean, allowPositionals?: boolean, allowNegative?: boolean, tokens?: false, }): { values: util$ParseArgsOptionsToValues, positionals: Array, }; declare function parseArgs< TOptions extends {[string]: util$ParseArgsOption} = {}, >(config: { args?: Array, options?: TOptions, strict?: boolean, allowPositionals?: boolean, allowNegative?: boolean, tokens: true, }): { values: util$ParseArgsOptionsToValues, positionals: Array, tokens: Array, }; declare class TextDecoder { constructor( encoding?: string, options: { fatal?: boolean, ignoreBOM?: boolean, ... }, ): void; decode( input?: ArrayBuffer | DataView | $TypedArray, options?: {stream?: boolean, ...}, ): string; encoding: string; fatal: boolean; ignoreBOM: boolean; } declare class TextEncoder { constructor(): void; encode(input?: string): Uint8Array; encoding: string; } declare class MIMEType { constructor(input: string): void; type: string; subtype: string; +essence: string; +params: MIMEParams; toString(): string; } declare class MIMEParams { delete(name: string): void; get(name: string): ?string; has(name: string): boolean; set(name: string, value: string): void; entries(): Iterator<[string, string]>; keys(): Iterator; values(): Iterator; } declare function parseEnv(content: string): {[key: string]: string, ...}; declare type util$DiffEntry = [operation: -1 | 0 | 1, value: string]; declare function diff( actual: string | ReadonlyArray, expected: string | ReadonlyArray, ): Array; declare function getSystemErrorMessage(err: number): string; declare type util$CallSiteObject = { functionName: string, scriptName: string, scriptId: string, lineNumber: number, columnNumber: number, }; declare function getCallSites( frameCountOrOptions?: number | Readonly<{frameCount?: number}>, ): Array; declare var types: { isAnyArrayBuffer: (value: unknown) => boolean, isArgumentsObject: (value: unknown) => boolean, isArrayBuffer: (value: unknown) => boolean, isAsyncFunction: (value: unknown) => boolean, isBigInt64Array: (value: unknown) => boolean, isBigUint64Array: (value: unknown) => boolean, isBooleanObject: (value: unknown) => boolean, isBoxedPrimitive: (value: unknown) => boolean, isDataView: (value: unknown) => boolean, isDate: (value: unknown) => boolean, isExternal: (value: unknown) => boolean, isFloat16Array: (value: unknown) => boolean, isFloat32Array: (value: unknown) => boolean, isFloat64Array: (value: unknown) => boolean, isGeneratorFunction: (value: unknown) => boolean, isGeneratorObject: (value: unknown) => boolean, isInt8Array: (value: unknown) => boolean, isInt16Array: (value: unknown) => boolean, isInt32Array: (value: unknown) => boolean, isMap: (value: unknown) => boolean, isMapIterator: (value: unknown) => boolean, isModuleNamespaceObject: (value: unknown) => boolean, isNativeError: (value: unknown) => boolean, isNumberObject: (value: unknown) => boolean, isPromise: (value: unknown) => boolean, isProxy: (value: unknown) => boolean, isRegExp: (value: unknown) => boolean, isSet: (value: unknown) => boolean, isSetIterator: (value: unknown) => boolean, isSharedArrayBuffer: (value: unknown) => boolean, isStringObject: (value: unknown) => boolean, isSymbolObject: (value: unknown) => boolean, isTypedArray: (value: unknown) => boolean, isUint8Array: (value: unknown) => boolean, isUint8ClampedArray: (value: unknown) => boolean, isUint16Array: (value: unknown) => boolean, isUint32Array: (value: unknown) => boolean, isWeakMap: (value: unknown) => boolean, isWeakSet: (value: unknown) => boolean, isWebAssemblyCompiledModule: (value: unknown) => boolean, ... }; declare type BackgroundColors = | 'bgBlack' | 'bgBlackBright' | 'bgBlue' | 'bgBlueBright' | 'bgCyan' | 'bgCyanBright' | 'bgGray' | 'bgGreen' | 'bgGreenBright' | 'bgGrey' | 'bgMagenta' | 'bgMagentaBright' | 'bgRed' | 'bgRedBright' | 'bgWhite' | 'bgWhiteBright' | 'bgYellow' | 'bgYellowBright'; declare type ForegroundColors = | 'black' | 'blackBright' | 'blue' | 'blueBright' | 'cyan' | 'cyanBright' | 'gray' | 'green' | 'greenBright' | 'grey' | 'magenta' | 'magentaBright' | 'red' | 'redBright' | 'white' | 'whiteBright' | 'yellow' | 'yellowBright'; declare type Modifiers = | 'blink' | 'bold' | 'dim' | 'doubleunderline' | 'framed' | 'hidden' | 'inverse' | 'italic' | 'overlined' | 'reset' | 'strikethrough' | 'underline'; declare function styleText( format: | ForegroundColors | BackgroundColors | Modifiers | ReadonlyArray, text: string, options?: Readonly<{ stream?: ?stream$Stream, validateStream?: ?boolean, }>, ): string; } type vm$ScriptOptions = { cachedData?: Buffer, columnOffset?: number, displayErrors?: boolean, filename?: string, lineOffset?: number, produceCachedData?: boolean, timeout?: number, ... }; type vm$CreateContextOptions = { name?: string, origin?: string, codeGeneration?: { strings?: boolean, wasm?: boolean, ... }, ... }; type vm$CompileFunctionOptions = { filename?: string, lineOffset?: number, columnOffset?: number, cachedData?: Buffer, produceCachedData?: boolean, parsingContext?: {[key: string]: any, ...}, contextExtensions?: Array<{[key: string]: any, ...}>, ... }; declare class vm$Script { constructor(code: string, options?: vm$ScriptOptions | string): void; cachedData: ?Buffer; cachedDataRejected: ?boolean; cachedDataProduced: ?boolean; runInContext( contextifiedSandbox: vm$Context, options?: vm$ScriptOptions, ): any; runInNewContext( sandbox?: {[key: string]: any, ...}, options?: vm$ScriptOptions, ): any; runInThisContext(options?: vm$ScriptOptions): any; createCachedData(): Buffer; } declare class vm$Context {} declare module 'vm' { declare var Script: typeof vm$Script; declare function createContext( sandbox?: interface {[key: string]: any}, options?: vm$CreateContextOptions, ): vm$Context; declare function isContext(sandbox: {[key: string]: any, ...}): boolean; declare function runInContext( code: string, contextifiedSandbox: vm$Context, options?: vm$ScriptOptions | string, ): any; declare function runInDebugContext(code: string): any; declare function runInNewContext( code: string, sandbox?: {[key: string]: any, ...}, options?: vm$ScriptOptions | string, ): any; declare function runInThisContext( code: string, options?: vm$ScriptOptions | string, ): any; declare function compileFunction( code: string, params: string[], options: vm$CompileFunctionOptions, ): Function; } type zlib$options = { flush?: number, chunkSize?: number, windowBits?: number, level?: number, memLevel?: number, strategy?: number, dictionary?: Buffer, ... }; type zlib$brotliOptions = { flush?: number, finishFlush?: number, chunkSize?: number, params?: { [number]: boolean | number, ... }, maxOutputLength?: number, ... }; type zlib$zstdOptions = { flush?: number, finishFlush?: number, chunkSize?: number, params?: { [number]: boolean | number, ... }, maxOutputLength?: number, info?: boolean, dictionary?: Buffer, ... }; type zlib$syncFn = ( buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string, options?: zlib$options, ) => Buffer; type zlib$asyncFn = ( buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string, options?: zlib$options, callback?: (error: ?Error, result: Buffer) => void, ) => void; type zlib$brotliSyncFn = ( buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string, options?: zlib$brotliOptions, ) => Buffer; type zlib$brotliAsyncFn = ( buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string, options?: zlib$brotliOptions, callback?: (error: ?Error, result: Buffer) => void, ) => void; // Accessing the constants directly from the module is currently still // possible but should be considered deprecated. // ref: https://github.com/nodejs/node/blob/master/doc/api/zlib.md declare module 'zlib' { declare var Z_NO_FLUSH: number; declare var Z_PARTIAL_FLUSH: number; declare var Z_SYNC_FLUSH: number; declare var Z_FULL_FLUSH: number; declare var Z_FINISH: number; declare var Z_BLOCK: number; declare var Z_TREES: number; declare var Z_OK: number; declare var Z_STREAM_END: number; declare var Z_NEED_DICT: number; declare var Z_ERRNO: number; declare var Z_STREAM_ERROR: number; declare var Z_DATA_ERROR: number; declare var Z_MEM_ERROR: number; declare var Z_BUF_ERROR: number; declare var Z_VERSION_ERROR: number; declare var Z_NO_COMPRESSION: number; declare var Z_BEST_SPEED: number; declare var Z_BEST_COMPRESSION: number; declare var Z_DEFAULT_COMPRESSION: number; declare var Z_FILTERED: number; declare var Z_HUFFMAN_ONLY: number; declare var Z_RLE: number; declare var Z_FIXED: number; declare var Z_DEFAULT_STRATEGY: number; declare var Z_BINARY: number; declare var Z_TEXT: number; declare var Z_ASCII: number; declare var Z_UNKNOWN: number; declare var Z_DEFLATED: number; declare var Z_NULL: number; declare var Z_DEFAULT_CHUNK: number; declare var Z_DEFAULT_LEVEL: number; declare var Z_DEFAULT_MEMLEVEL: number; declare var Z_DEFAULT_WINDOWBITS: number; declare var Z_MAX_CHUNK: number; declare var Z_MAX_LEVEL: number; declare var Z_MAX_MEMLEVEL: number; declare var Z_MAX_WINDOWBITS: number; declare var Z_MIN_CHUNK: number; declare var Z_MIN_LEVEL: number; declare var Z_MIN_MEMLEVEL: number; declare var Z_MIN_WINDOWBITS: number; declare var constants: { Z_NO_FLUSH: number, Z_PARTIAL_FLUSH: number, Z_SYNC_FLUSH: number, Z_FULL_FLUSH: number, Z_FINISH: number, Z_BLOCK: number, Z_TREES: number, Z_OK: number, Z_STREAM_END: number, Z_NEED_DICT: number, Z_ERRNO: number, Z_STREAM_ERROR: number, Z_DATA_ERROR: number, Z_MEM_ERROR: number, Z_BUF_ERROR: number, Z_VERSION_ERROR: number, Z_NO_COMPRESSION: number, Z_BEST_SPEED: number, Z_BEST_COMPRESSION: number, Z_DEFAULT_COMPRESSION: number, Z_FILTERED: number, Z_HUFFMAN_ONLY: number, Z_RLE: number, Z_FIXED: number, Z_DEFAULT_STRATEGY: number, Z_BINARY: number, Z_TEXT: number, Z_ASCII: number, Z_UNKNOWN: number, Z_DEFLATED: number, Z_NULL: number, Z_DEFAULT_CHUNK: number, Z_DEFAULT_LEVEL: number, Z_DEFAULT_MEMLEVEL: number, Z_DEFAULT_WINDOWBITS: number, Z_MAX_CHUNK: number, Z_MAX_LEVEL: number, Z_MAX_MEMLEVEL: number, Z_MAX_WINDOWBITS: number, Z_MIN_CHUNK: number, Z_MIN_LEVEL: number, Z_MIN_MEMLEVEL: number, Z_MIN_WINDOWBITS: number, BROTLI_DECODE: number, BROTLI_ENCODE: number, BROTLI_OPERATION_PROCESS: number, BROTLI_OPERATION_FLUSH: number, BROTLI_OPERATION_FINISH: number, BROTLI_OPERATION_EMIT_METADATA: number, BROTLI_PARAM_MODE: number, BROTLI_MODE_GENERIC: number, BROTLI_MODE_TEXT: number, BROTLI_MODE_FONT: number, BROTLI_DEFAULT_MODE: number, BROTLI_PARAM_QUALITY: number, BROTLI_MIN_QUALITY: number, BROTLI_MAX_QUALITY: number, BROTLI_DEFAULT_QUALITY: number, BROTLI_PARAM_LGWIN: number, BROTLI_MIN_WINDOW_BITS: number, BROTLI_MAX_WINDOW_BITS: number, BROTLI_LARGE_MAX_WINDOW_BITS: number, BROTLI_DEFAULT_WINDOW: number, BROTLI_PARAM_LGBLOCK: number, BROTLI_MIN_INPUT_BLOCK_BITS: number, BROTLI_MAX_INPUT_BLOCK_BITS: number, BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number, BROTLI_PARAM_SIZE_HINT: number, BROTLI_PARAM_LARGE_WINDOW: number, BROTLI_PARAM_NPOSTFIX: number, BROTLI_PARAM_NDIRECT: number, BROTLI_DECODER_RESULT_ERROR: number, BROTLI_DECODER_RESULT_SUCCESS: number, BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number, BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number, BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number, BROTLI_DECODER_PARAM_LARGE_WINDOW: number, BROTLI_DECODER_NO_ERROR: number, BROTLI_DECODER_SUCCESS: number, BROTLI_DECODER_NEEDS_MORE_INPUT: number, BROTLI_DECODER_NEEDS_MORE_OUTPUT: number, BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number, BROTLI_DECODER_ERROR_FORMAT_RESERVED: number, BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number, BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number, BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number, BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number, BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number, BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number, BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number, BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number, BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number, BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number, BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number, BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number, BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number, BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number, BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number, BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number, BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number, BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number, BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number, BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number, BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number, BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number, BROTLI_DECODER_ERROR_UNREACHABL: number, ZSTD_COMPRESS: number, ZSTD_DECOMPRESS: number, // Default compression level for zstd streams ZSTD_CLEVEL_DEFAULT: number, // Keys for zlib$zstdOptions['params'] ZSTD_c_compressionLevel: number, ZSTD_c_windowLog: number, ZSTD_c_hashLog: number, ZSTD_c_chainLog: number, ZSTD_c_searchLog: number, ZSTD_c_minMatch: number, ZSTD_c_targetLength: number, ZSTD_c_strategy: number, ZSTD_c_enableLongDistanceMatching: number, ZSTD_c_ldmHashLog: number, ZSTD_c_ldmMinMatch: number, ZSTD_c_ldmBucketSizeLog: number, ZSTD_c_ldmHashRateLog: number, ZSTD_c_contentSizeFlag: number, ZSTD_c_checksumFlag: number, ZSTD_c_dictIDFlag: number, ZSTD_c_nbWorkers: number, ZSTD_c_jobSize: number, ZSTD_c_overlapLog: number, // Flush operations ZSTD_e_continue: number, ZSTD_e_flush: number, ZSTD_e_end: number, // Values for the ZSTD_c_strategy parameter ZSTD_fast: number, ZSTD_dfast: number, ZSTD_greedy: number, ZSTD_lazy: number, ZSTD_lazy2: number, ZSTD_btlazy2: number, ZSTD_btopt: number, ZSTD_btultra: number, ZSTD_btultra2: number, // Error codes ZSTD_error_no_error: number, ZSTD_error_GENERIC: number, ZSTD_error_prefix_unknown: number, ZSTD_error_version_unsupported: number, ZSTD_error_frameParameter_unsupported: number, ZSTD_error_frameParameter_windowTooLarge: number, ZSTD_error_corruption_detected: number, ZSTD_error_checksum_wrong: number, ZSTD_error_literals_headerWrong: number, ZSTD_error_dictionary_corrupted: number, ZSTD_error_dictionary_wrong: number, ZSTD_error_dictionaryCreation_failed: number, ZSTD_error_parameter_unsupported: number, ZSTD_error_parameter_combination_unsupported: number, ZSTD_error_parameter_outOfBound: number, ZSTD_error_tableLog_tooLarge: number, ZSTD_error_maxSymbolValue_tooLarge: number, ZSTD_error_maxSymbolValue_tooSmall: number, ZSTD_error_stabilityCondition_notRespected: number, ZSTD_error_stage_wrong: number, ZSTD_error_init_missing: number, ZSTD_error_memory_allocation: number, ZSTD_error_workSpace_tooSmall: number, ZSTD_error_dstSize_tooSmall: number, ZSTD_error_srcSize_wrong: number, ZSTD_error_dstBuffer_null: number, ZSTD_error_noForwardProgress_destFull: number, ZSTD_error_noForwardProgress_inputEmpty: number, ... }; declare var codes: { Z_OK: number, Z_STREAM_END: number, Z_NEED_DICT: number, Z_ERRNO: number, Z_STREAM_ERROR: number, Z_DATA_ERROR: number, Z_MEM_ERROR: number, Z_BUF_ERROR: number, Z_VERSION_ERROR: number, ... }; declare class Zlib extends stream$Duplex { // TODO } declare class BrotliCompress extends Zlib {} declare class BrotliDecompress extends Zlib {} declare class ZstdCompress extends Zlib {} declare class ZstdDecompress extends Zlib {} declare class Deflate extends Zlib {} declare class Inflate extends Zlib {} declare class Gzip extends Zlib {} declare class Gunzip extends Zlib {} declare class DeflateRaw extends Zlib {} declare class InflateRaw extends Zlib {} declare class Unzip extends Zlib {} declare function createBrotliCompress( options?: zlib$brotliOptions, ): BrotliCompress; declare function createBrotliDecompress( options?: zlib$brotliOptions, ): BrotliDecompress; declare function createDeflate(options?: zlib$options): Deflate; declare function createInflate(options?: zlib$options): Inflate; declare function createDeflateRaw(options?: zlib$options): DeflateRaw; declare function createInflateRaw(options?: zlib$options): InflateRaw; declare function createGzip(options?: zlib$options): Gzip; declare function createGunzip(options?: zlib$options): Gunzip; declare function createUnzip(options?: zlib$options): Unzip; declare function createZstdCompress(options?: zlib$zstdOptions): ZstdCompress; declare function createZstdDecompress( options?: zlib$zstdOptions, ): ZstdDecompress; declare var brotliCompress: zlib$brotliAsyncFn; declare var brotliCompressSync: zlib$brotliSyncFn; declare var brotliDeompress: zlib$brotliAsyncFn; declare var brotliDecompressSync: zlib$brotliSyncFn; declare var deflate: zlib$asyncFn; declare var deflateSync: zlib$syncFn; declare var gzip: zlib$asyncFn; declare var gzipSync: zlib$syncFn; declare var deflateRaw: zlib$asyncFn; declare var deflateRawSync: zlib$syncFn; declare var unzip: zlib$asyncFn; declare var unzipSync: zlib$syncFn; declare var inflate: zlib$asyncFn; declare var inflateSync: zlib$syncFn; declare var gunzip: zlib$asyncFn; declare var gunzipSync: zlib$syncFn; declare var inflateRaw: zlib$asyncFn; declare var inflateRawSync: zlib$syncFn; } declare module 'assert' { declare class AssertionError extends Error {} declare type AssertStrict = { (value: any, message?: string): void, ok(value: any, message?: string): void, fail(message?: string | Error): void, // deprecated since v10.15 fail(actual: any, expected: any, message: string, operator: string): void, equal(actual: any, expected: any, message?: string): void, notEqual(actual: any, expected: any, message?: string): void, deepEqual(actual: any, expected: any, message?: string): void, notDeepEqual(actual: any, expected: any, message?: string): void, throws( block: Function, error?: Function | RegExp | ((err: any) => boolean), message?: string, ): void, doesNotThrow(block: Function, message?: string): void, ifError(value: any): void, AssertionError: typeof AssertionError, strict: AssertStrict, ... }; declare module.exports: { (value: any, message?: string): void, ok(value: any, message?: string): void, fail(message?: string | Error): void, // deprecated since v10.15 fail(actual: any, expected: any, message: string, operator: string): void, equal(actual: any, expected: any, message?: string): void, notEqual(actual: any, expected: any, message?: string): void, deepEqual(actual: any, expected: any, message?: string): void, notDeepEqual(actual: any, expected: any, message?: string): void, strictEqual(actual: any, expected: any, message?: string): void, notStrictEqual(actual: any, expected: any, message?: string): void, deepStrictEqual(actual: any, expected: any, message?: string): void, notDeepStrictEqual(actual: any, expected: any, message?: string): void, throws( block: Function, error?: Function | RegExp | ((err: any) => boolean), message?: string, ): void, doesNotThrow(block: Function, message?: string): void, ifError(value: any): void, AssertionError: typeof AssertionError, strict: AssertStrict, ... }; } declare module 'assert/strict' { declare module.exports: $Exports<'assert'>['strict']; } declare module 'v8' { declare export type DoesZapCodeSpaceFlag = 0 | 1; declare export type HeapCodeStatistics = { code_and_metadata_size: number, bytecode_and_metadata_size: number, external_script_source_size: number, cpu_profiler_metadata_size: number, }; declare export type HeapInfo = { total_heap_size: number, total_heap_size_executable: number, total_physical_size: number, total_available_size: number, used_heap_size: number, heap_size_limit: number, malloced_memory: number, peak_malloced_memory: number, does_zap_garbage: DoesZapCodeSpaceFlag, number_of_native_contexts: number, number_of_detached_contexts: number, total_global_handles_size: number, used_global_handles_size: number, external_memory: number, }; declare export type HeapSpaceInfo = { space_name: string, space_size: number, space_used_size: number, space_available_size: number, physical_space_size: number, }; declare export type HeapSnapshotOptions = Readonly<{ exposeInternals?: boolean, exposeNumericValues?: boolean, }>; // For GCProfiler - uses camelCase naming convention declare export type HeapStatistics = { totalHeapSize: number, totalHeapSizeExecutable: number, totalPhysicalSize: number, totalAvailableSize: number, totalGlobalHandlesSize: number, usedGlobalHandlesSize: number, usedHeapSize: number, heapSizeLimit: number, mallocedMemory: number, externalMemory: number, peakMallocedMemory: number, }; declare export type HeapSpaceStatistics = { spaceName: string, spaceSize: number, spaceUsedSize: number, spaceAvailableSize: number, physicalSpaceSize: number, }; declare export type GCProfilerResult = { version: number, startTime: number, endTime: number, statistics: ReadonlyArray<{ gcType: string, cost: number, beforeGC: { heapStatistics: HeapStatistics, heapSpaceStatistics: ReadonlyArray, }, afterGC: { heapStatistics: HeapStatistics, heapSpaceStatistics: ReadonlyArray, }, }>, }; /** * Returns an integer representing a "version tag" derived from the V8 version, * command line flags and detected CPU features. This is useful for determining * whether a vm.Script cachedData buffer is compatible with this instance of V8. */ declare function cachedDataVersionTag(): number; /** * Returns statistics about code and its metadata in the heap. */ declare function getHeapCodeStatistics(): HeapCodeStatistics; /** * Returns an object with statistics about the V8 heap. */ declare function getHeapStatistics(): HeapInfo; /** * Returns statistics about the V8 heap spaces. */ declare function getHeapSpaceStatistics(): Array; /** * Generates a snapshot of the current V8 heap and returns a Readable Stream * that may be used to read the JSON serialized representation. This JSON stream * format is intended to be used with tools such as Chrome DevTools. The JSON * schema is undocumented and specific to the V8 engine. * @param options Optional settings for controlling snapshot detail */ declare function getHeapSnapshot( options?: HeapSnapshotOptions, ): stream$Readable; /** * Generates a snapshot of the current V8 heap and writes it to a JSON file. * @param fileName The file path where the snapshot will be saved. If not specified, * a file name with the pattern 'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot' * will be generated. * @param options Optional settings for controlling snapshot detail * @returns The filename where the snapshot was saved */ declare function writeHeapSnapshot( fileName?: string, options?: HeapSnapshotOptions, ): string; /** * Sets V8 command-line flags. Use with care; changing settings after the VM has * started may result in unpredictable behavior, crashes, or data loss. */ declare function setFlagsFromString(flags: string): void; /** * Generates a heap snapshot when the heap usage reaches the specified limit. * @param limit The heap size limit that triggers snapshot generation */ declare function setHeapSnapshotNearHeapLimit(limit: number): void; /** * Searches for objects that match the given constructor on their prototype chain. * Similar to Chrome DevTools' queryObjects() console API. * @since v20.13.0 * @experimental */ declare function queryObjects( ctor: Function, options?: {format: 'count'}, ): number; declare function queryObjects( ctor: Function, options: {format: 'summary'}, ): Array; /** * Returns C++ heap statistics from the cppgc heap. * @since v22.15.0 * @param detailLevel Level of detail: 'brief' for top-level stats, 'detailed' for space/page breakdown */ declare function getCppHeapStatistics( detailLevel?: 'brief' | 'detailed', ): Object; /** * Checks if a string's internal representation uses one byte per character (Latin-1/ISO-8859-1 encoding). * Useful for optimizing string serialization. * @since v23.10.0, v22.15.0 */ declare function isStringOneByteRepresentation(content: string): boolean; /** * Starts capturing V8 type profile for coverage analysis. */ declare function takeCoverage(): void; /** * Stops capturing V8 type profile for coverage analysis. */ declare function stopCoverage(): void; declare class Serializer { constructor(): void; /** * Writes out a header, which includes the serialization format version. */ writeHeader(): void; /** * Serializes a JavaScript value and adds the serialized representation to the internal buffer. * This throws an error if value cannot be serialized. */ writeValue(val: any): boolean; /** * Returns the stored internal buffer. * This serializer should not be used once the buffer is released. * Calling this method results in undefined behavior if a previous write has failed. */ releaseBuffer(): Buffer; /** * Marks an ArrayBuffer as having its contents transferred out of band.\ * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer(). */ transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; /** * Write a raw 32-bit unsigned integer. */ writeUint32(value: number): void; /** * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. */ writeUint64(hi: number, lo: number): void; /** * Write a JS number value. */ writeDouble(value: number): void; /** * Write raw bytes into the serializer’s internal buffer. * The deserializer will require a way to compute the length of the buffer. */ writeRawBytes(buffer: Buffer | $TypedArray | DataView): void; } /** * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, * and only stores the part of their underlying `ArrayBuffers` that they are referring to. */ declare class DefaultSerializer extends Serializer {} declare class Deserializer { constructor(data: Buffer | $TypedArray | DataView): void; /** * Reads and validates a header (including the format version). * May, for example, reject an invalid or unsupported wire format. * In that case, an Error is thrown. */ readHeader(): boolean; /** * Deserializes a JavaScript value from the buffer and returns it. */ readValue(): any; /** * Marks an ArrayBuffer as having its contents transferred out of band. * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer() * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers). */ transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; /** * Reads the underlying wire format version. * Likely mostly to be useful to legacy code reading old wire format versions. * May not be called before .readHeader(). */ getWireFormatVersion(): number; /** * Read a raw 32-bit unsigned integer and return it. */ readUint32(): number; /** * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries. */ readUint64(): [number, number]; /** * Read a JS number value. */ readDouble(): number; /** * Read raw bytes from the deserializer’s internal buffer. * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes(). */ readRawBytes(length: number): Buffer; } /** * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects, * and only stores the part of their underlying `ArrayBuffers` that they are referring to. */ declare class DefaultDeserializer extends Deserializer {} /** * Uses a `DefaultSerializer` to serialize value into a buffer. */ declare function serialize(value: any): Buffer; /** * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer. */ declare function deserialize(data: Buffer | $TypedArray | DataView): any; /** * Starts a GC profiling session that collects detailed garbage collection statistics. */ declare class GCProfiler { constructor(): void; /** * Starts the GC profiling session. */ start(): void; /** * Stops the GC profiling session and returns collected statistics. */ stop(): GCProfilerResult; } } type repl$DefineCommandOptions = (...args: Array) => void | { action: (...args: Array) => void, help?: string, ... }; declare class $SymbolReplModeMagic mixins Symbol {} declare class $SymbolReplModeSloppy mixins Symbol {} declare class $SymbolReplModeStrict mixins Symbol {} declare module 'repl' { declare var REPL_MODE_MAGIC: $SymbolReplModeMagic; declare var REPL_MODE_SLOPPY: $SymbolReplModeSloppy; declare var REPL_MODE_STRICT: $SymbolReplModeStrict; declare class REPLServer extends readline$Interface { context: vm$Context; defineCommand(command: string, options: repl$DefineCommandOptions): void; displayPrompt(preserveCursor?: boolean): void; } declare function start(prompt: string): REPLServer; declare function start(options: { prompt?: string, input?: stream$Readable, output?: stream$Writable, terminal?: boolean, eval?: Function, useColors?: boolean, useGlobal?: boolean, ignoreUndefined?: boolean, writer?: (object: any, options?: util$InspectOptions) => string, completer?: readline$InterfaceCompleter, replMode?: | $SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict, breakEvalOnSigint?: boolean, ... }): REPLServer; declare class Recoverable extends SyntaxError { constructor(err: Error): void; } } declare module 'inspector' { declare function open(port?: number, host?: string, wait?: boolean): void; declare function close(): void; declare function url(): string | void; declare var console: Object; declare function waitForDebugger(): void; declare class Session extends events$EventEmitter { constructor(): void; connect(): void; connectToMainThread(): void; disconnect(): void; post(method: string, params?: Object, callback?: Function): void; } } /* globals: https://nodejs.org/api/globals.html */ type process$CPUUsage = { user: number, system: number, ... }; declare class Process extends events$EventEmitter { abort(): void; allowedNodeEnvironmentFlags: Set; arch: string; argv: Array; chdir(directory: string): void; config: Object; connected: boolean; cpuUsage(previousValue?: process$CPUUsage): process$CPUUsage; cwd(): string; disconnect?: () => void; domain?: domain$Domain; env: {[key: string]: string | void, ...}; emitWarning(warning: string | Error): void; emitWarning( warning: string, typeOrCtor: string | ((...empty) => unknown), ): void; emitWarning( warning: string, type: string, codeOrCtor: string | ((...empty) => unknown), ): void; emitWarning( warning: string, type: string, code: string, ctor?: (...empty) => unknown, ): void; execArgv: Array; execPath: string; exit(code?: number): empty; exitCode?: number; getegid?: () => number; geteuid?: () => number; getgid?: () => number; getgroups?: () => Array; getuid?: () => number; hrtime: { (time?: [number, number]): [number, number], bigint: () => bigint, ... }; initgroups?: (user: number | string, extra_group: number | string) => void; kill(pid: number, signal?: string | number): void; mainModule: Object; memoryUsage: { (): { arrayBuffers: number, rss: number, heapTotal: number, heapUsed: number, external: number, ... }, rss: () => number, }; nextTick: (cb: (...T) => unknown, ...T) => void; pid: number; platform: string; release: { name: string, lts?: string, sourceUrl: string, headersUrl: string, libUrl: string, ... }; send?: ( message: any, sendHandleOrCallback?: net$Socket | net$Server | Function, callback?: Function, ) => void; setegid?: (id: number | string) => void; seteuid?: (id: number | string) => void; setgid?: (id: number | string) => void; setgroups?: (groups: Array) => void; setuid?: (id: number | string) => void; stderr: stream$Writable | tty$WriteStream; stdin: stream$Readable | tty$ReadStream; stdout: stream$Writable | tty$WriteStream; title: string; umask(mask?: number): number; uptime(): number; version: string; versions: { [key: string]: ?string, node: string, v8: string, ... }; } declare var process: Process; declare var __filename: string; declare var __dirname: string; declare function setImmediate( callback: (...args: Array) => unknown, ...args: Array ): Object; declare function clearImmediate(immediateObject: any): Object; declare module 'worker_threads' { declare var isMainThread: boolean; declare var parentPort: null | MessagePort; declare var threadId: number; declare var workerData: any; declare class MessageChannel { +port1: MessagePort; +port2: MessagePort; } declare class MessagePort extends events$EventEmitter { close(): void; postMessage( value: any, transferList?: Array, ): void; ref(): void; unref(): void; start(): void; addListener(event: 'close', listener: () => void): this; addListener(event: 'message', listener: (value: any) => void): this; addListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; emit(event: 'close'): boolean; emit(event: 'message', value: any): boolean; emit(event: string | Symbol, ...args: any[]): boolean; on(event: 'close', listener: () => void): this; on(event: 'message', listener: (value: any) => void): this; on(event: string | Symbol, listener: (...args: any[]) => void): this; once(event: 'close', listener: () => void): this; once(event: 'message', listener: (value: any) => void): this; once(event: string | Symbol, listener: (...args: any[]) => void): this; prependListener(event: 'close', listener: () => void): this; prependListener(event: 'message', listener: (value: any) => void): this; prependListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; prependOnceListener(event: 'close', listener: () => void): this; prependOnceListener(event: 'message', listener: (value: any) => void): this; prependOnceListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; removeListener(event: 'close', listener: () => void): this; removeListener(event: 'message', listener: (value: any) => void): this; removeListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; off(event: 'close', listener: () => void): this; off(event: 'message', listener: (value: any) => void): this; off(event: string | Symbol, listener: (...args: any[]) => void): this; } declare type WorkerOptions = {| env?: Object, eval?: boolean, workerData?: any, stdin?: boolean, stdout?: boolean, stderr?: boolean, execArgv?: string[], |}; declare class Worker extends events$EventEmitter { +stdin: stream$Writable | null; +stdout: stream$Readable; +stderr: stream$Readable; +threadId: number; constructor(filename: string, options?: WorkerOptions): void; postMessage( value: any, transferList?: Array, ): void; ref(): void; unref(): void; terminate(callback?: (err: Error, exitCode: number) => void): void; /** * Transfer a `MessagePort` to a different `vm` Context. The original `port` * object will be rendered unusable, and the returned `MessagePort` instance will * take its place. * * The returned `MessagePort` will be an object in the target context, and will * inherit from its global `Object` class. Objects passed to the * `port.onmessage()` listener will also be created in the target context * and inherit from its global `Object` class. * * However, the created `MessagePort` will no longer inherit from * `EventEmitter`, and only `port.onmessage()` can be used to receive * events using it. */ moveMessagePortToContext( port: MessagePort, context: vm$Context, ): MessagePort; addListener(event: 'error', listener: (err: Error) => void): this; addListener(event: 'exit', listener: (exitCode: number) => void): this; addListener(event: 'message', listener: (value: any) => void): this; addListener(event: 'online', listener: () => void): this; addListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; emit(event: 'error', err: Error): boolean; emit(event: 'exit', exitCode: number): boolean; emit(event: 'message', value: any): boolean; emit(event: 'online'): boolean; emit(event: string | Symbol, ...args: any[]): boolean; on(event: 'error', listener: (err: Error) => void): this; on(event: 'exit', listener: (exitCode: number) => void): this; on(event: 'message', listener: (value: any) => void): this; on(event: 'online', listener: () => void): this; on(event: string | Symbol, listener: (...args: any[]) => void): this; once(event: 'error', listener: (err: Error) => void): this; once(event: 'exit', listener: (exitCode: number) => void): this; once(event: 'message', listener: (value: any) => void): this; once(event: 'online', listener: () => void): this; once(event: string | Symbol, listener: (...args: any[]) => void): this; prependListener(event: 'error', listener: (err: Error) => void): this; prependListener(event: 'exit', listener: (exitCode: number) => void): this; prependListener(event: 'message', listener: (value: any) => void): this; prependListener(event: 'online', listener: () => void): this; prependListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; prependOnceListener(event: 'error', listener: (err: Error) => void): this; prependOnceListener( event: 'exit', listener: (exitCode: number) => void, ): this; prependOnceListener(event: 'message', listener: (value: any) => void): this; prependOnceListener(event: 'online', listener: () => void): this; prependOnceListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; removeListener(event: 'error', listener: (err: Error) => void): this; removeListener(event: 'exit', listener: (exitCode: number) => void): this; removeListener(event: 'message', listener: (value: any) => void): this; removeListener(event: 'online', listener: () => void): this; removeListener( event: string | Symbol, listener: (...args: any[]) => void, ): this; off(event: 'error', listener: (err: Error) => void): this; off(event: 'exit', listener: (exitCode: number) => void): this; off(event: 'message', listener: (value: any) => void): this; off(event: 'online', listener: () => void): this; off(event: string | Symbol, listener: (...args: any[]) => void): this; } } // https://nodejs.org/api/esm.html#node-imports declare module 'node:assert' { export type * from 'assert'; declare module.exports: $Exports<'assert'>; } declare module 'node:assert/strict' { export type * from 'assert/strict'; declare module.exports: $Exports<'assert'>['strict']; } declare module 'node:child_process' { export type * from 'child_process'; declare module.exports: $Exports<'child_process'>; } declare module 'node:cluster' { export type * from 'cluster'; declare module.exports: $Exports<'cluster'>; } declare module 'node:crypto' { export type * from 'crypto'; declare module.exports: $Exports<'crypto'>; } declare module 'node:dns' { export type * from 'dns'; declare module.exports: $Exports<'dns'>; } declare module 'node:events' { export type * from 'events'; declare module.exports: $Exports<'events'>; } declare module 'node:fs' { export type * from 'fs'; declare module.exports: $Exports<'fs'>; } declare module 'node:fs/promises' { export type * from 'fs/promises'; declare module.exports: $Exports<'fs'>['promises']; } declare module 'node:os' { export type * from 'os'; declare module.exports: $Exports<'os'>; } declare module 'node:path' { export type * from 'path'; declare module.exports: $Exports<'path'>; } declare module 'node:perf_hooks' { export type * from 'perf_hooks'; declare module.exports: $Exports<'perf_hooks'>; } declare module 'node:process' { export type * from 'process'; declare module.exports: $Exports<'process'>; } declare module 'node:timers' { export type * from 'timers'; declare module.exports: $Exports<'timers'>; } declare module 'node:timers/promises' { export type * from 'timers/promises'; declare module.exports: $Exports<'timers/promises'>; } declare module 'node:url' { declare module.exports: $Exports<'url'>; } declare module 'node:util' { export type * from 'util'; declare module.exports: $Exports<'util'>; } declare module 'node:v8' { export type * from 'v8'; declare module.exports: $Exports<'v8'>; } declare module 'node:worker_threads' { export type * from 'worker_threads'; declare module.exports: $Exports<'worker_threads'>; }