@types/node
Advanced tools
+210
| declare module "node:vfs" { | ||
| /** | ||
| * Convenience factory equivalent to `new VirtualFileSystem(provider, options)`. | ||
| * | ||
| * ```js | ||
| * const vfs = require('node:vfs'); | ||
| * | ||
| * // Default in-memory provider | ||
| * const memoryVfs = vfs.create(); | ||
| * | ||
| * // Explicit provider | ||
| * const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox')); | ||
| * ``` | ||
| * @since v26.4.0 | ||
| * @param provider The provider to use. **Default:** `new MemoryProvider()`. | ||
| */ | ||
| function create(provider?: VirtualProvider, options?: VirtualFileSystemOptions): VirtualFileSystem; | ||
| function create(options: VirtualFileSystemOptions): VirtualFileSystem; | ||
| interface VirtualFileSystemOptions { | ||
| /** | ||
| * Whether to emit the experimental warning. **Default:** `true`. | ||
| */ | ||
| emitExperimentalWarning?: boolean | undefined; | ||
| } | ||
| /** | ||
| * A `VirtualFileSystem` wraps a {@link VirtualProvider} and exposes a | ||
| * `node:fs`-like API. Each instance maintains its own file tree. | ||
| * @since v26.4.0 | ||
| */ | ||
| class VirtualFileSystem { | ||
| /** | ||
| * @param provider The provider to use. **Default:** `new MemoryProvider()`. | ||
| */ | ||
| constructor(provider?: VirtualProvider, options?: VirtualFileSystemOptions); | ||
| constructor(options: VirtualFileSystemOptions); | ||
| /** | ||
| * The provider backing this VFS instance. | ||
| * @since v26.4.0 | ||
| */ | ||
| readonly provider: VirtualProvider; | ||
| /** | ||
| * `true` when the underlying provider is read-only. | ||
| * @since v26.4.0 | ||
| */ | ||
| readonly readonly: boolean; | ||
| } | ||
| interface VirtualFileSystem extends | ||
| // Synchronous API | ||
| Pick< | ||
| typeof import("node:fs"), | ||
| | "existsSync" | ||
| | "statSync" | ||
| | "lstatSync" | ||
| | "readFileSync" | ||
| | "writeFileSync" | ||
| | "appendFileSync" | ||
| | "readdirSync" | ||
| | "mkdirSync" | ||
| | "rmdirSync" | ||
| | "unlinkSync" | ||
| | "renameSync" | ||
| | "copyFileSync" | ||
| | "realpathSync" | ||
| | "readlinkSync" | ||
| | "symlinkSync" | ||
| | "accessSync" | ||
| | "rmSync" | ||
| | "truncateSync" | ||
| | "ftruncateSync" | ||
| | "linkSync" | ||
| | "chmodSync" | ||
| | "chownSync" | ||
| | "utimesSync" | ||
| | "lutimesSync" | ||
| | "mkdtempSync" | ||
| | "opendirSync" | ||
| | "openAsBlob" | ||
| | "openSync" | ||
| | "closeSync" | ||
| | "readSync" | ||
| | "writeSync" | ||
| | "fstatSync" | ||
| | "createReadStream" | ||
| | "createWriteStream" | ||
| | "watch" | ||
| | "watchFile" | ||
| | "unwatchFile" | ||
| >, | ||
| // Callback API | ||
| Pick< | ||
| typeof import("node:fs"), | ||
| | "readFile" | ||
| | "writeFile" | ||
| | "stat" | ||
| | "lstat" | ||
| | "readdir" | ||
| | "realpath" | ||
| | "readlink" | ||
| | "access" | ||
| | "open" | ||
| | "close" | ||
| | "read" | ||
| | "write" | ||
| | "rm" | ||
| | "fstat" | ||
| | "truncate" | ||
| | "ftruncate" | ||
| | "link" | ||
| | "mkdtemp" | ||
| | "opendir" | ||
| > | ||
| { | ||
| // Promise API | ||
| readonly promises: Pick< | ||
| typeof import("node:fs/promises"), | ||
| | "readFile" | ||
| | "writeFile" | ||
| | "appendFile" | ||
| | "stat" | ||
| | "lstat" | ||
| | "readdir" | ||
| | "mkdir" | ||
| | "rmdir" | ||
| | "unlink" | ||
| | "rename" | ||
| | "copyFile" | ||
| | "realpath" | ||
| | "readlink" | ||
| | "symlink" | ||
| | "access" | ||
| | "rm" | ||
| | "truncate" | ||
| | "link" | ||
| | "mkdtemp" | ||
| | "chmod" | ||
| | "chown" | ||
| | "lchown" | ||
| | "utimes" | ||
| | "lutimes" | ||
| | "open" | ||
| | "lchmod" | ||
| | "watch" | ||
| >; | ||
| } | ||
| /** | ||
| * The base class for all VFS providers. Subclasses implement the essential | ||
| * primitives (such as `open`, `stat`, `readdir`, `mkdir`, `rmdir`, `unlink`, | ||
| * `rename`, etc.) and inherit default implementations of the derived | ||
| * methods (such as `readFile`, `writeFile`, `exists`, `copyFile`, `access`, etc.). | ||
| * @since v26.4.0 | ||
| */ | ||
| abstract class VirtualProvider { | ||
| get readonly(): boolean; | ||
| get supportsSymlinks(): boolean; | ||
| get supportsWatch(): boolean; | ||
| } | ||
| /** | ||
| * The default in-memory provider. Stores files, directories, and symbolic | ||
| * links in a `Map`-backed tree, supports symlinks (`supportsSymlinks === | ||
| * true`), and supports watching (`supportsWatch === true`). | ||
| * @since v26.4.0 | ||
| */ | ||
| class MemoryProvider extends VirtualProvider { | ||
| /** | ||
| * Locks the provider into read-only mode. Subsequent writes through any | ||
| * `VirtualFileSystem` using this provider throw `EROFS`. There is no | ||
| * way to revert the provider to writable. | ||
| * | ||
| * ```js | ||
| * const vfs = require('node:vfs'); | ||
| * | ||
| * const provider = new vfs.MemoryProvider(); | ||
| * const myVfs = vfs.create(provider); | ||
| * myVfs.writeFileSync('/seed.txt', 'initial'); | ||
| * | ||
| * provider.setReadOnly(); | ||
| * | ||
| * myVfs.writeFileSync('/x.txt', 'fail'); // throws EROFS | ||
| * ``` | ||
| * @since v26.4.0 | ||
| */ | ||
| setReadOnly(): void; | ||
| } | ||
| /** | ||
| * A provider that wraps a directory (i.e. one on the actual file system) and exposes its | ||
| * contents through the VFS API. All VFS paths are resolved relative to | ||
| * the root and verified to stay inside it; symbolic links resolving | ||
| * outside the root are rejected. | ||
| * @since v26.4.0 | ||
| */ | ||
| class RealFSProvider extends VirtualProvider { | ||
| /** | ||
| * ```js | ||
| * const vfs = require('node:vfs'); | ||
| * | ||
| * const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox')); | ||
| * realVfs.writeFileSync('/file.txt', 'hello'); // writes /tmp/sandbox/file.txt | ||
| * ``` | ||
| * @since v26.4.0 | ||
| * @param rootPath The absolute file-system path to use as the root. | ||
| * Must be a non-empty string. | ||
| */ | ||
| constructor(rootPath: string); | ||
| /** | ||
| * The resolved absolute path used as the root. | ||
| * @since v26.4.0 | ||
| */ | ||
| readonly rootPath: string; | ||
| } | ||
| } |
@@ -466,2 +466,7 @@ declare module "node:buffer" { | ||
| } | ||
| /** | ||
| * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports | ||
| * TypeScript versions earlier than 5.7. | ||
| */ | ||
| type BufferView<T extends NodeJS.ArrayBufferView> = T extends NodeJS.ArrayBufferView<infer B> ? Buffer<B> : never; | ||
| } |
+119
-4
@@ -18,2 +18,6 @@ declare module "node:dgram" { | ||
| } | ||
| interface BindSyncOptions { | ||
| port?: number | undefined; | ||
| address?: string | undefined; | ||
| } | ||
| type SocketType = "udp4" | "udp6"; | ||
@@ -121,6 +125,8 @@ interface SocketOptions extends Abortable { | ||
| * random port. If `address` is not specified, the operating system will | ||
| * attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is | ||
| * attempt to listen on all addresses. Once binding is complete, a | ||
| * `'listening'` event is emitted and the optional `callback` function is | ||
| * called. | ||
| * | ||
| * Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very | ||
| * Specifying both a `'listening'` event listener and passing a | ||
| * `callback` to the `socket.bind()` method is not harmful but not very | ||
| * useful. | ||
@@ -162,6 +168,79 @@ * | ||
| bind(port?: number, address?: string, callback?: () => void): this; | ||
| bind(port?: number, callback?: () => void): this; | ||
| bind(callback?: () => void): this; | ||
| bind(port: number, callback: () => void): this; | ||
| bind(callback: () => void): this; | ||
| /** | ||
| * For UDP sockets, causes the `dgram.Socket` to listen for datagram | ||
| * messages on a named `port` and optional `address` that are passed as | ||
| * properties of an `options` object passed as the first argument. If | ||
| * `port` is not specified or is `0`, the operating system will attempt | ||
| * to bind to a random port. If `address` is not specified, the operating | ||
| * system will attempt to listen on all addresses. Once binding is | ||
| * complete, a `'listening'` event is emitted and the optional `callback` | ||
| * function is called. | ||
| * | ||
| * The `options` object may contain a `fd` property. When a `fd` greater | ||
| * than `0` is set, it will wrap around an existing socket with the given | ||
| * file descriptor. In this case, the properties of `port` and `address` | ||
| * will be ignored. | ||
| * | ||
| * Specifying both a `'listening'` event listener and passing a | ||
| * `callback` to the `socket.bind()` method is not harmful but not very | ||
| * useful. | ||
| * | ||
| * The `options` object may contain an additional `exclusive` property that is | ||
| * used when using `dgram.Socket` objects with the [`cluster`](https://nodejs.org/docs/latest-v26.x/api/cluster.html) module. When | ||
| * `exclusive` is set to `false` (the default), cluster workers will use the same | ||
| * underlying socket handle allowing connection handling duties to be shared. | ||
| * When `exclusive` is `true`, however, the handle is not shared and attempted | ||
| * port sharing results in an error. Creating a `dgram.Socket` with the `reusePort` | ||
| * option set to `true` causes `exclusive` to always be `true` when `socket.bind()` | ||
| * is called. | ||
| * | ||
| * A bound datagram socket keeps the Node.js process running to receive | ||
| * datagram messages. | ||
| * | ||
| * If binding fails, an `'error'` event is generated. In rare case (e.g. | ||
| * attempting to bind with a closed socket), an `Error` may be thrown. | ||
| * | ||
| * An example socket listening on an exclusive port is shown below. | ||
| * | ||
| * ```js | ||
| * socket.bind({ | ||
| * address: 'localhost', | ||
| * port: 8000, | ||
| * exclusive: true, | ||
| * }); | ||
| * ``` | ||
| * @since v0.11.14 | ||
| * @param options Required. Supports the following properties: | ||
| */ | ||
| bind(options: BindOptions, callback?: () => void): this; | ||
| /** | ||
| * The synchronous counterpart of `socket.bind()`. `bind(2)` is a local, | ||
| * non-blocking system call, so the bind is performed inline and the resolved | ||
| * address is returned immediately, including the operating-system-assigned | ||
| * ephemeral port when `port` is `0`: | ||
| * | ||
| * ```js | ||
| * const dgram = require('node:dgram'); | ||
| * | ||
| * const socket = dgram.createSocket('udp4'); | ||
| * const address = socket.bindSync({ address: '0.0.0.0', port: 0 }); | ||
| * console.log(address); // e.g. { address: '0.0.0.0', family: 'IPv4', port: 53124 } | ||
| * ``` | ||
| * | ||
| * A bind failure such as `EADDRINUSE` is thrown synchronously rather than emitted | ||
| * as an `'error'` event. After `bindSync()` returns, `socket.address()` is | ||
| * valid synchronously and the `'listening'` event is emitted on the next tick. | ||
| * | ||
| * `address` must be a numeric IP literal; `bindSync()` never performs DNS | ||
| * resolution (asynchronous name resolution being the only genuinely blocking part | ||
| * of binding). Incoming datagrams continue to be delivered asynchronously via the | ||
| * `'message'` event. `bindSync()` always binds the socket's own handle and | ||
| * does not participate in [`cluster`](https://nodejs.org/docs/latest-v26.x/api/cluster.html) handle sharing. | ||
| * @since v26.4.0 | ||
| * @returns The bound address as returned by `socket.address()`. | ||
| */ | ||
| bindSync(options?: BindSyncOptions): AddressInfo; | ||
| /** | ||
| * Close the underlying socket and stop listening for data on it. If a callback is | ||
@@ -189,2 +268,38 @@ * provided, it is added as a listener for the `'close'` event. | ||
| /** | ||
| * The synchronous counterpart of `socket.connect()`. For a UDP socket | ||
| * `connect(2)` only records the default peer address and is a local, non-blocking | ||
| * system call, so the association is performed inline. Any error raised by the | ||
| * call itself (for example `EAFNOSUPPORT` for a mismatched address family) is | ||
| * thrown synchronously rather than reported via the `'error'` event. Because | ||
| * `connect(2)` does not probe reachability, errors such as `ECONNREFUSED` are | ||
| * still surfaced asynchronously on a later send or receive, exactly as for | ||
| * `socket.connect()`: | ||
| * | ||
| * ```js | ||
| * const dgram = require('node:dgram'); | ||
| * | ||
| * const socket = dgram.createSocket('udp4'); | ||
| * socket.connectSync(41234, '127.0.0.1'); | ||
| * console.log(socket.remoteAddress()); // { address: '127.0.0.1', family: 'IPv4', port: 41234 } | ||
| * ``` | ||
| * | ||
| * If the socket is still unbound it is bound synchronously first. After | ||
| * `connectSync()` returns, `socket.remoteAddress()` is valid synchronously | ||
| * and the `'connect'` event is emitted on the next tick. Trying to call | ||
| * `connectSync()` on an already connected socket throws an | ||
| * `ERR_SOCKET_DGRAM_IS_CONNECTED` exception, and calling it while an | ||
| * asynchronous [`socket.bind()`][] is still in progress throws an | ||
| * `ERR_SOCKET_ALREADY_BOUND` exception. | ||
| * | ||
| * `address` must be a numeric IP literal; `connectSync()` never performs DNS | ||
| * resolution (asynchronous name resolution being the only genuinely blocking part | ||
| * of connecting). | ||
| * @since v26.4.0 | ||
| * @param address A numeric IP address to connect to. Unlike | ||
| * `socket.connect()`, no DNS resolution is performed, so a host name is not | ||
| * accepted. If omitted, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for | ||
| * `udp6` sockets) is used. | ||
| */ | ||
| connectSync(port: number, address?: string): void; | ||
| /** | ||
| * A synchronous function that disassociates a connected `dgram.Socket` from | ||
@@ -191,0 +306,0 @@ * its remote address. Trying to call `disconnect()` on an unbound or already |
+61
-65
| declare module "node:fs/promises" { | ||
| import { NonSharedBuffer } from "node:buffer"; | ||
| import { BufferView, NonSharedBuffer } from "node:buffer"; | ||
| import { Abortable } from "node:events"; | ||
@@ -23,2 +23,6 @@ import { Interface as ReadlineInterface } from "node:readline"; | ||
| PathLike, | ||
| ReadFileOptions, | ||
| ReadFileOptionsWithBuffer, | ||
| ReadFileOptionsWithBufferEncoding, | ||
| ReadFileOptionsWithStringEncoding, | ||
| ReadOptions, | ||
@@ -40,3 +44,2 @@ ReadOptionsWithBuffer, | ||
| } from "node:fs"; | ||
| import { Stream } from "node:stream"; | ||
| import { ByteReadableStream, Transform, Writer } from "node:stream/iter"; | ||
@@ -362,36 +365,58 @@ import { ReadableStream } from "node:stream/web"; | ||
| * | ||
| * If `buffer` is provided and no encoding is specified, the returned {Buffer} is | ||
| * a view over the supplied buffer containing only the bytes read. If the | ||
| * supplied buffer is too small to contain the entire file, the operation will | ||
| * fail. | ||
| * | ||
| * The `FileHandle` has to support reading. | ||
| * | ||
| * If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current | ||
| * If one or more `filehandle.read()` calls are made on a file handle and then a | ||
| * `filehandle.readFile()` call is made, the data will be read from the current | ||
| * position till the end of the file. It doesn't always read from the beginning | ||
| * of the file. | ||
| * | ||
| * An example using the `buffer` option with a pre-allocated buffer: | ||
| * | ||
| * ```js | ||
| * import { Buffer } from 'node:buffer'; | ||
| * import { open } from 'node:fs/promises'; | ||
| * | ||
| * const file = await open('./some/file/to/read'); | ||
| * try { | ||
| * const buf = Buffer.alloc(16384); | ||
| * const contents = await file.readFile({ buffer: buf }); | ||
| * console.log(contents); // A view over `buf` containing only the bytes read | ||
| * } finally { | ||
| * await file.close(); | ||
| * } | ||
| * ``` | ||
| * | ||
| * An example using the `buffer` option with a function returning a buffer: | ||
| * | ||
| * ```js | ||
| * import { Buffer } from 'node:buffer'; | ||
| * import { open } from 'node:fs/promises'; | ||
| * | ||
| * const file = await open('./some/file/to/read'); | ||
| * try { | ||
| * const contents = await file.readFile({ | ||
| * buffer: (size) => Buffer.alloc(size), | ||
| * }); | ||
| * console.log(contents); | ||
| * } finally { | ||
| * await file.close(); | ||
| * } | ||
| * ``` | ||
| * @since v10.0.0 | ||
| * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the | ||
| * data will be a string. | ||
| * @returns Fulfills upon a successful read with the contents of the | ||
| * file. If no encoding is specified (using `options.encoding`), the data is | ||
| * returned as a `Buffer` object. Otherwise, the data will be a string. | ||
| */ | ||
| readFile( | ||
| options?: | ||
| | ({ encoding?: null | undefined } & Abortable) | ||
| | null, | ||
| ): Promise<NonSharedBuffer>; | ||
| readFile<T extends NodeJS.ArrayBufferView>( | ||
| options: Omit<ReadFileOptionsWithBuffer<T>, "flag">, | ||
| ): Promise<BufferView<T>>; | ||
| readFile(options?: Omit<ReadFileOptionsWithBufferEncoding, "flag"> | null): Promise<NonSharedBuffer>; | ||
| readFile(options: Omit<ReadFileOptionsWithStringEncoding, "flag"> | BufferEncoding): Promise<string>; | ||
| readFile(options: Omit<ReadFileOptions, "flag"> | BufferEncoding | null): Promise<string | NonSharedBuffer>; | ||
| /** | ||
| * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. | ||
| * The `FileHandle` must have been opened for reading. | ||
| */ | ||
| readFile( | ||
| options: | ||
| | ({ encoding: BufferEncoding } & Abortable) | ||
| | BufferEncoding, | ||
| ): Promise<string>; | ||
| /** | ||
| * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. | ||
| * The `FileHandle` must have been opened for reading. | ||
| */ | ||
| readFile( | ||
| options?: | ||
| | (ObjectEncodingOptions & Abortable) | ||
| | BufferEncoding | ||
| | null, | ||
| ): Promise<string | NonSharedBuffer>; | ||
| /** | ||
| * Convenience method to create a `readline` interface and stream over the file. | ||
@@ -1316,46 +1341,17 @@ * See `filehandle.createReadStream()` for the options. | ||
| */ | ||
| function readFile<T extends NodeJS.ArrayBufferView>( | ||
| path: PathLike | FileHandle, | ||
| options: ReadFileOptionsWithBuffer<T>, | ||
| ): Promise<BufferView<T>>; | ||
| function readFile( | ||
| path: PathLike | FileHandle, | ||
| options?: | ||
| | ({ | ||
| encoding?: null | undefined; | ||
| flag?: OpenMode | undefined; | ||
| } & Abortable) | ||
| | null, | ||
| options?: ReadFileOptionsWithBufferEncoding | null, | ||
| ): Promise<NonSharedBuffer>; | ||
| /** | ||
| * Asynchronously reads the entire contents of a file. | ||
| * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
| * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. | ||
| * @param options An object that may contain an optional flag. | ||
| * If a flag is not provided, it defaults to `'r'`. | ||
| */ | ||
| function readFile( | ||
| path: PathLike | FileHandle, | ||
| options: | ||
| | ({ | ||
| encoding: BufferEncoding; | ||
| flag?: OpenMode | undefined; | ||
| } & Abortable) | ||
| | BufferEncoding, | ||
| options: ReadFileOptionsWithStringEncoding | BufferEncoding, | ||
| ): Promise<string>; | ||
| /** | ||
| * Asynchronously reads the entire contents of a file. | ||
| * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
| * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. | ||
| * @param options An object that may contain an optional flag. | ||
| * If a flag is not provided, it defaults to `'r'`. | ||
| */ | ||
| function readFile( | ||
| path: PathLike | FileHandle, | ||
| options?: | ||
| | ( | ||
| & ObjectEncodingOptions | ||
| & Abortable | ||
| & { | ||
| flag?: OpenMode | undefined; | ||
| } | ||
| ) | ||
| | BufferEncoding | ||
| | null, | ||
| options: ReadFileOptions | BufferEncoding | null, | ||
| ): Promise<string | NonSharedBuffer>; | ||
@@ -1362,0 +1358,0 @@ /** |
+1
-0
@@ -111,2 +111,3 @@ /** | ||
| /// <reference path="v8.d.ts" /> | ||
| /// <reference path="vfs.d.ts" /> | ||
| /// <reference path="vm.d.ts" /> | ||
@@ -113,0 +114,0 @@ /// <reference path="wasi.d.ts" /> |
@@ -46,3 +46,4 @@ declare module "node:inspector" { | ||
| /** | ||
| * Deactivate the inspector. Blocks until there are no active connections. | ||
| * Deactivates the inspector. If there are active connections, they are forcibly | ||
| * terminated. Blocks until the inspector server has fully stopped. | ||
| */ | ||
@@ -49,0 +50,0 @@ function close(): void; |
+108
-16
@@ -28,2 +28,3 @@ declare module "node:net" { | ||
| typeOfService?: number | undefined; | ||
| handle?: BoundSocket | undefined; | ||
| } | ||
@@ -61,2 +62,8 @@ interface OnReadOpts { | ||
| type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; | ||
| interface SetKeepAliveOptions { | ||
| enable?: boolean | undefined; | ||
| initialDelay?: number | undefined; | ||
| interval?: number | undefined; | ||
| count?: number | undefined; | ||
| } | ||
| interface SocketEventMap extends Omit<stream.DuplexEventMap, "close"> { | ||
@@ -204,21 +211,23 @@ "close": [hadError: boolean]; | ||
| /** | ||
| * Enable/disable keep-alive functionality, and optionally set the initial | ||
| * delay before the first keepalive probe is sent on an idle socket. | ||
| * Configure keep-alive using an options object. See `socket.setKeepAlive()` | ||
| * for a description of each property. | ||
| * | ||
| * Set `initialDelay` (in milliseconds) to set the delay between the last | ||
| * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default | ||
| * (or previous) setting. | ||
| * | ||
| * Enabling the keep-alive functionality will set the following socket options: | ||
| * | ||
| * * `SO_KEEPALIVE=1` | ||
| * * `TCP_KEEPIDLE=initialDelay` | ||
| * * `TCP_KEEPCNT=10` | ||
| * * `TCP_KEEPINTVL=1` | ||
| * ```js | ||
| * socket.setKeepAlive({ enable: true, initialDelay: 1000, interval: 1000, count: 10 }); | ||
| * ``` | ||
| * @since v26.4.0 | ||
| * @returns The socket itself. | ||
| */ | ||
| setKeepAlive(options: SetKeepAliveOptions): this; | ||
| /** | ||
| * Configure keep-alive using positional arguments. See | ||
| * `socket.setKeepAlive()` for a description of each argument. | ||
| * @since v0.1.92 | ||
| * @param [enable=false] | ||
| * @param [initialDelay=0] | ||
| * @return The socket itself. | ||
| * @param enable **Default:** `false` | ||
| * @param initialDelay **Default:** `0` | ||
| * @param interval **Default:** `1000` | ||
| * @param count **Default:** `10` | ||
| * @returns The socket itself. | ||
| */ | ||
| setKeepAlive(enable?: boolean, initialDelay?: number): this; | ||
| setKeepAlive(enable?: boolean, initialDelay?: number, interval?: number, count?: number): this; | ||
| /** | ||
@@ -448,5 +457,88 @@ * Returns the current Type of Service (TOS) field for IPv4 packets or Traffic | ||
| } | ||
| interface BoundSocketOptions { | ||
| /** | ||
| * Local address to bind. Must be a numeric IP literal; no DNS | ||
| * resolution is performed. **Default:** `'0.0.0.0'`, or `'::'` when | ||
| * `ipv6Only` is `true`. | ||
| */ | ||
| host?: string | undefined; | ||
| /** | ||
| * Local port. `0` requests an OS-assigned ephemeral port. | ||
| * **Default:** `0`. | ||
| */ | ||
| port?: number | undefined; | ||
| /** | ||
| * Sets `IPV6_V6ONLY`, disabling dual-stack support so the | ||
| * socket binds IPv6 only. Only meaningful for IPv6 binds. **Default:** | ||
| * `false`. | ||
| */ | ||
| ipv6Only?: boolean | undefined; | ||
| /** | ||
| * Sets `SO_REUSEPORT`, allowing multiple sockets to bind | ||
| * the same address and port for kernel-level load balancing. Support is | ||
| * platform-dependent. **Default:** `false`. | ||
| */ | ||
| reusePort?: boolean | undefined; | ||
| } | ||
| /** | ||
| * Allows for the synchronous creation of a pre-bound socket, that can be passed | ||
| * to `listen()` or `new net.Socket()` later on. For `listen()` this enables | ||
| * synchronous port reservation, while for `new net.Socket()`, it allows control | ||
| * over the local egress port/IP, via `bind(2)` semantics. | ||
| * | ||
| * Adoption transfers ownership of the socket; afterwards `address()` and `close()` | ||
| * throw `ERR_SOCKET_HANDLE_ADOPTED`. A handle that is never adopted must be | ||
| * closed to avoid leaking the socket. | ||
| * | ||
| * ```js | ||
| * import net from 'node:net'; | ||
| * | ||
| * const bound = new net.BoundSocket(); | ||
| * const { port } = bound.address(); | ||
| * console.log(`Reserved port ${port} for server`); | ||
| * | ||
| * const server = net.createServer(); | ||
| * server.listen(bound); // Adopt as a server, or pass to new net.Socket() instead. | ||
| * ``` | ||
| * @since v26.4.0 | ||
| */ | ||
| class BoundSocket { | ||
| /** | ||
| * @since v26.4.0 | ||
| */ | ||
| constructor(options?: BoundSocketOptions); | ||
| /** | ||
| * Returns the bound local address. When bound with `port: 0`, `port` is the | ||
| * OS-assigned ephemeral port. | ||
| * @since v26.4.0 | ||
| * @returns An object with `address`, `family`, and `port` properties, | ||
| * as `server.address()` returns. | ||
| */ | ||
| address(): AddressInfo; | ||
| /** | ||
| * Returns the file descriptor of the bound socket. Ownership remains with the | ||
| * `BoundSocket`, so the descriptor must not be closed by the caller. The | ||
| * descriptor is only available before the handle is adopted; afterwards it belongs | ||
| * to the adopting `net.Server` or `net.Socket` and `fd()` throws | ||
| * `ERR_SOCKET_HANDLE_ADOPTED`. | ||
| * @since v26.4.0 | ||
| * @returns The underlying OS file descriptor, or `-1` on platforms | ||
| * that do not expose one for sockets (such as Windows). | ||
| */ | ||
| fd(): number; | ||
| /** | ||
| * Releases the bound socket. Only needed when the handle is never adopted. | ||
| * @since v26.4.0 | ||
| */ | ||
| close(): void; | ||
| /** | ||
| * Closes the handle if it has not been adopted or closed; otherwise a no-op. | ||
| * @since v26.4.0 | ||
| */ | ||
| [Symbol.dispose](): void; | ||
| } | ||
| interface ListenOptions extends Abortable { | ||
| backlog?: number | undefined; | ||
| exclusive?: boolean | undefined; | ||
| handle?: BoundSocket | undefined; | ||
| host?: string | undefined; | ||
@@ -453,0 +545,0 @@ /** |
| { | ||
| "name": "@types/node", | ||
| "version": "26.3.0", | ||
| "version": "26.4.0", | ||
| "description": "TypeScript definitions for node", | ||
@@ -153,4 +153,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "125032099e1f7132c95bf327b36f694c396de965952f7cb9632ac916bbad47e9", | ||
| "typesPublisherContentHash": "0793b8d36264e159c56982e4bc1d7024a8a703b13431ee414c7feacfe570e674", | ||
| "typeScriptVersion": "5.6" | ||
| } |
+1
-1
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Mon, 24 Aug 2026 19:40:21 GMT | ||
| * Last updated: Thu, 27 Aug 2026 00:14:49 GMT | ||
| * Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
@@ -274,4 +274,4 @@ declare module "node:stream/iter" { | ||
| * `stream.Readable` does), that protocol is used. Otherwise, the function | ||
| * duck-types on `read()` and `on()` (EventEmitter) and wraps the stream with | ||
| * a batched async iterator. | ||
| * duck-types on `read()`, `on()`, and `off()` (EventEmitter) and wraps the | ||
| * stream with a batched async iterator. | ||
| * | ||
@@ -298,3 +298,3 @@ * The result is cached per instance -- calling `fromReadable()` twice with the | ||
| * @param readable A classic Readable stream or any object | ||
| * with `read()` and `on()` methods. | ||
| * with `read()`, `on()` and `off()` methods. | ||
| * @returns A stream/iter async iterable source. | ||
@@ -394,3 +394,3 @@ */ | ||
| * first (`writeSync` / `writevSync`), falling back to the async method if the | ||
| * sync path returns `false` or throws. Similarly, `_final()` tries `endSync()` | ||
| * sync path returns `false`. Similarly, `_final()` tries `endSync()` | ||
| * before `end()`. When the sync path succeeds, the callback is deferred via | ||
@@ -397,0 +397,0 @@ * `queueMicrotask` to preserve the async resolution contract. |
+24
-0
@@ -749,2 +749,3 @@ declare module "node:tls" { | ||
| type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; | ||
| type CertificateCompressionAlgorithm = "zlib" | "brotli" | "zstd"; | ||
| interface SecureContextOptions { | ||
@@ -787,2 +788,11 @@ /** | ||
| /** | ||
| * An array of supported certificate | ||
| * compression algorithm names, in preference order. Supported values are | ||
| * `'zlib'`, `'brotli'`, and `'zstd'`. When set, enables TLS certificate | ||
| * compression ([RFC 8879](https://tools.ietf.org/html/rfc8879)) which compresses certificates during the TLS | ||
| * handshake, reducing handshake size. Only effective with TLSv1.3. | ||
| * **Default:** `[]` (disabled). | ||
| */ | ||
| certificateCompression?: readonly CertificateCompressionAlgorithm[] | undefined; | ||
| /** | ||
| * Colon-separated list of supported signature algorithms. The list | ||
@@ -1116,2 +1126,16 @@ * can contain digest algorithms (SHA256, MD5 etc.), public key | ||
| /** | ||
| * Returns an array with the names of the RFC 8879 certificate compression | ||
| * algorithms supported by the current OpenSSL build, suitable for use in the | ||
| * `certificateCompression` option of `tls.createSecureContext()`. Possible | ||
| * values include `'zlib'`, `'brotli'`, and `'zstd'`. | ||
| * | ||
| * The array is empty when certificate compression is unavailable. | ||
| * | ||
| * ```js | ||
| * console.log(tls.getCertificateCompressionAlgorithms()); // ['zlib', 'brotli', 'zstd'] | ||
| * ``` | ||
| * @since v26.4.0 | ||
| */ | ||
| function getCertificateCompressionAlgorithms(): CertificateCompressionAlgorithm[]; | ||
| /** | ||
| * Sets the default CA certificates used by Node.js TLS clients. If the provided | ||
@@ -1118,0 +1142,0 @@ * certificates are parsed successfully, they will become the default CA |
@@ -462,2 +462,7 @@ declare module "node:buffer" { | ||
| } | ||
| /** | ||
| * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports | ||
| * TypeScript versions earlier than 5.7. | ||
| */ | ||
| type BufferView<T extends NodeJS.ArrayBufferView> = Buffer; | ||
| } |
@@ -113,2 +113,3 @@ /** | ||
| /// <reference path="../v8.d.ts" /> | ||
| /// <reference path="../vfs.d.ts" /> | ||
| /// <reference path="../vm.d.ts" /> | ||
@@ -115,0 +116,0 @@ /// <reference path="../wasi.d.ts" /> |
@@ -113,2 +113,3 @@ /** | ||
| /// <reference path="../v8.d.ts" /> | ||
| /// <reference path="../vfs.d.ts" /> | ||
| /// <reference path="../vm.d.ts" /> | ||
@@ -115,0 +116,0 @@ /// <reference path="../wasi.d.ts" /> |
+4
-3
@@ -31,6 +31,7 @@ declare module "node:tty" { | ||
| * When in raw mode, input is always available character-by-character, not | ||
| * including modifiers. Additionally, all special processing of characters by the | ||
| * terminal is disabled, including echoing input | ||
| * including modifiers. Additionally, all special processing of input characters | ||
| * by the terminal is disabled, including echoing input | ||
| * characters. Ctrl+C will no longer cause a `SIGINT` when | ||
| * in this mode. | ||
| * in this mode. This mode does not affect terminal output processing, such as | ||
| * newline translation on Unix terminals. | ||
| * @since v0.7.7 | ||
@@ -37,0 +38,0 @@ * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` |
+1
-1
@@ -744,3 +744,3 @@ declare module "node:vm" { | ||
| /** | ||
| * Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of | ||
| * Evaluate the module and its dependencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of | ||
| * [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification. | ||
@@ -747,0 +747,0 @@ * |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Network access
Supply chain riskThis module accesses the network.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
2534880
0.78%92
1.1%56302
0.87%