@types/node
Advanced tools
+0
-5
@@ -1,6 +0,1 @@ | ||
| /** | ||
| * The `node:assert` module provides a set of assertion functions for verifying | ||
| * invariants. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert.js) | ||
| */ | ||
| declare module "node:assert" { | ||
@@ -7,0 +2,0 @@ import strict = require("node:assert/strict"); |
@@ -1,47 +0,1 @@ | ||
| /** | ||
| * In strict assertion mode, non-strict methods behave like their corresponding | ||
| * strict methods. For example, `assert.deepEqual()` will behave like | ||
| * `assert.deepStrictEqual()`. | ||
| * | ||
| * In strict assertion mode, error messages for objects display a diff. In legacy | ||
| * assertion mode, error messages for objects display the objects, often truncated. | ||
| * | ||
| * To use strict assertion mode: | ||
| * | ||
| * ```js | ||
| * import { strict as assert } from 'node:assert'; | ||
| * ``` | ||
| * | ||
| * ```js | ||
| * import assert from 'node:assert/strict'; | ||
| * ``` | ||
| * | ||
| * Example error diff: | ||
| * | ||
| * ```js | ||
| * import { strict as assert } from 'node:assert'; | ||
| * | ||
| * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]); | ||
| * // AssertionError: Expected inputs to be strictly deep-equal: | ||
| * // + actual - expected ... Lines skipped | ||
| * // | ||
| * // [ | ||
| * // [ | ||
| * // ... | ||
| * // 2, | ||
| * // + 3 | ||
| * // - '3' | ||
| * // ], | ||
| * // ... | ||
| * // 5 | ||
| * // ] | ||
| * ``` | ||
| * | ||
| * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` | ||
| * environment variables. This will also deactivate the colors in the REPL. For | ||
| * more on color support in terminal environments, read the tty | ||
| * [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation. | ||
| * @since v15.0.0 | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js) | ||
| */ | ||
| declare module "node:assert/strict" { | ||
@@ -48,0 +2,0 @@ import { |
+18
-38
@@ -1,17 +0,1 @@ | ||
| /** | ||
| * We strongly discourage the use of the `async_hooks` API. | ||
| * Other APIs that can cover most of its use cases include: | ||
| * | ||
| * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v25.x/api/async_context.html#class-asynclocalstorage) tracks async context | ||
| * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processgetactiveresourcesinfo) tracks active resources | ||
| * | ||
| * The `node:async_hooks` module provides an API to track asynchronous resources. | ||
| * It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import async_hooks from 'node:async_hooks'; | ||
| * ``` | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/async_hooks.js) | ||
| */ | ||
| declare module "node:async_hooks" { | ||
@@ -126,33 +110,27 @@ /** | ||
| /** | ||
| * Called when a class is constructed that has the possibility to emit an asynchronous event. | ||
| * @param asyncId A unique ID for the async resource | ||
| * @param type The type of the async resource | ||
| * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created | ||
| * @param resource Reference to the resource representing the async operation, needs to be released during destroy | ||
| * The [`init` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#initasyncid-type-triggerasyncid-resource). | ||
| */ | ||
| init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; | ||
| /** | ||
| * When an asynchronous operation is initiated or completes a callback is called to notify the user. | ||
| * The before callback is called just before said callback is executed. | ||
| * @param asyncId the unique identifier assigned to the resource about to execute the callback. | ||
| * The [`before` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#beforeasyncid). | ||
| */ | ||
| before?(asyncId: number): void; | ||
| /** | ||
| * Called immediately after the callback specified in `before` is completed. | ||
| * | ||
| * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs. | ||
| * @param asyncId the unique identifier assigned to the resource which has executed the callback. | ||
| * The [`after` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#afterasyncid). | ||
| */ | ||
| after?(asyncId: number): void; | ||
| /** | ||
| * Called when a promise has resolve() called. This may not be in the same execution id | ||
| * as the promise itself. | ||
| * @param asyncId the unique id for the promise that was resolve()d. | ||
| * The [`promiseResolve` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promiseresolveasyncid). | ||
| */ | ||
| promiseResolve?(asyncId: number): void; | ||
| /** | ||
| * Called after the resource corresponding to asyncId is destroyed | ||
| * @param asyncId a unique ID for the async resource | ||
| * The [`destroy` callback](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#destroyasyncid). | ||
| */ | ||
| destroy?(asyncId: number): void; | ||
| /** | ||
| * Whether the hook should track `Promise`s. Cannot be `false` if | ||
| * `promiseResolve` is set. | ||
| * @default true | ||
| */ | ||
| trackPromises?: boolean | undefined; | ||
| } | ||
@@ -178,3 +156,4 @@ interface AsyncHook { | ||
| * be tracked, then only the `destroy` callback needs to be passed. The | ||
| * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. | ||
| * specifics of all functions that can be passed to `callbacks` is in the | ||
| * [Hook Callbacks](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#hook-callbacks) section. | ||
| * | ||
@@ -207,8 +186,9 @@ * ```js | ||
| * Because promises are asynchronous resources whose lifecycle is tracked | ||
| * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. | ||
| * via the async hooks mechanism, the `init()`, `before()`, `after()`, and | ||
| * `destroy()` callbacks _must not_ be async functions that return promises. | ||
| * @since v8.1.0 | ||
| * @param callbacks The `Hook Callbacks` to register | ||
| * @return Instance used for disabling and enabling hooks | ||
| * @param options The [Hook Callbacks](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#hook-callbacks) to register | ||
| * @returns Instance used for disabling and enabling hooks | ||
| */ | ||
| function createHook(callbacks: HookCallbacks): AsyncHook; | ||
| function createHook(options: HookCallbacks): AsyncHook; | ||
| interface AsyncResourceOptions { | ||
@@ -215,0 +195,0 @@ /** |
@@ -177,3 +177,3 @@ declare module "node:buffer" { | ||
| * | ||
| * If `totalLength` is provided, it is coerced to an unsigned integer. If the | ||
| * If `totalLength` is provided, it must be an unsigned integer. If the | ||
| * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is | ||
@@ -180,0 +180,0 @@ * truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is |
@@ -1,68 +0,1 @@ | ||
| /** | ||
| * The `node:child_process` module provides the ability to spawn subprocesses in | ||
| * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability | ||
| * is primarily provided by the {@link spawn} function: | ||
| * | ||
| * ```js | ||
| * import { spawn } from 'node:child_process'; | ||
| * import { once } from 'node:events'; | ||
| * const ls = spawn('ls', ['-lh', '/usr']); | ||
| * | ||
| * ls.stdout.on('data', (data) => { | ||
| * console.log(`stdout: ${data}`); | ||
| * }); | ||
| * | ||
| * ls.stderr.on('data', (data) => { | ||
| * console.error(`stderr: ${data}`); | ||
| * }); | ||
| * | ||
| * const [code] = await once(ls, 'close'); | ||
| * console.log(`child process exited with code ${code}`); | ||
| * ``` | ||
| * | ||
| * By default, pipes for `stdin`, `stdout`, and `stderr` are established between | ||
| * the parent Node.js process and the spawned subprocess. These pipes have | ||
| * limited (and platform-specific) capacity. If the subprocess writes to | ||
| * stdout in excess of that limit without the output being captured, the | ||
| * subprocess blocks, waiting for the pipe buffer to accept more data. This is | ||
| * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed. | ||
| * | ||
| * The command lookup is performed using the `options.env.PATH` environment | ||
| * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is | ||
| * used. If `options.env` is set without `PATH`, lookup on Unix is performed | ||
| * on a default search path search of `/usr/bin:/bin` (see your operating system's | ||
| * manual for execvpe/execvp), on Windows the current processes environment | ||
| * variable `PATH` is used. | ||
| * | ||
| * On Windows, environment variables are case-insensitive. Node.js | ||
| * lexicographically sorts the `env` keys and uses the first one that | ||
| * case-insensitively matches. Only first (in lexicographic order) entry will be | ||
| * passed to the subprocess. This might lead to issues on Windows when passing | ||
| * objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`. | ||
| * | ||
| * The {@link spawn} method spawns the child process asynchronously, | ||
| * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks | ||
| * the event loop until the spawned process either exits or is terminated. | ||
| * | ||
| * For convenience, the `node:child_process` module provides a handful of | ||
| * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on | ||
| * top of {@link spawn} or {@link spawnSync}. | ||
| * | ||
| * * {@link exec}: spawns a shell and runs a command within that | ||
| * shell, passing the `stdout` and `stderr` to a callback function when | ||
| * complete. | ||
| * * {@link execFile}: similar to {@link exec} except | ||
| * that it spawns the command directly without first spawning a shell by | ||
| * default. | ||
| * * {@link fork}: spawns a new Node.js process and invokes a | ||
| * specified module with an IPC communication channel established that allows | ||
| * sending messages between parent and child. | ||
| * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. | ||
| * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. | ||
| * | ||
| * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, | ||
| * the synchronous methods can have significant impact on performance due to | ||
| * stalling the event loop while spawned processes complete. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/child_process.js) | ||
| */ | ||
| declare module "node:child_process" { | ||
@@ -69,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
+0
-54
@@ -1,55 +0,1 @@ | ||
| /** | ||
| * Clusters of Node.js processes can be used to run multiple instances of Node.js | ||
| * that can distribute workloads among their application threads. When process isolation | ||
| * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html) | ||
| * module instead, which allows running multiple application threads within a single Node.js instance. | ||
| * | ||
| * The cluster module allows easy creation of child processes that all share | ||
| * server ports. | ||
| * | ||
| * ```js | ||
| * import cluster from 'node:cluster'; | ||
| * import http from 'node:http'; | ||
| * import { availableParallelism } from 'node:os'; | ||
| * import process from 'node:process'; | ||
| * | ||
| * const numCPUs = availableParallelism(); | ||
| * | ||
| * if (cluster.isPrimary) { | ||
| * console.log(`Primary ${process.pid} is running`); | ||
| * | ||
| * // Fork workers. | ||
| * for (let i = 0; i < numCPUs; i++) { | ||
| * cluster.fork(); | ||
| * } | ||
| * | ||
| * cluster.on('exit', (worker, code, signal) => { | ||
| * console.log(`worker ${worker.process.pid} died`); | ||
| * }); | ||
| * } else { | ||
| * // Workers can share any TCP connection | ||
| * // In this case it is an HTTP server | ||
| * http.createServer((req, res) => { | ||
| * res.writeHead(200); | ||
| * res.end('hello world\n'); | ||
| * }).listen(8000); | ||
| * | ||
| * console.log(`Worker ${process.pid} started`); | ||
| * } | ||
| * ``` | ||
| * | ||
| * Running Node.js will now share port 8000 between the workers: | ||
| * | ||
| * ```console | ||
| * $ node server.js | ||
| * Primary 3596 is running | ||
| * Worker 4324 started | ||
| * Worker 4520 started | ||
| * Worker 6056 started | ||
| * Worker 5644 started | ||
| * ``` | ||
| * | ||
| * On Windows, it is not yet possible to set up a named pipe server in a worker. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/cluster.js) | ||
| */ | ||
| declare module "node:cluster" { | ||
@@ -56,0 +2,0 @@ import * as child_process from "node:child_process"; |
+0
-58
@@ -1,59 +0,1 @@ | ||
| /** | ||
| * The `node:console` module provides a simple debugging console that is similar to | ||
| * the JavaScript console mechanism provided by web browsers. | ||
| * | ||
| * The module exports two specific components: | ||
| * | ||
| * * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream. | ||
| * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) and | ||
| * [`process.stderr`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. | ||
| * | ||
| * _**Warning**_: The global console object's methods are neither consistently | ||
| * synchronous like the browser APIs they resemble, nor are they consistently | ||
| * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v25.x/api/process.html#a-note-on-process-io) for | ||
| * more information. | ||
| * | ||
| * Example using the global `console`: | ||
| * | ||
| * ```js | ||
| * console.log('hello world'); | ||
| * // Prints: hello world, to stdout | ||
| * console.log('hello %s', 'world'); | ||
| * // Prints: hello world, to stdout | ||
| * console.error(new Error('Whoops, something bad happened')); | ||
| * // Prints error message and stack trace to stderr: | ||
| * // Error: Whoops, something bad happened | ||
| * // at [eval]:5:15 | ||
| * // at Script.runInThisContext (node:vm:132:18) | ||
| * // at Object.runInThisContext (node:vm:309:38) | ||
| * // at node:internal/process/execution:77:19 | ||
| * // at [eval]-wrapper:6:22 | ||
| * // at evalScript (node:internal/process/execution:76:60) | ||
| * // at node:internal/main/eval_string:23:3 | ||
| * | ||
| * const name = 'Will Robinson'; | ||
| * console.warn(`Danger ${name}! Danger!`); | ||
| * // Prints: Danger Will Robinson! Danger!, to stderr | ||
| * ``` | ||
| * | ||
| * Example using the `Console` class: | ||
| * | ||
| * ```js | ||
| * const out = getStreamSomehow(); | ||
| * const err = getStreamSomehow(); | ||
| * const myConsole = new console.Console(out, err); | ||
| * | ||
| * myConsole.log('hello world'); | ||
| * // Prints: hello world, to out | ||
| * myConsole.log('hello %s', 'world'); | ||
| * // Prints: hello world, to out | ||
| * myConsole.error(new Error('Whoops, something bad happened')); | ||
| * // Prints: [Error: Whoops, something bad happened], to err | ||
| * | ||
| * const name = 'Will Robinson'; | ||
| * myConsole.warn(`Danger ${name}! Danger!`); | ||
| * // Prints: Danger Will Robinson! Danger!, to err | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/console.js) | ||
| */ | ||
| declare module "node:console" { | ||
@@ -60,0 +2,0 @@ import { InspectOptions } from "node:util"; |
@@ -1,7 +0,1 @@ | ||
| /** | ||
| * @deprecated The `node:constants` module is deprecated. When requiring access to constants | ||
| * relevant to specific Node.js builtin modules, developers should instead refer | ||
| * to the `constants` property exposed by the relevant module. For instance, | ||
| * `require('node:fs').constants` and `require('node:os').constants`. | ||
| */ | ||
| declare module "node:constants" { | ||
@@ -8,0 +2,0 @@ const constants: |
+0
-27
@@ -1,28 +0,1 @@ | ||
| /** | ||
| * The `node:dgram` module provides an implementation of UDP datagram sockets. | ||
| * | ||
| * ```js | ||
| * import dgram from 'node:dgram'; | ||
| * | ||
| * const server = dgram.createSocket('udp4'); | ||
| * | ||
| * server.on('error', (err) => { | ||
| * console.error(`server error:\n${err.stack}`); | ||
| * server.close(); | ||
| * }); | ||
| * | ||
| * server.on('message', (msg, rinfo) => { | ||
| * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); | ||
| * }); | ||
| * | ||
| * server.on('listening', () => { | ||
| * const address = server.address(); | ||
| * console.log(`server listening ${address.address}:${address.port}`); | ||
| * }); | ||
| * | ||
| * server.bind(41234); | ||
| * // Prints: server listening 0.0.0.0:41234 | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dgram.js) | ||
| */ | ||
| declare module "node:dgram" { | ||
@@ -29,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
@@ -1,25 +0,1 @@ | ||
| /** | ||
| * The `node:diagnostics_channel` module provides an API to create named channels | ||
| * to report arbitrary message data for diagnostics purposes. | ||
| * | ||
| * It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import diagnostics_channel from 'node:diagnostics_channel'; | ||
| * ``` | ||
| * | ||
| * It is intended that a module writer wanting to report diagnostics messages | ||
| * will create one or many top-level channels to report messages through. | ||
| * Channels may also be acquired at runtime but it is not encouraged | ||
| * due to the additional overhead of doing so. Channels may be exported for | ||
| * convenience, but as long as the name is known it can be acquired anywhere. | ||
| * | ||
| * If you intend for your module to produce diagnostics data for others to | ||
| * consume it is recommended that you include documentation of what named | ||
| * channels are used along with the shape of the message data. Channel names | ||
| * should generally include the module name to avoid collisions with data from | ||
| * other modules. | ||
| * @since v15.1.0, v14.17.0 | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/diagnostics_channel.js) | ||
| */ | ||
| declare module "node:diagnostics_channel" { | ||
@@ -26,0 +2,0 @@ import { AsyncLocalStorage } from "node:async_hooks"; |
+0
-46
@@ -1,47 +0,1 @@ | ||
| /** | ||
| * The `node:dns` module enables name resolution. For example, use it to look up IP | ||
| * addresses of host names. | ||
| * | ||
| * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the | ||
| * DNS protocol for lookups. {@link lookup} uses the operating system | ||
| * facilities to perform name resolution. It may not need to perform any network | ||
| * communication. To perform name resolution the way other applications on the same | ||
| * system do, use {@link lookup}. | ||
| * | ||
| * ```js | ||
| * import dns from 'node:dns'; | ||
| * | ||
| * dns.lookup('example.org', (err, address, family) => { | ||
| * console.log('address: %j family: IPv%s', address, family); | ||
| * }); | ||
| * // address: "93.184.216.34" family: IPv4 | ||
| * ``` | ||
| * | ||
| * All other functions in the `node:dns` module connect to an actual DNS server to | ||
| * perform name resolution. They will always use the network to perform DNS | ||
| * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform | ||
| * DNS queries, bypassing other name-resolution facilities. | ||
| * | ||
| * ```js | ||
| * import dns from 'node:dns'; | ||
| * | ||
| * dns.resolve4('archive.org', (err, addresses) => { | ||
| * if (err) throw err; | ||
| * | ||
| * console.log(`addresses: ${JSON.stringify(addresses)}`); | ||
| * | ||
| * addresses.forEach((a) => { | ||
| * dns.reverse(a, (err, hostnames) => { | ||
| * if (err) { | ||
| * throw err; | ||
| * } | ||
| * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); | ||
| * }); | ||
| * }); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * See the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations) for more information. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dns.js) | ||
| */ | ||
| declare module "node:dns" { | ||
@@ -48,0 +2,0 @@ // Supported getaddrinfo flags. |
@@ -1,7 +0,1 @@ | ||
| /** | ||
| * The `dns.promises` API provides an alternative set of asynchronous DNS methods | ||
| * that return `Promise` objects rather than using callbacks. The API is accessible | ||
| * via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`. | ||
| * @since v10.6.0 | ||
| */ | ||
| declare module "node:dns/promises" { | ||
@@ -8,0 +2,0 @@ import { |
+0
-16
@@ -1,17 +0,1 @@ | ||
| /** | ||
| * **This module is pending deprecation.** Once a replacement API has been | ||
| * finalized, this module will be fully deprecated. Most developers should | ||
| * **not** have cause to use this module. Users who absolutely must have | ||
| * the functionality that domains provide may rely on it for the time being | ||
| * but should expect to have to migrate to a different solution | ||
| * in the future. | ||
| * | ||
| * Domains provide a way to handle multiple different IO operations as a | ||
| * single group. If any of the event emitters or callbacks registered to a | ||
| * domain emit an `'error'` event, or throw an error, then the domain object | ||
| * will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to | ||
| * exit immediately with an error code. | ||
| * @deprecated Since v1.4.2 - Deprecated | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/domain.js) | ||
| */ | ||
| declare module "node:domain" { | ||
@@ -18,0 +2,0 @@ import { EventEmitter } from "node:events"; |
+0
-36
@@ -1,37 +0,1 @@ | ||
| /** | ||
| * Much of the Node.js core API is built around an idiomatic asynchronous | ||
| * event-driven architecture in which certain kinds of objects (called "emitters") | ||
| * emit named events that cause `Function` objects ("listeners") to be called. | ||
| * | ||
| * For instance: a `net.Server` object emits an event each time a peer | ||
| * connects to it; a `fs.ReadStream` emits an event when the file is opened; | ||
| * a `stream` emits an event whenever data is available to be read. | ||
| * | ||
| * All objects that emit events are instances of the `EventEmitter` class. These | ||
| * objects expose an `eventEmitter.on()` function that allows one or more | ||
| * functions to be attached to named events emitted by the object. Typically, | ||
| * event names are camel-cased strings but any valid JavaScript property key | ||
| * can be used. | ||
| * | ||
| * When the `EventEmitter` object emits an event, all of the functions attached | ||
| * to that specific event are called _synchronously_. Any values returned by the | ||
| * called listeners are _ignored_ and discarded. | ||
| * | ||
| * The following example shows a simple `EventEmitter` instance with a single | ||
| * listener. The `eventEmitter.on()` method is used to register listeners, while | ||
| * the `eventEmitter.emit()` method is used to trigger the event. | ||
| * | ||
| * ```js | ||
| * import { EventEmitter } from 'node:events'; | ||
| * | ||
| * class MyEmitter extends EventEmitter {} | ||
| * | ||
| * const myEmitter = new MyEmitter(); | ||
| * myEmitter.on('event', () => { | ||
| * console.log('an event occurred!'); | ||
| * }); | ||
| * myEmitter.emit('event'); | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/events.js) | ||
| */ | ||
| declare module "node:events" { | ||
@@ -38,0 +2,0 @@ import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; |
@@ -1,11 +0,1 @@ | ||
| /** | ||
| * The `fs/promises` API provides asynchronous file system methods that return | ||
| * promises. | ||
| * | ||
| * The promise APIs use the underlying Node.js threadpool to perform file | ||
| * system operations off the event loop thread. These operations are not | ||
| * synchronized or threadsafe. Care must be taken when performing multiple | ||
| * concurrent modifications on the same file or data corruption may occur. | ||
| * @since v10.0.0 | ||
| */ | ||
| declare module "node:fs/promises" { | ||
@@ -12,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
+0
-5
@@ -1,6 +0,1 @@ | ||
| /** | ||
| * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a | ||
| * separate module. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/https.js) | ||
| */ | ||
| declare module "node:https" { | ||
@@ -7,0 +2,0 @@ import * as http from "node:http"; |
@@ -1,6 +0,1 @@ | ||
| /** | ||
| * The `node:inspector` module provides an API for interacting with the V8 | ||
| * inspector. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector.js) | ||
| */ | ||
| declare module "node:inspector" { | ||
@@ -7,0 +2,0 @@ import { EventEmitter } from "node:events"; |
@@ -1,7 +0,1 @@ | ||
| /** | ||
| * The `node:inspector/promises` module provides an API for interacting with the V8 | ||
| * inspector. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector/promises.js) | ||
| * @since v19.0.0 | ||
| */ | ||
| declare module "node:inspector/promises" { | ||
@@ -8,0 +2,0 @@ import { EventEmitter } from "node:events"; |
+0
-3
@@ -1,4 +0,1 @@ | ||
| /** | ||
| * @since v0.3.7 | ||
| */ | ||
| declare module "node:module" { | ||
@@ -5,0 +2,0 @@ import { URL } from "node:url"; |
+32
-14
@@ -1,15 +0,1 @@ | ||
| /** | ||
| * > Stability: 2 - Stable | ||
| * | ||
| * The `node:net` module provides an asynchronous network API for creating stream-based | ||
| * TCP or `IPC` servers ({@link createServer}) and clients | ||
| * ({@link createConnection}). | ||
| * | ||
| * It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import net from 'node:net'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/net.js) | ||
| */ | ||
| declare module "node:net" { | ||
@@ -41,2 +27,3 @@ import { NonSharedBuffer } from "node:buffer"; | ||
| blockList?: BlockList | undefined; | ||
| typeOfService?: number | undefined; | ||
| } | ||
@@ -236,2 +223,33 @@ interface OnReadOpts { | ||
| /** | ||
| * Returns the current Type of Service (TOS) field for IPv4 packets or Traffic | ||
| * Class for IPv6 packets for this socket. | ||
| * | ||
| * `setTypeOfService()` may be called before the socket is connected; the value | ||
| * will be cached and applied when the socket establishes a connection. | ||
| * `getTypeOfService()` will return the currently set value even before connection. | ||
| * | ||
| * On some platforms (e.g., Linux), certain TOS/ECN bits may be masked or ignored, | ||
| * and behavior can differ between IPv4 and IPv6 or dual-stack sockets. Callers | ||
| * should verify platform-specific semantics. | ||
| * @since v25.6.0 | ||
| * @returns The current TOS value. | ||
| */ | ||
| getTypeOfService(): number; | ||
| /** | ||
| * Sets the Type of Service (TOS) field for IPv4 packets or Traffic Class for IPv6 | ||
| * Packets sent from this socket. This can be used to prioritize network traffic. | ||
| * | ||
| * `setTypeOfService()` may be called before the socket is connected; the value | ||
| * will be cached and applied when the socket establishes a connection. | ||
| * `getTypeOfService()` will return the currently set value even before connection. | ||
| * | ||
| * On some platforms (e.g., Linux), certain TOS/ECN bits may be masked or ignored, | ||
| * and behavior can differ between IPv4 and IPv6 or dual-stack sockets. Callers | ||
| * should verify platform-specific semantics. | ||
| * @since v25.6.0 | ||
| * @param tos The TOS value to set (0-255). | ||
| * @returns The socket itself. | ||
| */ | ||
| setTypeOfService(tos: number): this; | ||
| /** | ||
| * Returns the bound `address`, the address `family` name and `port` of the | ||
@@ -238,0 +256,0 @@ * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` |
+0
-9
@@ -1,10 +0,1 @@ | ||
| /** | ||
| * The `node:os` module provides operating system-related utility methods and | ||
| * properties. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import os from 'node:os'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/os.js) | ||
| */ | ||
| declare module "node:os" { | ||
@@ -11,0 +2,0 @@ import { NonSharedBuffer } from "buffer"; |
| { | ||
| "name": "@types/node", | ||
| "version": "25.5.2", | ||
| "version": "25.6.0", | ||
| "description": "TypeScript definitions for node", | ||
@@ -150,7 +150,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
| "dependencies": { | ||
| "undici-types": "~7.18.0" | ||
| "undici-types": "~7.19.0" | ||
| }, | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "ecfeeb69f68108817337300f59f20907babb8c0a870a588637f3d9c8b96e73f5", | ||
| "typesPublisherContentHash": "753bd9272f1c86686cc2d1bb435a7f033157f700201f64f0319742347e1ca060", | ||
| "typeScriptVersion": "5.3" | ||
| } |
+0
-9
@@ -1,10 +0,1 @@ | ||
| /** | ||
| * The `node:path` module provides utilities for working with file and directory | ||
| * paths. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import path from 'node:path'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/path.js) | ||
| */ | ||
| declare module "node:path" { | ||
@@ -11,0 +2,0 @@ namespace path { |
+0
-31
@@ -1,32 +0,1 @@ | ||
| /** | ||
| * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for | ||
| * Node.js-specific performance measurements. | ||
| * | ||
| * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): | ||
| * | ||
| * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) | ||
| * * [Performance Timeline](https://w3c.github.io/performance-timeline/) | ||
| * * [User Timing](https://www.w3.org/TR/user-timing/) | ||
| * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) | ||
| * | ||
| * ```js | ||
| * import { PerformanceObserver, performance } from 'node:perf_hooks'; | ||
| * | ||
| * const obs = new PerformanceObserver((items) => { | ||
| * console.log(items.getEntries()[0].duration); | ||
| * performance.clearMarks(); | ||
| * }); | ||
| * obs.observe({ type: 'measure' }); | ||
| * performance.measure('Start to Now'); | ||
| * | ||
| * performance.mark('A'); | ||
| * doSomeLongRunningProcess(() => { | ||
| * performance.measure('A to Now', 'A'); | ||
| * | ||
| * performance.mark('B'); | ||
| * performance.measure('A to B', 'A', 'B'); | ||
| * }); | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/perf_hooks.js) | ||
| */ | ||
| declare module "node:perf_hooks" { | ||
@@ -33,0 +2,0 @@ import { InternalEventTargetEventProperties } from "node:events"; |
+0
-28
@@ -1,29 +0,1 @@ | ||
| /** | ||
| * **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users | ||
| * currently depending on the `punycode` module should switch to using the | ||
| * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL | ||
| * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. | ||
| * | ||
| * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It | ||
| * can be accessed using: | ||
| * | ||
| * ```js | ||
| * import punycode from 'node:punycode'; | ||
| * ``` | ||
| * | ||
| * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is | ||
| * primarily intended for use in Internationalized Domain Names. Because host | ||
| * names in URLs are limited to ASCII characters only, Domain Names that contain | ||
| * non-ASCII characters must be converted into ASCII using the Punycode scheme. | ||
| * For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent | ||
| * to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`. | ||
| * | ||
| * The `punycode` module provides a simple implementation of the Punycode standard. | ||
| * | ||
| * The `punycode` module is a third-party dependency used by Node.js and | ||
| * made available to developers as a convenience. Fixes or other modifications to | ||
| * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. | ||
| * @deprecated | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/punycode.js) | ||
| */ | ||
| declare module "node:punycode" { | ||
@@ -30,0 +2,0 @@ /** |
@@ -1,14 +0,1 @@ | ||
| /** | ||
| * The `node:querystring` module provides utilities for parsing and formatting URL | ||
| * query strings. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import querystring from 'node:querystring'; | ||
| * ``` | ||
| * | ||
| * `querystring` is more performant than `URLSearchParams` but is not a | ||
| * standardized API. Use `URLSearchParams` when performance is not critical or | ||
| * when compatibility with browser code is desirable. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/querystring.js) | ||
| */ | ||
| declare module "node:querystring" { | ||
@@ -15,0 +2,0 @@ interface StringifyOptions { |
+0
-13
@@ -1,14 +0,1 @@ | ||
| /** | ||
| * The 'node:quic' module provides an implementation of the QUIC protocol. | ||
| * To access it, start Node.js with the `--experimental-quic` option and: | ||
| * | ||
| * ```js | ||
| * import quic from 'node:quic'; | ||
| * ``` | ||
| * | ||
| * The module is only available under the `node:` scheme. | ||
| * @since v23.8.0 | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/quic.js) | ||
| */ | ||
| declare module "node:quic" { | ||
@@ -15,0 +2,0 @@ import { KeyObject, webcrypto } from "node:crypto"; |
+0
-35
@@ -1,36 +0,1 @@ | ||
| /** | ||
| * The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream | ||
| * (such as [`process.stdin`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdin)) one line at a time. | ||
| * | ||
| * To use the promise-based APIs: | ||
| * | ||
| * ```js | ||
| * import * as readline from 'node:readline/promises'; | ||
| * ``` | ||
| * | ||
| * To use the callback and sync APIs: | ||
| * | ||
| * ```js | ||
| * import * as readline from 'node:readline'; | ||
| * ``` | ||
| * | ||
| * The following simple example illustrates the basic use of the `node:readline` module. | ||
| * | ||
| * ```js | ||
| * import * as readline from 'node:readline/promises'; | ||
| * import { stdin as input, stdout as output } from 'node:process'; | ||
| * | ||
| * const rl = readline.createInterface({ input, output }); | ||
| * | ||
| * const answer = await rl.question('What do you think of Node.js? '); | ||
| * | ||
| * console.log(`Thank you for your valuable feedback: ${answer}`); | ||
| * | ||
| * rl.close(); | ||
| * ``` | ||
| * | ||
| * Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be | ||
| * received on the `input` stream. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/readline.js) | ||
| */ | ||
| declare module "node:readline" { | ||
@@ -37,0 +2,0 @@ import { Abortable, EventEmitter, InternalEventEmitter } from "node:events"; |
@@ -1,4 +0,1 @@ | ||
| /** | ||
| * @since v17.0.0 | ||
| */ | ||
| declare module "node:readline/promises" { | ||
@@ -5,0 +2,0 @@ import { Abortable } from "node:events"; |
+1
-1
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Fri, 03 Apr 2026 11:14:41 GMT | ||
| * Last updated: Fri, 10 Apr 2026 03:39:58 GMT | ||
| * Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
+0
-10
@@ -1,11 +0,1 @@ | ||
| /** | ||
| * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation | ||
| * that is available both as a standalone program or includible in other | ||
| * applications. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import repl from 'node:repl'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/repl.js) | ||
| */ | ||
| declare module "node:repl" { | ||
@@ -12,0 +2,0 @@ import { AsyncCompleter, Completer, Interface, InterfaceEventMap } from "node:readline"; |
+0
-115
@@ -1,116 +0,1 @@ | ||
| /** | ||
| * This feature allows the distribution of a Node.js application conveniently to a | ||
| * system that does not have Node.js installed. | ||
| * | ||
| * Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing | ||
| * the injection of a blob prepared by Node.js, which can contain a bundled script, | ||
| * into the `node` binary. During start up, the program checks if anything has been | ||
| * injected. If the blob is found, it executes the script in the blob. Otherwise | ||
| * Node.js operates as it normally does. | ||
| * | ||
| * The single executable application feature currently only supports running a | ||
| * single embedded script using the `CommonJS` module system. | ||
| * | ||
| * Users can create a single executable application from their bundled script | ||
| * with the `node` binary itself and any tool which can inject resources into the | ||
| * binary. | ||
| * | ||
| * Here are the steps for creating a single executable application using one such | ||
| * tool, [postject](https://github.com/nodejs/postject): | ||
| * | ||
| * 1. Create a JavaScript file: | ||
| * ```bash | ||
| * echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js | ||
| * ``` | ||
| * 2. Create a configuration file building a blob that can be injected into the | ||
| * single executable application (see `Generating single executable preparation blobs` for details): | ||
| * ```bash | ||
| * echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json | ||
| * ``` | ||
| * 3. Generate the blob to be injected: | ||
| * ```bash | ||
| * node --experimental-sea-config sea-config.json | ||
| * ``` | ||
| * 4. Create a copy of the `node` executable and name it according to your needs: | ||
| * * On systems other than Windows: | ||
| * ```bash | ||
| * cp $(command -v node) hello | ||
| * ``` | ||
| * * On Windows: | ||
| * ```text | ||
| * node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')" | ||
| * ``` | ||
| * The `.exe` extension is necessary. | ||
| * 5. Remove the signature of the binary (macOS and Windows only): | ||
| * * On macOS: | ||
| * ```bash | ||
| * codesign --remove-signature hello | ||
| * ``` | ||
| * * On Windows (optional): | ||
| * [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/). | ||
| * If this step is | ||
| * skipped, ignore any signature-related warning from postject. | ||
| * ```powershell | ||
| * signtool remove /s hello.exe | ||
| * ``` | ||
| * 6. Inject the blob into the copied binary by running `postject` with | ||
| * the following options: | ||
| * * `hello` / `hello.exe` \- The name of the copy of the `node` executable | ||
| * created in step 4. | ||
| * * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary | ||
| * where the contents of the blob will be stored. | ||
| * * `sea-prep.blob` \- The name of the blob created in step 1. | ||
| * * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been | ||
| * injected. | ||
| * * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the | ||
| * segment in the binary where the contents of the blob will be | ||
| * stored. | ||
| * To summarize, here is the required command for each platform: | ||
| * * On Linux: | ||
| * ```bash | ||
| * npx postject hello NODE_SEA_BLOB sea-prep.blob \ | ||
| * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | ||
| * ``` | ||
| * * On Windows - PowerShell: | ||
| * ```powershell | ||
| * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ` | ||
| * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | ||
| * ``` | ||
| * * On Windows - Command Prompt: | ||
| * ```text | ||
| * npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^ | ||
| * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | ||
| * ``` | ||
| * * On macOS: | ||
| * ```bash | ||
| * npx postject hello NODE_SEA_BLOB sea-prep.blob \ | ||
| * --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ | ||
| * --macho-segment-name NODE_SEA | ||
| * ``` | ||
| * 7. Sign the binary (macOS and Windows only): | ||
| * * On macOS: | ||
| * ```bash | ||
| * codesign --sign - hello | ||
| * ``` | ||
| * * On Windows (optional): | ||
| * A certificate needs to be present for this to work. However, the unsigned | ||
| * binary would still be runnable. | ||
| * ```powershell | ||
| * signtool sign /fd SHA256 hello.exe | ||
| * ``` | ||
| * 8. Run the binary: | ||
| * * On systems other than Windows | ||
| * ```console | ||
| * $ ./hello world | ||
| * Hello, world! | ||
| * ``` | ||
| * * On Windows | ||
| * ```console | ||
| * $ .\hello.exe world | ||
| * Hello, world! | ||
| * ``` | ||
| * @since v19.7.0, v18.16.0 | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/src/node_sea.cc) | ||
| */ | ||
| declare module "node:sea" { | ||
@@ -117,0 +2,0 @@ type AssetKey = string; |
+0
-44
@@ -1,45 +0,1 @@ | ||
| /** | ||
| * The `node:sqlite` module facilitates working with SQLite databases. | ||
| * To access it: | ||
| * | ||
| * ```js | ||
| * import sqlite from 'node:sqlite'; | ||
| * ``` | ||
| * | ||
| * This module is only available under the `node:` scheme. The following will not | ||
| * work: | ||
| * | ||
| * ```js | ||
| * import sqlite from 'sqlite'; | ||
| * ``` | ||
| * | ||
| * The following example shows the basic usage of the `node:sqlite` module to open | ||
| * an in-memory database, write data to the database, and then read the data back. | ||
| * | ||
| * ```js | ||
| * import { DatabaseSync } from 'node:sqlite'; | ||
| * const database = new DatabaseSync(':memory:'); | ||
| * | ||
| * // Execute SQL statements from strings. | ||
| * database.exec(` | ||
| * CREATE TABLE data( | ||
| * key INTEGER PRIMARY KEY, | ||
| * value TEXT | ||
| * ) STRICT | ||
| * `); | ||
| * // Create a prepared statement to insert data into the database. | ||
| * const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); | ||
| * // Execute the prepared statement with bound values. | ||
| * insert.run(1, 'hello'); | ||
| * insert.run(2, 'world'); | ||
| * // Create a prepared statement to read data from the database. | ||
| * const query = database.prepare('SELECT * FROM data ORDER BY key'); | ||
| * // Execute the prepared statement and log the result set. | ||
| * console.log(query.all()); | ||
| * // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] | ||
| * ``` | ||
| * @since v22.5.0 | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/sqlite.js) | ||
| */ | ||
| declare module "node:sqlite" { | ||
@@ -46,0 +2,0 @@ import { PathLike } from "node:fs"; |
@@ -1,6 +0,1 @@ | ||
| /** | ||
| * The utility consumer functions provide common options for consuming | ||
| * streams. | ||
| * @since v16.7.0 | ||
| */ | ||
| declare module "node:stream/consumers" { | ||
@@ -10,2 +5,15 @@ import { Blob, NonSharedBuffer } from "node:buffer"; | ||
| /** | ||
| * ```js | ||
| * import { arrayBuffer } from 'node:stream/consumers'; | ||
| * import { Readable } from 'node:stream'; | ||
| * import { TextEncoder } from 'node:util'; | ||
| * | ||
| * const encoder = new TextEncoder(); | ||
| * const dataArray = encoder.encode('hello world from consumers!'); | ||
| * | ||
| * const readable = Readable.from(dataArray); | ||
| * const data = await arrayBuffer(readable); | ||
| * console.log(`from readable: ${data.byteLength}`); | ||
| * // Prints: from readable: 76 | ||
| * ``` | ||
| * @since v16.7.0 | ||
@@ -16,2 +24,12 @@ * @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream. | ||
| /** | ||
| * ```js | ||
| * import { blob } from 'node:stream/consumers'; | ||
| * | ||
| * const dataBlob = new Blob(['hello world from consumers!']); | ||
| * | ||
| * const readable = dataBlob.stream(); | ||
| * const data = await blob(readable); | ||
| * console.log(`from readable: ${data.size}`); | ||
| * // Prints: from readable: 27 | ||
| * ``` | ||
| * @since v16.7.0 | ||
@@ -22,2 +40,14 @@ * @returns Fulfills with a `Blob` containing the full contents of the stream. | ||
| /** | ||
| * ```js | ||
| * import { buffer } from 'node:stream/consumers'; | ||
| * import { Readable } from 'node:stream'; | ||
| * import { Buffer } from 'node:buffer'; | ||
| * | ||
| * const dataBuffer = Buffer.from('hello world from consumers!'); | ||
| * | ||
| * const readable = Readable.from(dataBuffer); | ||
| * const data = await buffer(readable); | ||
| * console.log(`from readable: ${data.length}`); | ||
| * // Prints: from readable: 27 | ||
| * ``` | ||
| * @since v16.7.0 | ||
@@ -28,2 +58,39 @@ * @returns Fulfills with a `Buffer` containing the full contents of the stream. | ||
| /** | ||
| * ```js | ||
| * import { bytes } from 'node:stream/consumers'; | ||
| * import { Readable } from 'node:stream'; | ||
| * import { Buffer } from 'node:buffer'; | ||
| * | ||
| * const dataBuffer = Buffer.from('hello world from consumers!'); | ||
| * | ||
| * const readable = Readable.from(dataBuffer); | ||
| * const data = await bytes(readable); | ||
| * console.log(`from readable: ${data.length}`); | ||
| * // Prints: from readable: 27 | ||
| * ``` | ||
| * @since v25.6.0 | ||
| * @returns Fulfills with a `Uint8Array` containing the full contents of the stream. | ||
| */ | ||
| function bytes( | ||
| stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>, | ||
| ): Promise<NodeJS.NonSharedUint8Array>; | ||
| /** | ||
| * ```js | ||
| * import { json } from 'node:stream/consumers'; | ||
| * import { Readable } from 'node:stream'; | ||
| * | ||
| * const items = Array.from( | ||
| * { | ||
| * length: 100, | ||
| * }, | ||
| * () => ({ | ||
| * message: 'hello world from consumers!', | ||
| * }), | ||
| * ); | ||
| * | ||
| * const readable = Readable.from(JSON.stringify(items)); | ||
| * const data = await json(readable); | ||
| * console.log(`from readable: ${data.length}`); | ||
| * // Prints: from readable: 100 | ||
| * ``` | ||
| * @since v16.7.0 | ||
@@ -35,2 +102,11 @@ * @returns Fulfills with the contents of the stream parsed as a | ||
| /** | ||
| * ```js | ||
| * import { text } from 'node:stream/consumers'; | ||
| * import { Readable } from 'node:stream'; | ||
| * | ||
| * const readable = Readable.from('Hello world from consumers!'); | ||
| * const data = await text(readable); | ||
| * console.log(`from readable: ${data.length}`); | ||
| * // Prints: from readable: 27 | ||
| * ``` | ||
| * @since v16.7.0 | ||
@@ -37,0 +113,0 @@ * @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string. |
@@ -1,41 +0,1 @@ | ||
| /** | ||
| * The `node:string_decoder` module provides an API for decoding `Buffer` objects | ||
| * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 | ||
| * characters. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import { StringDecoder } from 'node:string_decoder'; | ||
| * ``` | ||
| * | ||
| * The following example shows the basic use of the `StringDecoder` class. | ||
| * | ||
| * ```js | ||
| * import { StringDecoder } from 'node:string_decoder'; | ||
| * const decoder = new StringDecoder('utf8'); | ||
| * | ||
| * const cent = Buffer.from([0xC2, 0xA2]); | ||
| * console.log(decoder.write(cent)); // Prints: ¢ | ||
| * | ||
| * const euro = Buffer.from([0xE2, 0x82, 0xAC]); | ||
| * console.log(decoder.write(euro)); // Prints: € | ||
| * ``` | ||
| * | ||
| * When a `Buffer` instance is written to the `StringDecoder` instance, an | ||
| * internal buffer is used to ensure that the decoded string does not contain | ||
| * any incomplete multibyte characters. These are held in the buffer until the | ||
| * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. | ||
| * | ||
| * In the following example, the three UTF-8 encoded bytes of the European Euro | ||
| * symbol (`€`) are written over three separate operations: | ||
| * | ||
| * ```js | ||
| * import { StringDecoder } from 'node:string_decoder'; | ||
| * const decoder = new StringDecoder('utf8'); | ||
| * | ||
| * decoder.write(Buffer.from([0xE2])); | ||
| * decoder.write(Buffer.from([0x82])); | ||
| * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/string_decoder.js) | ||
| */ | ||
| declare module "node:string_decoder" { | ||
@@ -42,0 +2,0 @@ class StringDecoder { |
@@ -1,39 +0,1 @@ | ||
| /** | ||
| * The `node:test` module supports passing `--test-reporter` | ||
| * flags for the test runner to use a specific reporter. | ||
| * | ||
| * The following built-reporters are supported: | ||
| * | ||
| * * `spec` | ||
| * The `spec` reporter outputs the test results in a human-readable format. This | ||
| * is the default reporter. | ||
| * | ||
| * * `tap` | ||
| * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. | ||
| * | ||
| * * `dot` | ||
| * The `dot` reporter outputs the test results in a compact format, | ||
| * where each passing test is represented by a `.`, | ||
| * and each failing test is represented by a `X`. | ||
| * | ||
| * * `junit` | ||
| * The junit reporter outputs test results in a jUnit XML format | ||
| * | ||
| * * `lcov` | ||
| * The `lcov` reporter outputs test coverage when used with the | ||
| * `--experimental-test-coverage` flag. | ||
| * | ||
| * The exact output of these reporters is subject to change between versions of | ||
| * Node.js, and should not be relied on programmatically. If programmatic access | ||
| * to the test runner's output is required, use the events emitted by the | ||
| * `TestsStream`. | ||
| * | ||
| * The reporters are available via the `node:test/reporters` module: | ||
| * | ||
| * ```js | ||
| * import { tap, spec, dot, junit, lcov } from 'node:test/reporters'; | ||
| * ``` | ||
| * @since v19.9.0, v18.17.0 | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test/reporters.js) | ||
| */ | ||
| declare module "node:test/reporters" { | ||
@@ -40,0 +2,0 @@ import { Transform, TransformOptions } from "node:stream"; |
+0
-10
@@ -1,11 +0,1 @@ | ||
| /** | ||
| * The `timer` module exposes a global API for scheduling functions to | ||
| * be called at some future period of time. Because the timer functions are | ||
| * globals, there is no need to import `node:timers` to use the API. | ||
| * | ||
| * The timer functions within Node.js implement a similar API as the timers API | ||
| * provided by Web Browsers but use a different internal implementation that is | ||
| * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers.js) | ||
| */ | ||
| declare module "node:timers" { | ||
@@ -12,0 +2,0 @@ import { Abortable } from "node:events"; |
@@ -1,16 +0,1 @@ | ||
| /** | ||
| * The `timers/promises` API provides an alternative set of timer functions | ||
| * that return `Promise` objects. The API is accessible via | ||
| * `require('node:timers/promises')`. | ||
| * | ||
| * ```js | ||
| * import { | ||
| * setTimeout, | ||
| * setImmediate, | ||
| * setInterval, | ||
| * } from 'node:timers/promises'; | ||
| * ``` | ||
| * @since v15.0.0 | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js) | ||
| */ | ||
| declare module "node:timers/promises" { | ||
@@ -17,0 +2,0 @@ import { TimerOptions } from "node:timers"; |
+6
-16
@@ -1,11 +0,1 @@ | ||
| /** | ||
| * The `node:tls` module provides an implementation of the Transport Layer Security | ||
| * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. | ||
| * The module can be accessed using: | ||
| * | ||
| * ```js | ||
| * import tls from 'node:tls'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tls.js) | ||
| */ | ||
| declare module "node:tls" { | ||
@@ -203,8 +193,2 @@ import { NonSharedBuffer } from "node:buffer"; | ||
| session?: Buffer | undefined; | ||
| /** | ||
| * If true, specifies that the OCSP status request extension will be | ||
| * added to the client hello and an 'OCSPResponse' event will be | ||
| * emitted on the socket before establishing a secure communication | ||
| */ | ||
| requestOCSP?: boolean | undefined; | ||
| } | ||
@@ -581,2 +565,8 @@ interface TLSSocketEventMap extends net.SocketEventMap { | ||
| rejectUnauthorized?: boolean | undefined; | ||
| /** | ||
| * If true, specifies that the OCSP status request extension will be | ||
| * added to the client hello and an 'OCSPResponse' event will be | ||
| * emitted on the socket before establishing a secure communication. | ||
| */ | ||
| requestOCSP?: boolean | undefined; | ||
| } | ||
@@ -583,0 +573,0 @@ interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { |
@@ -1,95 +0,1 @@ | ||
| /** | ||
| * The `node:trace_events` module provides a mechanism to centralize tracing information | ||
| * generated by V8, Node.js core, and userspace code. | ||
| * | ||
| * Tracing can be enabled with the `--trace-event-categories` command-line flag | ||
| * or by using the `trace_events` module. The `--trace-event-categories` flag | ||
| * accepts a list of comma-separated category names. | ||
| * | ||
| * The available categories are: | ||
| * | ||
| * * `node`: An empty placeholder. | ||
| * * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) trace data. | ||
| * The [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. | ||
| * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. | ||
| * * `node.console`: Enables capture of `console.time()` and `console.count()` output. | ||
| * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. | ||
| * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. | ||
| * * `node.dns.native`: Enables capture of trace data for DNS queries. | ||
| * * `node.net.native`: Enables capture of trace data for network. | ||
| * * `node.environment`: Enables capture of Node.js Environment milestones. | ||
| * * `node.fs.sync`: Enables capture of trace data for file system sync methods. | ||
| * * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods. | ||
| * * `node.fs.async`: Enables capture of trace data for file system async methods. | ||
| * * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods. | ||
| * * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v25.x/api/perf_hooks.html) measurements. | ||
| * * `node.perf.usertiming`: Enables capture of only Performance API User Timing | ||
| * measures and marks. | ||
| * * `node.perf.timerify`: Enables capture of only Performance API timerify | ||
| * measurements. | ||
| * * `node.promises.rejections`: Enables capture of trace data tracking the number | ||
| * of unhandled Promise rejections and handled-after-rejections. | ||
| * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. | ||
| * * `v8`: The [V8](https://nodejs.org/docs/latest-v25.x/api/v8.html) events are GC, compiling, and execution related. | ||
| * * `node.http`: Enables capture of trace data for http request / response. | ||
| * | ||
| * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. | ||
| * | ||
| * ```bash | ||
| * node --trace-event-categories v8,node,node.async_hooks server.js | ||
| * ``` | ||
| * | ||
| * Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be | ||
| * used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default. | ||
| * | ||
| * ```bash | ||
| * node --trace-events-enabled | ||
| * | ||
| * # is equivalent to | ||
| * | ||
| * node --trace-event-categories v8,node,node.async_hooks | ||
| * ``` | ||
| * | ||
| * Alternatively, trace events may be enabled using the `node:trace_events` module: | ||
| * | ||
| * ```js | ||
| * import trace_events from 'node:trace_events'; | ||
| * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); | ||
| * tracing.enable(); // Enable trace event capture for the 'node.perf' category | ||
| * | ||
| * // do work | ||
| * | ||
| * tracing.disable(); // Disable trace event capture for the 'node.perf' category | ||
| * ``` | ||
| * | ||
| * Running Node.js with tracing enabled will produce log files that can be opened | ||
| * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. | ||
| * | ||
| * The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can | ||
| * be specified with `--trace-event-file-pattern` that accepts a template | ||
| * string that supports `${rotation}` and `${pid}`: | ||
| * | ||
| * ```bash | ||
| * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js | ||
| * ``` | ||
| * | ||
| * To guarantee that the log file is properly generated after signal events like `SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers | ||
| * in your code, such as: | ||
| * | ||
| * ```js | ||
| * process.on('SIGINT', function onSigint() { | ||
| * console.info('Received SIGINT.'); | ||
| * process.exit(130); // Or applicable exit code depending on OS and signal | ||
| * }); | ||
| * ``` | ||
| * | ||
| * The tracing system uses the same time source | ||
| * as the one used by `process.hrtime()`. | ||
| * However the trace-event timestamps are expressed in microseconds, | ||
| * unlike `process.hrtime()` which returns nanoseconds. | ||
| * | ||
| * The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#class-worker) threads. | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/trace_events.js) | ||
| */ | ||
| declare module "node:trace_events" { | ||
@@ -96,0 +2,0 @@ /** |
@@ -175,3 +175,3 @@ declare module "node:buffer" { | ||
| * | ||
| * If `totalLength` is provided, it is coerced to an unsigned integer. If the | ||
| * If `totalLength` is provided, it must be an unsigned integer. If the | ||
| * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is | ||
@@ -178,0 +178,0 @@ * truncated to `totalLength`. |
+0
-25
@@ -1,26 +0,1 @@ | ||
| /** | ||
| * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module | ||
| * directly. However, it can be accessed using: | ||
| * | ||
| * ```js | ||
| * import tty from 'node:tty'; | ||
| * ``` | ||
| * | ||
| * When Node.js detects that it is being run with a text terminal ("TTY") | ||
| * attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by | ||
| * default, be instances of `tty.WriteStream`. The preferred method of determining | ||
| * whether Node.js is being run within a TTY context is to check that the value of | ||
| * the `process.stdout.isTTY` property is `true`: | ||
| * | ||
| * ```console | ||
| * $ node -p -e "Boolean(process.stdout.isTTY)" | ||
| * true | ||
| * $ node -p -e "Boolean(process.stdout.isTTY)" | cat | ||
| * false | ||
| * ``` | ||
| * | ||
| * In most cases, there should be little to no reason for an application to | ||
| * manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tty.js) | ||
| */ | ||
| declare module "node:tty" { | ||
@@ -27,0 +2,0 @@ import * as net from "node:net"; |
+0
-9
@@ -1,10 +0,1 @@ | ||
| /** | ||
| * The `node:url` module provides utilities for URL resolution and parsing. It can | ||
| * be accessed using: | ||
| * | ||
| * ```js | ||
| * import url from 'node:url'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js) | ||
| */ | ||
| declare module "node:url" { | ||
@@ -11,0 +2,0 @@ import { Blob, NonSharedBuffer } from "node:buffer"; |
+0
-8
@@ -1,9 +0,1 @@ | ||
| /** | ||
| * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using: | ||
| * | ||
| * ```js | ||
| * import v8 from 'node:v8'; | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js) | ||
| */ | ||
| declare module "node:v8" { | ||
@@ -10,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
+0
-38
@@ -1,39 +0,1 @@ | ||
| /** | ||
| * The `node:vm` module enables compiling and running code within V8 Virtual | ||
| * Machine contexts. | ||
| * | ||
| * **The `node:vm` module is not a security** | ||
| * **mechanism. Do not use it to run untrusted code.** | ||
| * | ||
| * JavaScript code can be compiled and run immediately or | ||
| * compiled, saved, and run later. | ||
| * | ||
| * A common use case is to run the code in a different V8 Context. This means | ||
| * invoked code has a different global object than the invoking code. | ||
| * | ||
| * One can provide the context by `contextifying` an | ||
| * object. The invoked code treats any property in the context like a | ||
| * global variable. Any changes to global variables caused by the invoked | ||
| * code are reflected in the context object. | ||
| * | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * | ||
| * const x = 1; | ||
| * | ||
| * const context = { x: 2 }; | ||
| * vm.createContext(context); // Contextify the object. | ||
| * | ||
| * const code = 'x += 40; var y = 17;'; | ||
| * // `x` and `y` are global variables in the context. | ||
| * // Initially, x has the value 2 because that is the value of context.x. | ||
| * vm.runInContext(code, context); | ||
| * | ||
| * console.log(context.x); // 42 | ||
| * console.log(context.y); // 17 | ||
| * | ||
| * console.log(x); // 1; y is not defined. | ||
| * ``` | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js) | ||
| */ | ||
| declare module "node:vm" { | ||
@@ -40,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
+0
-71
@@ -1,72 +0,1 @@ | ||
| /** | ||
| * **The `node:wasi` module does not currently provide the** | ||
| * **comprehensive file system security properties provided by some WASI runtimes.** | ||
| * **Full support for secure file system sandboxing may or may not be implemented in** | ||
| * **future. In the mean time, do not rely on it to run untrusted code.** | ||
| * | ||
| * The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives WebAssembly applications access to the underlying | ||
| * operating system via a collection of POSIX-like functions. | ||
| * | ||
| * ```js | ||
| * import { readFile } from 'node:fs/promises'; | ||
| * import { WASI } from 'node:wasi'; | ||
| * import { argv, env } from 'node:process'; | ||
| * | ||
| * const wasi = new WASI({ | ||
| * version: 'preview1', | ||
| * args: argv, | ||
| * env, | ||
| * preopens: { | ||
| * '/local': '/some/real/path/that/wasm/can/access', | ||
| * }, | ||
| * }); | ||
| * | ||
| * const wasm = await WebAssembly.compile( | ||
| * await readFile(new URL('./demo.wasm', import.meta.url)), | ||
| * ); | ||
| * const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject()); | ||
| * | ||
| * wasi.start(instance); | ||
| * ``` | ||
| * | ||
| * To run the above example, create a new WebAssembly text format file named `demo.wat`: | ||
| * | ||
| * ```text | ||
| * (module | ||
| * ;; Import the required fd_write WASI function which will write the given io vectors to stdout | ||
| * ;; The function signature for fd_write is: | ||
| * ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written | ||
| * (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32))) | ||
| * | ||
| * (memory 1) | ||
| * (export "memory" (memory 0)) | ||
| * | ||
| * ;; Write 'hello world\n' to memory at an offset of 8 bytes | ||
| * ;; Note the trailing newline which is required for the text to appear | ||
| * (data (i32.const 8) "hello world\n") | ||
| * | ||
| * (func $main (export "_start") | ||
| * ;; Creating a new io vector within linear memory | ||
| * (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string | ||
| * (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string | ||
| * | ||
| * (call $fd_write | ||
| * (i32.const 1) ;; file_descriptor - 1 for stdout | ||
| * (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0 | ||
| * (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one. | ||
| * (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written | ||
| * ) | ||
| * drop ;; Discard the number of bytes written from the top of the stack | ||
| * ) | ||
| * ) | ||
| * ``` | ||
| * | ||
| * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm` | ||
| * | ||
| * ```bash | ||
| * wat2wasm demo.wat | ||
| * ``` | ||
| * @experimental | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js) | ||
| */ | ||
| declare module "node:wasi" { | ||
@@ -73,0 +2,0 @@ interface WASIOptions { |
+15
-61
@@ -1,57 +0,1 @@ | ||
| /** | ||
| * The `node:worker_threads` module enables the use of threads that execute | ||
| * JavaScript in parallel. To access it: | ||
| * | ||
| * ```js | ||
| * import worker from 'node:worker_threads'; | ||
| * ``` | ||
| * | ||
| * Workers (threads) are useful for performing CPU-intensive JavaScript operations. | ||
| * They do not help much with I/O-intensive work. The Node.js built-in | ||
| * asynchronous I/O operations are more efficient than Workers can be. | ||
| * | ||
| * Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do | ||
| * so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances. | ||
| * | ||
| * ```js | ||
| * import { | ||
| * Worker, | ||
| * isMainThread, | ||
| * parentPort, | ||
| * workerData, | ||
| * } from 'node:worker_threads'; | ||
| * | ||
| * if (!isMainThread) { | ||
| * const { parse } = await import('some-js-parsing-library'); | ||
| * const script = workerData; | ||
| * parentPort.postMessage(parse(script)); | ||
| * } | ||
| * | ||
| * export default function parseJSAsync(script) { | ||
| * return new Promise((resolve, reject) => { | ||
| * const worker = new Worker(new URL(import.meta.url), { | ||
| * workerData: script, | ||
| * }); | ||
| * worker.on('message', resolve); | ||
| * worker.once('error', reject); | ||
| * worker.once('exit', (code) => { | ||
| * if (code !== 0) | ||
| * reject(new Error(`Worker stopped with exit code ${code}`)); | ||
| * }); | ||
| * }); | ||
| * }; | ||
| * ``` | ||
| * | ||
| * The above example spawns a Worker thread for each `parseJSAsync()` call. In | ||
| * practice, use a pool of Workers for these kinds of tasks. Otherwise, the | ||
| * overhead of creating Workers would likely exceed their benefit. | ||
| * | ||
| * When implementing a worker pool, use the `AsyncResource` API to inform | ||
| * diagnostic tools (e.g. to provide asynchronous stack traces) about the | ||
| * correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation. | ||
| * | ||
| * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options, | ||
| * specifically `argv` and `execArgv` options. | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/worker_threads.js) | ||
| */ | ||
| declare module "node:worker_threads" { | ||
@@ -399,7 +343,11 @@ import { | ||
| * Mark an object as not transferable. If `object` occurs in the transfer list of | ||
| * a `port.postMessage()` call, it is ignored. | ||
| * a [`port.postMessage()`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist) call, an error is thrown. This is a no-op if | ||
| * `object` is a primitive value. | ||
| * | ||
| * In particular, this makes sense for objects that can be cloned, rather than | ||
| * transferred, and which are used by other objects on the sending side. | ||
| * For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this. | ||
| * For example, Node.js marks the `ArrayBuffer`s it uses for its | ||
| * [`Buffer` pool](https://nodejs.org/docs/latest-v25.x/api/buffer.html#static-method-bufferallocunsafesize) with this. | ||
| * `ArrayBuffer.prototype.transfer()` is disallowed on such array buffer | ||
| * instances. | ||
| * | ||
@@ -418,7 +366,13 @@ * This operation cannot be undone. | ||
| * const { port1 } = new MessageChannel(); | ||
| * port1.postMessage(typedArray1, [ typedArray1.buffer ]); | ||
| * try { | ||
| * // This will throw an error, because pooledBuffer is not transferable. | ||
| * port1.postMessage(typedArray1, [ typedArray1.buffer ]); | ||
| * } catch (error) { | ||
| * // error.name === 'DataCloneError' | ||
| * } | ||
| * | ||
| * // The following line prints the contents of typedArray1 -- it still owns | ||
| * // its memory and has been cloned, not transferred. Without | ||
| * // `markAsUntransferable()`, this would print an empty Uint8Array. | ||
| * // its memory and has not been transferred. Without | ||
| * // `markAsUntransferable()`, this would print an empty Uint8Array and the | ||
| * // postMessage call would have succeeded. | ||
| * // typedArray2 is intact as well. | ||
@@ -425,0 +379,0 @@ * console.log(typedArray1); |
+0
-93
@@ -1,94 +0,1 @@ | ||
| /** | ||
| * The `node:zlib` module provides compression functionality implemented using | ||
| * Gzip, Deflate/Inflate, and Brotli. | ||
| * | ||
| * To access it: | ||
| * | ||
| * ```js | ||
| * import zlib from 'node:zlib'; | ||
| * ``` | ||
| * | ||
| * Compression and decompression are built around the Node.js | ||
| * [Streams API](https://nodejs.org/docs/latest-v25.x/api/stream.html). | ||
| * | ||
| * Compressing or decompressing a stream (such as a file) can be accomplished by | ||
| * piping the source stream through a `zlib` `Transform` stream into a destination | ||
| * stream: | ||
| * | ||
| * ```js | ||
| * import { createGzip } from 'node:zlib'; | ||
| * import { pipeline } from 'node:stream'; | ||
| * import { | ||
| * createReadStream, | ||
| * createWriteStream, | ||
| * } from 'node:fs'; | ||
| * | ||
| * const gzip = createGzip(); | ||
| * const source = createReadStream('input.txt'); | ||
| * const destination = createWriteStream('input.txt.gz'); | ||
| * | ||
| * pipeline(source, gzip, destination, (err) => { | ||
| * if (err) { | ||
| * console.error('An error occurred:', err); | ||
| * process.exitCode = 1; | ||
| * } | ||
| * }); | ||
| * | ||
| * // Or, Promisified | ||
| * | ||
| * import { promisify } from 'node:util'; | ||
| * const pipe = promisify(pipeline); | ||
| * | ||
| * async function do_gzip(input, output) { | ||
| * const gzip = createGzip(); | ||
| * const source = createReadStream(input); | ||
| * const destination = createWriteStream(output); | ||
| * await pipe(source, gzip, destination); | ||
| * } | ||
| * | ||
| * do_gzip('input.txt', 'input.txt.gz') | ||
| * .catch((err) => { | ||
| * console.error('An error occurred:', err); | ||
| * process.exitCode = 1; | ||
| * }); | ||
| * ``` | ||
| * | ||
| * It is also possible to compress or decompress data in a single step: | ||
| * | ||
| * ```js | ||
| * import { deflate, unzip } from 'node:zlib'; | ||
| * | ||
| * const input = '.................................'; | ||
| * deflate(input, (err, buffer) => { | ||
| * if (err) { | ||
| * console.error('An error occurred:', err); | ||
| * process.exitCode = 1; | ||
| * } | ||
| * console.log(buffer.toString('base64')); | ||
| * }); | ||
| * | ||
| * const buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64'); | ||
| * unzip(buffer, (err, buffer) => { | ||
| * if (err) { | ||
| * console.error('An error occurred:', err); | ||
| * process.exitCode = 1; | ||
| * } | ||
| * console.log(buffer.toString()); | ||
| * }); | ||
| * | ||
| * // Or, Promisified | ||
| * | ||
| * import { promisify } from 'node:util'; | ||
| * const do_unzip = promisify(unzip); | ||
| * | ||
| * do_unzip(buffer) | ||
| * .then((buf) => console.log(buf.toString())) | ||
| * .catch((err) => { | ||
| * console.error('An error occurred:', err); | ||
| * process.exitCode = 1; | ||
| * }); | ||
| * ``` | ||
| * @since v0.5.8 | ||
| * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/zlib.js) | ||
| */ | ||
| declare module "node:zlib" { | ||
@@ -95,0 +2,0 @@ import { NonSharedBuffer } from "node:buffer"; |
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
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.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2349988
-2.24%52121
-2.6%303
3.41%+ Added
- Removed
Updated