@types/node 20.12.14 → 20.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +1 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +23 -23
- node/child_process.d.ts +34 -32
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +60 -59
- node/dgram.d.ts +2 -2
- node/diagnostics_channel.d.ts +10 -1
- node/dns/promises.d.ts +7 -6
- node/dns.d.ts +23 -12
- node/domain.d.ts +1 -1
- node/events.d.ts +22 -2
- node/fs.d.ts +2 -2
- node/http.d.ts +62 -43
- node/http2.d.ts +1 -1
- node/https.d.ts +3 -3
- node/inspector.d.ts +1 -1
- node/net.d.ts +8 -5
- node/os.d.ts +2 -2
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +306 -46
- node/process.d.ts +12 -5
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline.d.ts +1 -1
- node/repl.d.ts +4 -4
- node/stream.d.ts +15 -15
- node/string_decoder.d.ts +1 -1
- node/test.d.ts +322 -74
- node/timers.d.ts +1 -1
- node/tls.d.ts +1 -1
- node/trace_events.d.ts +1 -1
- node/tty.d.ts +1 -1
- node/url.d.ts +11 -3
- node/util.d.ts +20 -4
- node/v8.d.ts +45 -1
- node/vm.d.ts +9 -6
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Sun, 02 Jun 2024 20:07:09 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/assert.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* The `node:assert` module provides a set of assertion functions for verifying
|
3
3
|
* invariants.
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/assert.js)
|
5
5
|
*/
|
6
6
|
declare module "assert" {
|
7
7
|
/**
|
node/async_hooks.d.ts
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
* import async_hooks from 'node:async_hooks';
|
13
13
|
* ```
|
14
14
|
* @experimental
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/async_hooks.js)
|
16
16
|
*/
|
17
17
|
declare module "async_hooks" {
|
18
18
|
/**
|
node/buffer.d.ts
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
42
42
|
* const buf7 = Buffer.from('tést', 'latin1');
|
43
43
|
* ```
|
44
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
44
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/buffer.js)
|
45
45
|
*/
|
46
46
|
declare module "buffer" {
|
47
47
|
import { BinaryLike } from "node:crypto";
|
@@ -88,7 +88,7 @@ declare module "buffer" {
|
|
88
88
|
* Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
|
89
89
|
* conversion from `fromEnc` to `toEnc` is not permitted.
|
90
90
|
*
|
91
|
-
* Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'
|
91
|
+
* Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
|
92
92
|
*
|
93
93
|
* The transcoding process will use substitution characters if a given byte
|
94
94
|
* sequence cannot be adequately represented in the target encoding. For instance:
|
@@ -781,7 +781,7 @@ declare module "buffer" {
|
|
781
781
|
* // (This result is equal to: [buf1, buf3, buf2].)
|
782
782
|
* ```
|
783
783
|
*
|
784
|
-
* The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
|
784
|
+
* The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively.
|
785
785
|
*
|
786
786
|
* ```js
|
787
787
|
* import { Buffer } from 'node:buffer';
|
@@ -797,7 +797,7 @@ declare module "buffer" {
|
|
797
797
|
* // Prints: 1
|
798
798
|
* ```
|
799
799
|
*
|
800
|
-
* `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0
|
800
|
+
* `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
|
801
801
|
* @since v0.11.13
|
802
802
|
* @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
|
803
803
|
* @param [targetStart=0] The offset within `target` at which to begin comparison.
|
@@ -1215,7 +1215,7 @@ declare module "buffer" {
|
|
1215
1215
|
*/
|
1216
1216
|
readBigInt64LE(offset?: number): bigint;
|
1217
1217
|
/**
|
1218
|
-
* Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
|
1218
|
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting
|
1219
1219
|
* up to 48 bits of accuracy.
|
1220
1220
|
*
|
1221
1221
|
* This function is also available under the `readUintLE` alias.
|
@@ -1239,7 +1239,7 @@ declare module "buffer" {
|
|
1239
1239
|
*/
|
1240
1240
|
readUintLE(offset: number, byteLength: number): number;
|
1241
1241
|
/**
|
1242
|
-
* Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
|
1242
|
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting
|
1243
1243
|
* up to 48 bits of accuracy.
|
1244
1244
|
*
|
1245
1245
|
* This function is also available under the `readUintBE` alias.
|
@@ -1265,7 +1265,7 @@ declare module "buffer" {
|
|
1265
1265
|
*/
|
1266
1266
|
readUintBE(offset: number, byteLength: number): number;
|
1267
1267
|
/**
|
1268
|
-
* Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value
|
1268
|
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value
|
1269
1269
|
* supporting up to 48 bits of accuracy.
|
1270
1270
|
*
|
1271
1271
|
* ```js
|
@@ -1282,7 +1282,7 @@ declare module "buffer" {
|
|
1282
1282
|
*/
|
1283
1283
|
readIntLE(offset: number, byteLength: number): number;
|
1284
1284
|
/**
|
1285
|
-
* Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value
|
1285
|
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value
|
1286
1286
|
* supporting up to 48 bits of accuracy.
|
1287
1287
|
*
|
1288
1288
|
* ```js
|
@@ -1329,7 +1329,7 @@ declare module "buffer" {
|
|
1329
1329
|
*/
|
1330
1330
|
readUint8(offset?: number): number;
|
1331
1331
|
/**
|
1332
|
-
* Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
|
1332
|
+
* Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`.
|
1333
1333
|
*
|
1334
1334
|
* This function is also available under the `readUint16LE` alias.
|
1335
1335
|
*
|
@@ -1702,7 +1702,7 @@ declare module "buffer" {
|
|
1702
1702
|
*/
|
1703
1703
|
writeUint8(value: number, offset?: number): number;
|
1704
1704
|
/**
|
1705
|
-
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
|
1705
|
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
|
1706
1706
|
* anything other than an unsigned 16-bit integer.
|
1707
1707
|
*
|
1708
1708
|
* This function is also available under the `writeUint16LE` alias.
|
@@ -1730,7 +1730,7 @@ declare module "buffer" {
|
|
1730
1730
|
*/
|
1731
1731
|
writeUint16LE(value: number, offset?: number): number;
|
1732
1732
|
/**
|
1733
|
-
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
|
1733
|
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
|
1734
1734
|
* unsigned 16-bit integer.
|
1735
1735
|
*
|
1736
1736
|
* This function is also available under the `writeUint16BE` alias.
|
@@ -1758,7 +1758,7 @@ declare module "buffer" {
|
|
1758
1758
|
*/
|
1759
1759
|
writeUint16BE(value: number, offset?: number): number;
|
1760
1760
|
/**
|
1761
|
-
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
|
1761
|
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
|
1762
1762
|
* anything other than an unsigned 32-bit integer.
|
1763
1763
|
*
|
1764
1764
|
* This function is also available under the `writeUint32LE` alias.
|
@@ -1785,7 +1785,7 @@ declare module "buffer" {
|
|
1785
1785
|
*/
|
1786
1786
|
writeUint32LE(value: number, offset?: number): number;
|
1787
1787
|
/**
|
1788
|
-
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
|
1788
|
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
|
1789
1789
|
* unsigned 32-bit integer.
|
1790
1790
|
*
|
1791
1791
|
* This function is also available under the `writeUint32BE` alias.
|
@@ -1836,7 +1836,7 @@ declare module "buffer" {
|
|
1836
1836
|
*/
|
1837
1837
|
writeInt8(value: number, offset?: number): number;
|
1838
1838
|
/**
|
1839
|
-
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
1839
|
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
1840
1840
|
* anything other than a signed 16-bit integer.
|
1841
1841
|
*
|
1842
1842
|
* The `value` is interpreted and written as a two's complement signed integer.
|
@@ -1858,7 +1858,7 @@ declare module "buffer" {
|
|
1858
1858
|
*/
|
1859
1859
|
writeInt16LE(value: number, offset?: number): number;
|
1860
1860
|
/**
|
1861
|
-
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
1861
|
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
1862
1862
|
* anything other than a signed 16-bit integer.
|
1863
1863
|
*
|
1864
1864
|
* The `value` is interpreted and written as a two's complement signed integer.
|
@@ -1880,7 +1880,7 @@ declare module "buffer" {
|
|
1880
1880
|
*/
|
1881
1881
|
writeInt16BE(value: number, offset?: number): number;
|
1882
1882
|
/**
|
1883
|
-
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
1883
|
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
1884
1884
|
* anything other than a signed 32-bit integer.
|
1885
1885
|
*
|
1886
1886
|
* The `value` is interpreted and written as a two's complement signed integer.
|
@@ -1902,7 +1902,7 @@ declare module "buffer" {
|
|
1902
1902
|
*/
|
1903
1903
|
writeInt32LE(value: number, offset?: number): number;
|
1904
1904
|
/**
|
1905
|
-
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
1905
|
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
1906
1906
|
* anything other than a signed 32-bit integer.
|
1907
1907
|
*
|
1908
1908
|
* The `value` is interpreted and written as a two's complement signed integer.
|
@@ -1964,7 +1964,7 @@ declare module "buffer" {
|
|
1964
1964
|
*/
|
1965
1965
|
writeFloatBE(value: number, offset?: number): number;
|
1966
1966
|
/**
|
1967
|
-
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
|
1967
|
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
|
1968
1968
|
* other than a JavaScript number.
|
1969
1969
|
*
|
1970
1970
|
* ```js
|
@@ -1984,7 +1984,7 @@ declare module "buffer" {
|
|
1984
1984
|
*/
|
1985
1985
|
writeDoubleLE(value: number, offset?: number): number;
|
1986
1986
|
/**
|
1987
|
-
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
|
1987
|
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
|
1988
1988
|
* other than a JavaScript number.
|
1989
1989
|
*
|
1990
1990
|
* ```js
|
@@ -2066,7 +2066,7 @@ declare module "buffer" {
|
|
2066
2066
|
/**
|
2067
2067
|
* If `value` is:
|
2068
2068
|
*
|
2069
|
-
* * a string, `value` is interpreted according to the character encoding in`encoding`.
|
2069
|
+
* * a string, `value` is interpreted according to the character encoding in `encoding`.
|
2070
2070
|
* * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
|
2071
2071
|
* To compare a partial `Buffer`, use `buf.subarray`.
|
2072
2072
|
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
@@ -2164,7 +2164,7 @@ declare module "buffer" {
|
|
2164
2164
|
* // Prints: 4
|
2165
2165
|
* ```
|
2166
2166
|
*
|
2167
|
-
* If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
2167
|
+
* If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
2168
2168
|
* an integer between 0 and 255.
|
2169
2169
|
*
|
2170
2170
|
* If `byteOffset` is not a number, it will be coerced to a number. Any arguments
|
@@ -2323,7 +2323,7 @@ declare module "buffer" {
|
|
2323
2323
|
* **and should never be used in new code, because they use strings to represent**
|
2324
2324
|
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
2325
2325
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
2326
|
-
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
2326
|
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
2327
2327
|
* @since v15.13.0, v14.17.0
|
2328
2328
|
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
2329
2329
|
* @param data The Base64-encoded input string.
|
@@ -2339,7 +2339,7 @@ declare module "buffer" {
|
|
2339
2339
|
* **and should never be used in new code, because they use strings to represent**
|
2340
2340
|
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
2341
2341
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
2342
|
-
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
2342
|
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
2343
2343
|
* @since v15.13.0, v14.17.0
|
2344
2344
|
* @legacy Use `buf.toString('base64')` instead.
|
2345
2345
|
* @param data An ASCII (Latin1) string.
|
node/child_process.d.ts
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
* limited (and platform-specific) capacity. If the subprocess writes to
|
26
26
|
* stdout in excess of that limit without the output being captured, the
|
27
27
|
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
28
|
-
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
|
28
|
+
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
29
29
|
*
|
30
30
|
* The command lookup is performed using the `options.env.PATH` environment
|
31
31
|
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
|
@@ -38,7 +38,7 @@
|
|
38
38
|
* lexicographically sorts the `env` keys and uses the first one that
|
39
39
|
* case-insensitively matches. Only first (in lexicographic order) entry will be
|
40
40
|
* passed to the subprocess. This might lead to issues on Windows when passing
|
41
|
-
* objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`.
|
41
|
+
* objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`.
|
42
42
|
*
|
43
43
|
* The {@link spawn} method spawns the child process asynchronously,
|
44
44
|
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
|
@@ -63,16 +63,17 @@
|
|
63
63
|
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
64
64
|
* the synchronous methods can have significant impact on performance due to
|
65
65
|
* stalling the event loop while spawned processes complete.
|
66
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
66
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/child_process.js)
|
67
67
|
*/
|
68
68
|
declare module "child_process" {
|
69
69
|
import { ObjectEncodingOptions } from "node:fs";
|
70
70
|
import { Abortable, EventEmitter } from "node:events";
|
71
|
+
import * as dgram from "node:dgram";
|
71
72
|
import * as net from "node:net";
|
72
73
|
import { Pipe, Readable, Stream, Writable } from "node:stream";
|
73
74
|
import { URL } from "node:url";
|
74
75
|
type Serializable = string | object | number | boolean | bigint;
|
75
|
-
type SendHandle = net.Socket | net.Server;
|
76
|
+
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
76
77
|
/**
|
77
78
|
* Instances of the `ChildProcess` represent spawned child processes.
|
78
79
|
*
|
@@ -94,7 +95,7 @@ declare module "child_process" {
|
|
94
95
|
* `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
|
95
96
|
* refer to the same value.
|
96
97
|
*
|
97
|
-
* The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned.
|
98
|
+
* The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
98
99
|
* @since v0.1.90
|
99
100
|
*/
|
100
101
|
stdin: Writable | null;
|
@@ -117,7 +118,7 @@ declare module "child_process" {
|
|
117
118
|
* });
|
118
119
|
* ```
|
119
120
|
*
|
120
|
-
* The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned.
|
121
|
+
* The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
121
122
|
* @since v0.1.90
|
122
123
|
*/
|
123
124
|
stdout: Readable | null;
|
@@ -130,7 +131,7 @@ declare module "child_process" {
|
|
130
131
|
* `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
|
131
132
|
* refer to the same value.
|
132
133
|
*
|
133
|
-
* The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned.
|
134
|
+
* The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
134
135
|
* @since v0.1.90
|
135
136
|
*/
|
136
137
|
stderr: Readable | null;
|
@@ -143,7 +144,7 @@ declare module "child_process" {
|
|
143
144
|
/**
|
144
145
|
* A sparse array of pipes to the child process, corresponding with positions in
|
145
146
|
* the `stdio` option passed to {@link spawn} that have been set
|
146
|
-
* to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin
|
147
|
+
* to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`,
|
147
148
|
* respectively.
|
148
149
|
*
|
149
150
|
* In the following example, only the child's fd `1` (stdout) is configured as a
|
@@ -212,7 +213,7 @@ declare module "child_process" {
|
|
212
213
|
readonly pid?: number | undefined;
|
213
214
|
/**
|
214
215
|
* The `subprocess.connected` property indicates whether it is still possible to
|
215
|
-
* send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages.
|
216
|
+
* send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages.
|
216
217
|
* @since v0.7.2
|
217
218
|
*/
|
218
219
|
readonly connected: boolean;
|
@@ -272,7 +273,7 @@ declare module "child_process" {
|
|
272
273
|
* See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
|
273
274
|
*
|
274
275
|
* On Windows, where POSIX signals do not exist, the `signal` argument will be
|
275
|
-
* ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`).
|
276
|
+
* ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`).
|
276
277
|
* See `Signal Events` for more details.
|
277
278
|
*
|
278
279
|
* On Linux, child processes of child processes will not be terminated
|
@@ -346,20 +347,20 @@ declare module "child_process" {
|
|
346
347
|
*
|
347
348
|
* There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
|
348
349
|
* containing a `NODE_` prefix in the `cmd` property are reserved for use within
|
349
|
-
* Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js.
|
350
|
-
* Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice.
|
350
|
+
* Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js.
|
351
|
+
* Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice.
|
351
352
|
*
|
352
353
|
* The optional `sendHandle` argument that may be passed to `subprocess.send()` is
|
353
354
|
* for passing a TCP server or socket object to the child process. The child will
|
354
355
|
* receive the object as the second argument passed to the callback function
|
355
|
-
* registered on the `'message'` event. Any data that is received
|
356
|
-
*
|
356
|
+
* registered on the `'message'` event. Any data that is received and buffered in
|
357
|
+
* the socket will not be sent to the child. Sending IPC sockets is not supported on Windows.
|
357
358
|
*
|
358
359
|
* The optional `callback` is a function that is invoked after the message is
|
359
360
|
* sent but before the child may have received it. The function is called with a
|
360
361
|
* single argument: `null` on success, or an `Error` object on failure.
|
361
362
|
*
|
362
|
-
* If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can
|
363
|
+
* If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can
|
363
364
|
* happen, for instance, when the child process has already exited.
|
364
365
|
*
|
365
366
|
* `subprocess.send()` will return `false` if the channel has closed or when the
|
@@ -400,8 +401,8 @@ declare module "child_process" {
|
|
400
401
|
* Once the server is now shared between the parent and child, some connections
|
401
402
|
* can be handled by the parent and some by the child.
|
402
403
|
*
|
403
|
-
* While the example above uses a server created using the `node:net` module
|
404
|
-
* listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only
|
404
|
+
* While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of
|
405
|
+
* listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only
|
405
406
|
* supported on Unix platforms.
|
406
407
|
*
|
407
408
|
* #### Example: sending a socket object
|
@@ -454,6 +455,7 @@ declare module "child_process" {
|
|
454
455
|
* as the connection may have been closed during the time it takes to send the
|
455
456
|
* connection to the child.
|
456
457
|
* @since v0.5.9
|
458
|
+
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v20.x/api/dgram.html#class-dgramsocket) object.
|
457
459
|
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
458
460
|
*/
|
459
461
|
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
@@ -482,7 +484,7 @@ declare module "child_process" {
|
|
482
484
|
disconnect(): void;
|
483
485
|
/**
|
484
486
|
* By default, the parent will wait for the detached child to exit. To prevent the
|
485
|
-
* parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not
|
487
|
+
* parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not
|
486
488
|
* include the child in its reference count, allowing the parent to exit
|
487
489
|
* independently of the child, unless there is an established IPC channel between
|
488
490
|
* the child and the parent.
|
@@ -678,7 +680,7 @@ declare module "child_process" {
|
|
678
680
|
stdio: [Stdin, Stdout, Stderr];
|
679
681
|
}
|
680
682
|
/**
|
681
|
-
* The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults
|
683
|
+
* The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults
|
682
684
|
* to an empty array.
|
683
685
|
*
|
684
686
|
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
@@ -776,10 +778,10 @@ declare module "child_process" {
|
|
776
778
|
* Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
|
777
779
|
* title while others (Windows, SunOS) will use `command`.
|
778
780
|
*
|
779
|
-
* Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve
|
780
|
-
* it with the`process.argv0` property instead.
|
781
|
+
* Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve
|
782
|
+
* it with the `process.argv0` property instead.
|
781
783
|
*
|
782
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
784
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
783
785
|
* the error passed to the callback will be an `AbortError`:
|
784
786
|
*
|
785
787
|
* ```js
|
@@ -917,9 +919,9 @@ declare module "child_process" {
|
|
917
919
|
* **Never pass unsanitized user input to this function. Any input containing shell**
|
918
920
|
* **metacharacters may be used to trigger arbitrary command execution.**
|
919
921
|
*
|
920
|
-
* If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error
|
922
|
+
* If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The
|
921
923
|
* `error.code` property will be
|
922
|
-
* the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the
|
924
|
+
* the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the
|
923
925
|
* process.
|
924
926
|
*
|
925
927
|
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
@@ -949,7 +951,7 @@ declare module "child_process" {
|
|
949
951
|
* the existing process and uses a shell to execute the command.
|
950
952
|
*
|
951
953
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
952
|
-
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
954
|
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
953
955
|
* case of an error (including any error resulting in an exit code other than 0), a
|
954
956
|
* rejected promise is returned, with the same `error` object given in the
|
955
957
|
* callback, but with two additional properties `stdout` and `stderr`.
|
@@ -966,7 +968,7 @@ declare module "child_process" {
|
|
966
968
|
* lsExample();
|
967
969
|
* ```
|
968
970
|
*
|
969
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
971
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
970
972
|
* the error passed to the callback will be an `AbortError`:
|
971
973
|
*
|
972
974
|
* ```js
|
@@ -1111,7 +1113,7 @@ declare module "child_process" {
|
|
1111
1113
|
* encoding, `Buffer` objects will be passed to the callback instead.
|
1112
1114
|
*
|
1113
1115
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
1114
|
-
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
1116
|
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
1115
1117
|
* case of an error (including any error resulting in an exit code other than 0), a
|
1116
1118
|
* rejected promise is returned, with the same `error` object given in the
|
1117
1119
|
* callback, but with two additional properties `stdout` and `stderr`.
|
@@ -1130,7 +1132,7 @@ declare module "child_process" {
|
|
1130
1132
|
* **function. Any input containing shell metacharacters may be used to trigger**
|
1131
1133
|
* **arbitrary command execution.**
|
1132
1134
|
*
|
1133
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
1135
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
1134
1136
|
* the error passed to the callback will be an `AbortError`:
|
1135
1137
|
*
|
1136
1138
|
* ```js
|
@@ -1354,7 +1356,7 @@ declare module "child_process" {
|
|
1354
1356
|
* required, spawning a large number of child Node.js processes is not
|
1355
1357
|
* recommended.
|
1356
1358
|
*
|
1357
|
-
* By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative
|
1359
|
+
* By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative
|
1358
1360
|
* execution path to be used.
|
1359
1361
|
*
|
1360
1362
|
* Node.js processes launched with a custom `execPath` will communicate with the
|
@@ -1364,9 +1366,9 @@ declare module "child_process" {
|
|
1364
1366
|
* Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
|
1365
1367
|
* current process.
|
1366
1368
|
*
|
1367
|
-
* The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set.
|
1369
|
+
* The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set.
|
1368
1370
|
*
|
1369
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
1371
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
1370
1372
|
* the error passed to the callback will be an `AbortError`:
|
1371
1373
|
*
|
1372
1374
|
* ```js
|
@@ -1475,7 +1477,7 @@ declare module "child_process" {
|
|
1475
1477
|
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
|
1476
1478
|
* until the child process has fully closed. When a timeout has been encountered
|
1477
1479
|
* and `killSignal` is sent, the method won't return until the process has
|
1478
|
-
* completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process
|
1480
|
+
* completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process
|
1479
1481
|
* has exited.
|
1480
1482
|
*
|
1481
1483
|
* If the process times out or has a non-zero exit code, this method will throw.
|
node/cluster.d.ts
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
* ```
|
51
51
|
*
|
52
52
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
53
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
53
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/cluster.js)
|
54
54
|
*/
|
55
55
|
declare module "cluster" {
|
56
56
|
import * as child from "node:child_process";
|
node/console.d.ts
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
55
55
|
* // Prints: Danger Will Robinson! Danger!, to err
|
56
56
|
* ```
|
57
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
57
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/console.js)
|
58
58
|
*/
|
59
59
|
declare module "console" {
|
60
60
|
import console = require("node:console");
|