@types/node 22.15.33 → 22.18.13
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 v22.18/README.md +15 -0
- {node v22.15 → node v22.18}/assert.d.ts +19 -0
- {node v22.15 → node v22.18}/buffer.buffer.d.ts +9 -0
- {node v22.15 → node v22.18}/buffer.d.ts +14 -6
- {node v22.15 → node v22.18}/child_process.d.ts +89 -162
- {node v22.15 → node v22.18}/cluster.d.ts +4 -5
- {node v22.15 → node v22.18}/crypto.d.ts +203 -167
- {node v22.15 → node v22.18}/dgram.d.ts +9 -8
- {node v22.15 → node v22.18}/dns/promises.d.ts +11 -10
- {node v22.15 → node v22.18}/dns.d.ts +19 -20
- {node v22.15 → node v22.18}/events.d.ts +80 -35
- {node v22.15 → node v22.18}/fs/promises.d.ts +78 -56
- {node v22.15 → node v22.18}/fs.d.ts +153 -129
- node v22.18/globals.d.ts +172 -0
- node v22.18/globals.typedarray.d.ts +38 -0
- {node v22.15 → node v22.18}/http.d.ts +112 -32
- {node v22.15 → node v22.18}/http2.d.ts +45 -26
- {node v22.15 → node v22.18}/https.d.ts +96 -62
- {node v22.15 → node v22.18}/index.d.ts +7 -3
- node v22.15/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
- {node v22.15 → node v22.18}/module.d.ts +70 -13
- {node v22.15 → node v22.18}/net.d.ts +12 -11
- {node v22.15 → node v22.18}/os.d.ts +14 -3
- {node v22.15 → node v22.18}/package.json +3 -83
- {node v22.15 → node v22.18}/perf_hooks.d.ts +6 -8
- {node v22.15 → node v22.18}/process.d.ts +15 -27
- {node v22.15 → node v22.18}/readline/promises.d.ts +1 -2
- {node v22.15 → node v22.18}/repl.d.ts +3 -5
- {node v22.15 → node v22.18}/sqlite.d.ts +212 -6
- {node v22.15 → node v22.18}/stream/consumers.d.ts +2 -2
- {node v22.15 → node v22.18}/stream/web.d.ts +8 -0
- {node v22.15 → node v22.18}/stream.d.ts +29 -33
- {node v22.15 → node v22.18}/string_decoder.d.ts +2 -2
- node v22.18/test.d.ts +2162 -0
- {node v22.15 → node v22.18}/tls.d.ts +90 -66
- {node v22.15 → node v22.18}/ts5.6/buffer.buffer.d.ts +10 -2
- node v22.18/ts5.6/globals.typedarray.d.ts +34 -0
- {node v22.15 → node v22.18}/ts5.6/index.d.ts +7 -3
- {node v22.15 → node v22.18}/url.d.ts +13 -4
- {node v22.15 → node v22.18}/util.d.ts +21 -6
- {node v22.15 → node v22.18}/v8.d.ts +33 -35
- {node v22.15 → node v22.18}/vm.d.ts +21 -50
- {node v22.15 → node v22.18}/wasi.d.ts +1 -1
- node v22.18/web-globals/abortcontroller.d.ts +34 -0
- node v22.18/web-globals/domexception.d.ts +68 -0
- node v22.15/dom-events.d.ts → node v22.18/web-globals/events.d.ts +49 -51
- node v22.18/web-globals/fetch.d.ts +46 -0
- node v22.18/web-globals/navigator.d.ts +22 -0
- node v22.18/web-globals/storage.d.ts +24 -0
- {node v22.15 → node v22.18}/worker_threads.d.ts +86 -67
- {node v22.15 → node v22.18}/zlib.d.ts +33 -26
- node v22.15/README.md +0 -15
- node v22.15/globals.d.ts +0 -364
- node v22.15/globals.typedarray.d.ts +0 -21
- node v22.15/test.d.ts +0 -2278
- node v22.15/ts5.6/globals.typedarray.d.ts +0 -19
- {node v22.15 → node v22.18}/LICENSE +0 -0
- {node v22.15 → node v22.18}/assert/strict.d.ts +0 -0
- {node v22.15 → node v22.18}/async_hooks.d.ts +1 -1
- {node v22.15 → node v22.18}/compatibility/disposable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/index.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/indexable.d.ts +0 -0
- {node v22.15 → node v22.18}/compatibility/iterators.d.ts +0 -0
- {node v22.15 → node v22.18}/console.d.ts +0 -0
- {node v22.15 → node v22.18}/constants.d.ts +0 -0
- {node v22.15 → node v22.18}/diagnostics_channel.d.ts +0 -0
- {node v22.15 → node v22.18}/domain.d.ts +0 -0
- {node v22.15 → node v22.18}/path.d.ts +0 -0
- {node v22.15 → node v22.18}/punycode.d.ts +0 -0
- {node v22.15 → node v22.18}/querystring.d.ts +0 -0
- {node v22.15 → node v22.18}/readline.d.ts +0 -0
- {node v22.15 → node v22.18}/sea.d.ts +0 -0
- {node v22.15 → node v22.18}/stream/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers/promises.d.ts +0 -0
- {node v22.15 → node v22.18}/timers.d.ts +0 -0
- {node v22.15 → node v22.18}/trace_events.d.ts +0 -0
- {node v22.15 → node v22.18}/tty.d.ts +0 -0
node v22.18/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/node`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for node (https://nodejs.org/).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Tue, 28 Oct 2025 17:37:26 GMT
|
|
12
|
+
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
|
+
|
|
14
|
+
# Credits
|
|
15
|
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), and [René](https://github.com/Renegade334).
|
|
@@ -11,6 +11,25 @@ declare module "assert" {
|
|
|
11
11
|
*/
|
|
12
12
|
function assert(value: unknown, message?: string | Error): asserts value;
|
|
13
13
|
namespace assert {
|
|
14
|
+
type AssertMethodNames =
|
|
15
|
+
| "deepEqual"
|
|
16
|
+
| "deepStrictEqual"
|
|
17
|
+
| "doesNotMatch"
|
|
18
|
+
| "doesNotReject"
|
|
19
|
+
| "doesNotThrow"
|
|
20
|
+
| "equal"
|
|
21
|
+
| "fail"
|
|
22
|
+
| "ifError"
|
|
23
|
+
| "match"
|
|
24
|
+
| "notDeepEqual"
|
|
25
|
+
| "notDeepStrictEqual"
|
|
26
|
+
| "notEqual"
|
|
27
|
+
| "notStrictEqual"
|
|
28
|
+
| "ok"
|
|
29
|
+
| "partialDeepStrictEqual"
|
|
30
|
+
| "rejects"
|
|
31
|
+
| "strictEqual"
|
|
32
|
+
| "throws";
|
|
14
33
|
/**
|
|
15
34
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
|
16
35
|
*/
|
|
@@ -451,7 +451,16 @@ declare module "buffer" {
|
|
|
451
451
|
*/
|
|
452
452
|
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
|
|
453
453
|
}
|
|
454
|
+
// TODO: remove globals in future version
|
|
455
|
+
/**
|
|
456
|
+
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
|
457
|
+
* TypeScript versions earlier than 5.7.
|
|
458
|
+
*/
|
|
454
459
|
type NonSharedBuffer = Buffer<ArrayBuffer>;
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
|
462
|
+
* TypeScript versions earlier than 5.7.
|
|
463
|
+
*/
|
|
455
464
|
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
|
456
465
|
}
|
|
457
466
|
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
|
@@ -59,7 +59,7 @@ declare module "buffer" {
|
|
|
59
59
|
* @since v19.4.0, v18.14.0
|
|
60
60
|
* @param input The input to validate.
|
|
61
61
|
*/
|
|
62
|
-
export function isUtf8(input:
|
|
62
|
+
export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean;
|
|
63
63
|
/**
|
|
64
64
|
* This function returns `true` if `input` contains only valid ASCII-encoded data,
|
|
65
65
|
* including the case in which `input` is empty.
|
|
@@ -68,7 +68,7 @@ declare module "buffer" {
|
|
|
68
68
|
* @since v19.6.0, v18.15.0
|
|
69
69
|
* @param input The input to validate.
|
|
70
70
|
*/
|
|
71
|
-
export function isAscii(input:
|
|
71
|
+
export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean;
|
|
72
72
|
export let INSPECT_MAX_BYTES: number;
|
|
73
73
|
export const kMaxLength: number;
|
|
74
74
|
export const kStringMaxLength: number;
|
|
@@ -113,12 +113,15 @@ declare module "buffer" {
|
|
|
113
113
|
* @param fromEnc The current encoding.
|
|
114
114
|
* @param toEnc To target encoding.
|
|
115
115
|
*/
|
|
116
|
-
export function transcode(
|
|
116
|
+
export function transcode(
|
|
117
|
+
source: Uint8Array,
|
|
118
|
+
fromEnc: TranscodeEncoding,
|
|
119
|
+
toEnc: TranscodeEncoding,
|
|
120
|
+
): NonSharedBuffer;
|
|
117
121
|
/**
|
|
118
122
|
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
|
119
123
|
* a prior call to `URL.createObjectURL()`.
|
|
120
124
|
* @since v16.7.0
|
|
121
|
-
* @experimental
|
|
122
125
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
123
126
|
*/
|
|
124
127
|
export function resolveObjectURL(id: string): Blob | undefined;
|
|
@@ -140,7 +143,7 @@ declare module "buffer" {
|
|
|
140
143
|
type?: string | undefined;
|
|
141
144
|
}
|
|
142
145
|
/**
|
|
143
|
-
* A
|
|
146
|
+
* A `Blob` encapsulates immutable, raw data that can be safely shared across
|
|
144
147
|
* multiple worker threads.
|
|
145
148
|
* @since v15.7.0, v14.18.0
|
|
146
149
|
*/
|
|
@@ -331,7 +334,7 @@ declare module "buffer" {
|
|
|
331
334
|
* @return The number of bytes contained within `string`.
|
|
332
335
|
*/
|
|
333
336
|
byteLength(
|
|
334
|
-
string: string |
|
|
337
|
+
string: string | NodeJS.ArrayBufferView | ArrayBufferLike,
|
|
335
338
|
encoding?: BufferEncoding,
|
|
336
339
|
): number;
|
|
337
340
|
/**
|
|
@@ -1702,6 +1705,8 @@ declare module "buffer" {
|
|
|
1702
1705
|
* @return A reference to `buf`.
|
|
1703
1706
|
*/
|
|
1704
1707
|
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
|
1708
|
+
fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
|
|
1709
|
+
fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
|
|
1705
1710
|
/**
|
|
1706
1711
|
* If `value` is:
|
|
1707
1712
|
*
|
|
@@ -1771,6 +1776,7 @@ declare module "buffer" {
|
|
|
1771
1776
|
* @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
|
1772
1777
|
*/
|
|
1773
1778
|
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
1779
|
+
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1774
1780
|
/**
|
|
1775
1781
|
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
|
|
1776
1782
|
* rather than the first occurrence.
|
|
@@ -1839,6 +1845,7 @@ declare module "buffer" {
|
|
|
1839
1845
|
* @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
|
1840
1846
|
*/
|
|
1841
1847
|
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
1848
|
+
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
|
1842
1849
|
/**
|
|
1843
1850
|
* Equivalent to `buf.indexOf() !== -1`.
|
|
1844
1851
|
*
|
|
@@ -1869,6 +1876,7 @@ declare module "buffer" {
|
|
|
1869
1876
|
* @return `true` if `value` was found in `buf`, `false` otherwise.
|
|
1870
1877
|
*/
|
|
1871
1878
|
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
|
1879
|
+
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
|
1872
1880
|
}
|
|
1873
1881
|
var Buffer: BufferConstructor;
|
|
1874
1882
|
/**
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* the parent Node.js process and the spawned subprocess. These pipes have
|
|
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
|
-
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
|
27
|
+
* subprocess blocks, waiting for the pipe buffer to accept more data. This is
|
|
28
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
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js)
|
|
67
67
|
*/
|
|
68
68
|
declare module "child_process" {
|
|
69
|
-
import {
|
|
69
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
70
70
|
import { Abortable, EventEmitter } from "node:events";
|
|
71
71
|
import * as dgram from "node:dgram";
|
|
72
72
|
import * as net from "node:net";
|
|
73
|
-
import {
|
|
73
|
+
import { Readable, Stream, Writable } from "node:stream";
|
|
74
74
|
import { URL } from "node:url";
|
|
75
75
|
type Serializable = string | object | number | boolean | bigint;
|
|
76
76
|
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
|
@@ -140,7 +140,7 @@ declare module "child_process" {
|
|
|
140
140
|
* no IPC channel exists, this property is `undefined`.
|
|
141
141
|
* @since v7.1.0
|
|
142
142
|
*/
|
|
143
|
-
readonly channel?:
|
|
143
|
+
readonly channel?: Control | null;
|
|
144
144
|
/**
|
|
145
145
|
* A sparse array of pipes to the child process, corresponding with positions in
|
|
146
146
|
* the `stdio` option passed to {@link spawn} that have been set
|
|
@@ -613,6 +613,10 @@ declare module "child_process" {
|
|
|
613
613
|
Readable | Writable | null | undefined, // extra, no modification
|
|
614
614
|
];
|
|
615
615
|
}
|
|
616
|
+
interface Control extends EventEmitter {
|
|
617
|
+
ref(): void;
|
|
618
|
+
unref(): void;
|
|
619
|
+
}
|
|
616
620
|
interface MessageOptions {
|
|
617
621
|
keepOpen?: boolean | undefined;
|
|
618
622
|
}
|
|
@@ -887,18 +891,20 @@ declare module "child_process" {
|
|
|
887
891
|
signal?: AbortSignal | undefined;
|
|
888
892
|
maxBuffer?: number | undefined;
|
|
889
893
|
killSignal?: NodeJS.Signals | number | undefined;
|
|
894
|
+
encoding?: string | null | undefined;
|
|
890
895
|
}
|
|
891
896
|
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
|
892
|
-
encoding
|
|
897
|
+
encoding?: BufferEncoding | undefined;
|
|
893
898
|
}
|
|
894
899
|
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
|
895
|
-
encoding:
|
|
900
|
+
encoding: "buffer" | null; // specify `null`.
|
|
896
901
|
}
|
|
902
|
+
// TODO: Just Plain Wrong™ (see also nodejs/node#57392)
|
|
897
903
|
interface ExecException extends Error {
|
|
898
|
-
cmd?: string
|
|
899
|
-
killed?: boolean
|
|
900
|
-
code?: number
|
|
901
|
-
signal?: NodeJS.Signals
|
|
904
|
+
cmd?: string;
|
|
905
|
+
killed?: boolean;
|
|
906
|
+
code?: number;
|
|
907
|
+
signal?: NodeJS.Signals;
|
|
902
908
|
stdout?: string;
|
|
903
909
|
stderr?: string;
|
|
904
910
|
}
|
|
@@ -995,39 +1001,24 @@ declare module "child_process" {
|
|
|
995
1001
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
996
1002
|
function exec(
|
|
997
1003
|
command: string,
|
|
998
|
-
options:
|
|
999
|
-
|
|
1000
|
-
} & ExecOptions,
|
|
1001
|
-
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
|
1004
|
+
options: ExecOptionsWithBufferEncoding,
|
|
1005
|
+
callback?: (error: ExecException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
|
|
1002
1006
|
): ChildProcess;
|
|
1003
|
-
// `options` with well
|
|
1007
|
+
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
|
|
1004
1008
|
function exec(
|
|
1005
1009
|
command: string,
|
|
1006
|
-
options:
|
|
1007
|
-
encoding: BufferEncoding;
|
|
1008
|
-
} & ExecOptions,
|
|
1009
|
-
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
|
1010
|
-
): ChildProcess;
|
|
1011
|
-
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
1012
|
-
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
1013
|
-
function exec(
|
|
1014
|
-
command: string,
|
|
1015
|
-
options: {
|
|
1016
|
-
encoding: BufferEncoding;
|
|
1017
|
-
} & ExecOptions,
|
|
1018
|
-
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
1019
|
-
): ChildProcess;
|
|
1020
|
-
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
1021
|
-
function exec(
|
|
1022
|
-
command: string,
|
|
1023
|
-
options: ExecOptions,
|
|
1010
|
+
options: ExecOptionsWithStringEncoding,
|
|
1024
1011
|
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
|
1025
1012
|
): ChildProcess;
|
|
1026
1013
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
1027
1014
|
function exec(
|
|
1028
1015
|
command: string,
|
|
1029
|
-
options:
|
|
1030
|
-
callback?: (
|
|
1016
|
+
options: ExecOptions | undefined | null,
|
|
1017
|
+
callback?: (
|
|
1018
|
+
error: ExecException | null,
|
|
1019
|
+
stdout: string | NonSharedBuffer,
|
|
1020
|
+
stderr: string | NonSharedBuffer,
|
|
1021
|
+
) => void,
|
|
1031
1022
|
): ChildProcess;
|
|
1032
1023
|
interface PromiseWithChild<T> extends Promise<T> {
|
|
1033
1024
|
child: ChildProcess;
|
|
@@ -1039,35 +1030,24 @@ declare module "child_process" {
|
|
|
1039
1030
|
}>;
|
|
1040
1031
|
function __promisify__(
|
|
1041
1032
|
command: string,
|
|
1042
|
-
options:
|
|
1043
|
-
encoding: "buffer" | null;
|
|
1044
|
-
} & ExecOptions,
|
|
1045
|
-
): PromiseWithChild<{
|
|
1046
|
-
stdout: Buffer;
|
|
1047
|
-
stderr: Buffer;
|
|
1048
|
-
}>;
|
|
1049
|
-
function __promisify__(
|
|
1050
|
-
command: string,
|
|
1051
|
-
options: {
|
|
1052
|
-
encoding: BufferEncoding;
|
|
1053
|
-
} & ExecOptions,
|
|
1033
|
+
options: ExecOptionsWithBufferEncoding,
|
|
1054
1034
|
): PromiseWithChild<{
|
|
1055
|
-
stdout:
|
|
1056
|
-
stderr:
|
|
1035
|
+
stdout: NonSharedBuffer;
|
|
1036
|
+
stderr: NonSharedBuffer;
|
|
1057
1037
|
}>;
|
|
1058
1038
|
function __promisify__(
|
|
1059
1039
|
command: string,
|
|
1060
|
-
options:
|
|
1040
|
+
options: ExecOptionsWithStringEncoding,
|
|
1061
1041
|
): PromiseWithChild<{
|
|
1062
1042
|
stdout: string;
|
|
1063
1043
|
stderr: string;
|
|
1064
1044
|
}>;
|
|
1065
1045
|
function __promisify__(
|
|
1066
1046
|
command: string,
|
|
1067
|
-
options
|
|
1047
|
+
options: ExecOptions | undefined | null,
|
|
1068
1048
|
): PromiseWithChild<{
|
|
1069
|
-
stdout: string |
|
|
1070
|
-
stderr: string |
|
|
1049
|
+
stdout: string | NonSharedBuffer;
|
|
1050
|
+
stderr: string | NonSharedBuffer;
|
|
1071
1051
|
}>;
|
|
1072
1052
|
}
|
|
1073
1053
|
interface ExecFileOptions extends CommonOptions, Abortable {
|
|
@@ -1076,20 +1056,21 @@ declare module "child_process" {
|
|
|
1076
1056
|
windowsVerbatimArguments?: boolean | undefined;
|
|
1077
1057
|
shell?: boolean | string | undefined;
|
|
1078
1058
|
signal?: AbortSignal | undefined;
|
|
1059
|
+
encoding?: string | null | undefined;
|
|
1079
1060
|
}
|
|
1080
1061
|
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
|
1081
|
-
encoding
|
|
1062
|
+
encoding?: BufferEncoding | undefined;
|
|
1082
1063
|
}
|
|
1083
1064
|
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
|
1084
1065
|
encoding: "buffer" | null;
|
|
1085
1066
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1067
|
+
/** @deprecated Use `ExecFileOptions` instead. */
|
|
1068
|
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
|
|
1069
|
+
// TODO: execFile exceptions can take many forms... this accurately describes none of them
|
|
1089
1070
|
type ExecFileException =
|
|
1090
1071
|
& Omit<ExecException, "code">
|
|
1091
1072
|
& Omit<NodeJS.ErrnoException, "code">
|
|
1092
|
-
& { code?: string | number |
|
|
1073
|
+
& { code?: string | number | null };
|
|
1093
1074
|
/**
|
|
1094
1075
|
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
|
|
1095
1076
|
* executable `file` is spawned directly as a new process making it slightly more
|
|
@@ -1154,91 +1135,63 @@ declare module "child_process" {
|
|
|
1154
1135
|
* @param args List of string arguments.
|
|
1155
1136
|
* @param callback Called with the output when process terminates.
|
|
1156
1137
|
*/
|
|
1157
|
-
function execFile(file: string): ChildProcess;
|
|
1158
|
-
function execFile(
|
|
1159
|
-
file: string,
|
|
1160
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1161
|
-
): ChildProcess;
|
|
1162
|
-
function execFile(file: string, args?: readonly string[] | null): ChildProcess;
|
|
1163
|
-
function execFile(
|
|
1164
|
-
file: string,
|
|
1165
|
-
args: readonly string[] | undefined | null,
|
|
1166
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1167
|
-
): ChildProcess;
|
|
1168
1138
|
// no `options` definitely means stdout/stderr are `string`.
|
|
1169
1139
|
function execFile(
|
|
1170
1140
|
file: string,
|
|
1171
|
-
callback
|
|
1141
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1172
1142
|
): ChildProcess;
|
|
1173
1143
|
function execFile(
|
|
1174
1144
|
file: string,
|
|
1175
1145
|
args: readonly string[] | undefined | null,
|
|
1176
|
-
callback
|
|
1146
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1177
1147
|
): ChildProcess;
|
|
1178
1148
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
1179
1149
|
function execFile(
|
|
1180
1150
|
file: string,
|
|
1181
1151
|
options: ExecFileOptionsWithBufferEncoding,
|
|
1182
|
-
callback
|
|
1152
|
+
callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
|
|
1183
1153
|
): ChildProcess;
|
|
1184
1154
|
function execFile(
|
|
1185
1155
|
file: string,
|
|
1186
1156
|
args: readonly string[] | undefined | null,
|
|
1187
1157
|
options: ExecFileOptionsWithBufferEncoding,
|
|
1188
|
-
callback
|
|
1158
|
+
callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
|
|
1189
1159
|
): ChildProcess;
|
|
1190
|
-
// `options` with well
|
|
1160
|
+
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
|
|
1191
1161
|
function execFile(
|
|
1192
1162
|
file: string,
|
|
1193
1163
|
options: ExecFileOptionsWithStringEncoding,
|
|
1194
|
-
callback
|
|
1164
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1195
1165
|
): ChildProcess;
|
|
1196
1166
|
function execFile(
|
|
1197
1167
|
file: string,
|
|
1198
1168
|
args: readonly string[] | undefined | null,
|
|
1199
1169
|
options: ExecFileOptionsWithStringEncoding,
|
|
1200
|
-
callback
|
|
1201
|
-
): ChildProcess;
|
|
1202
|
-
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
1203
|
-
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
1204
|
-
function execFile(
|
|
1205
|
-
file: string,
|
|
1206
|
-
options: ExecFileOptionsWithOtherEncoding,
|
|
1207
|
-
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
1208
|
-
): ChildProcess;
|
|
1209
|
-
function execFile(
|
|
1210
|
-
file: string,
|
|
1211
|
-
args: readonly string[] | undefined | null,
|
|
1212
|
-
options: ExecFileOptionsWithOtherEncoding,
|
|
1213
|
-
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
1214
|
-
): ChildProcess;
|
|
1215
|
-
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
1216
|
-
function execFile(
|
|
1217
|
-
file: string,
|
|
1218
|
-
options: ExecFileOptions,
|
|
1219
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1220
|
-
): ChildProcess;
|
|
1221
|
-
function execFile(
|
|
1222
|
-
file: string,
|
|
1223
|
-
args: readonly string[] | undefined | null,
|
|
1224
|
-
options: ExecFileOptions,
|
|
1225
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1170
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1226
1171
|
): ChildProcess;
|
|
1227
1172
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
1228
1173
|
function execFile(
|
|
1229
1174
|
file: string,
|
|
1230
|
-
options:
|
|
1175
|
+
options: ExecFileOptions | undefined | null,
|
|
1231
1176
|
callback:
|
|
1232
|
-
| ((
|
|
1177
|
+
| ((
|
|
1178
|
+
error: ExecFileException | null,
|
|
1179
|
+
stdout: string | NonSharedBuffer,
|
|
1180
|
+
stderr: string | NonSharedBuffer,
|
|
1181
|
+
) => void)
|
|
1233
1182
|
| undefined
|
|
1234
1183
|
| null,
|
|
1235
1184
|
): ChildProcess;
|
|
1236
1185
|
function execFile(
|
|
1237
1186
|
file: string,
|
|
1238
1187
|
args: readonly string[] | undefined | null,
|
|
1239
|
-
options:
|
|
1188
|
+
options: ExecFileOptions | undefined | null,
|
|
1240
1189
|
callback:
|
|
1241
|
-
| ((
|
|
1190
|
+
| ((
|
|
1191
|
+
error: ExecFileException | null,
|
|
1192
|
+
stdout: string | NonSharedBuffer,
|
|
1193
|
+
stderr: string | NonSharedBuffer,
|
|
1194
|
+
) => void)
|
|
1242
1195
|
| undefined
|
|
1243
1196
|
| null,
|
|
1244
1197
|
): ChildProcess;
|
|
@@ -1258,16 +1211,16 @@ declare module "child_process" {
|
|
|
1258
1211
|
file: string,
|
|
1259
1212
|
options: ExecFileOptionsWithBufferEncoding,
|
|
1260
1213
|
): PromiseWithChild<{
|
|
1261
|
-
stdout:
|
|
1262
|
-
stderr:
|
|
1214
|
+
stdout: NonSharedBuffer;
|
|
1215
|
+
stderr: NonSharedBuffer;
|
|
1263
1216
|
}>;
|
|
1264
1217
|
function __promisify__(
|
|
1265
1218
|
file: string,
|
|
1266
1219
|
args: readonly string[] | undefined | null,
|
|
1267
1220
|
options: ExecFileOptionsWithBufferEncoding,
|
|
1268
1221
|
): PromiseWithChild<{
|
|
1269
|
-
stdout:
|
|
1270
|
-
stderr:
|
|
1222
|
+
stdout: NonSharedBuffer;
|
|
1223
|
+
stderr: NonSharedBuffer;
|
|
1271
1224
|
}>;
|
|
1272
1225
|
function __promisify__(
|
|
1273
1226
|
file: string,
|
|
@@ -1286,48 +1239,18 @@ declare module "child_process" {
|
|
|
1286
1239
|
}>;
|
|
1287
1240
|
function __promisify__(
|
|
1288
1241
|
file: string,
|
|
1289
|
-
options:
|
|
1242
|
+
options: ExecFileOptions | undefined | null,
|
|
1290
1243
|
): PromiseWithChild<{
|
|
1291
|
-
stdout: string |
|
|
1292
|
-
stderr: string |
|
|
1244
|
+
stdout: string | NonSharedBuffer;
|
|
1245
|
+
stderr: string | NonSharedBuffer;
|
|
1293
1246
|
}>;
|
|
1294
1247
|
function __promisify__(
|
|
1295
1248
|
file: string,
|
|
1296
1249
|
args: readonly string[] | undefined | null,
|
|
1297
|
-
options:
|
|
1250
|
+
options: ExecFileOptions | undefined | null,
|
|
1298
1251
|
): PromiseWithChild<{
|
|
1299
|
-
stdout: string |
|
|
1300
|
-
stderr: string |
|
|
1301
|
-
}>;
|
|
1302
|
-
function __promisify__(
|
|
1303
|
-
file: string,
|
|
1304
|
-
options: ExecFileOptions,
|
|
1305
|
-
): PromiseWithChild<{
|
|
1306
|
-
stdout: string;
|
|
1307
|
-
stderr: string;
|
|
1308
|
-
}>;
|
|
1309
|
-
function __promisify__(
|
|
1310
|
-
file: string,
|
|
1311
|
-
args: readonly string[] | undefined | null,
|
|
1312
|
-
options: ExecFileOptions,
|
|
1313
|
-
): PromiseWithChild<{
|
|
1314
|
-
stdout: string;
|
|
1315
|
-
stderr: string;
|
|
1316
|
-
}>;
|
|
1317
|
-
function __promisify__(
|
|
1318
|
-
file: string,
|
|
1319
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1320
|
-
): PromiseWithChild<{
|
|
1321
|
-
stdout: string | Buffer;
|
|
1322
|
-
stderr: string | Buffer;
|
|
1323
|
-
}>;
|
|
1324
|
-
function __promisify__(
|
|
1325
|
-
file: string,
|
|
1326
|
-
args: readonly string[] | undefined | null,
|
|
1327
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1328
|
-
): PromiseWithChild<{
|
|
1329
|
-
stdout: string | Buffer;
|
|
1330
|
-
stderr: string | Buffer;
|
|
1252
|
+
stdout: string | NonSharedBuffer;
|
|
1253
|
+
stderr: string | NonSharedBuffer;
|
|
1331
1254
|
}>;
|
|
1332
1255
|
}
|
|
1333
1256
|
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
|
@@ -1416,7 +1339,7 @@ declare module "child_process" {
|
|
|
1416
1339
|
stderr: T;
|
|
1417
1340
|
status: number | null;
|
|
1418
1341
|
signal: NodeJS.Signals | null;
|
|
1419
|
-
error?: Error
|
|
1342
|
+
error?: Error;
|
|
1420
1343
|
}
|
|
1421
1344
|
/**
|
|
1422
1345
|
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
|
|
@@ -1433,11 +1356,11 @@ declare module "child_process" {
|
|
|
1433
1356
|
* @param command The command to run.
|
|
1434
1357
|
* @param args List of string arguments.
|
|
1435
1358
|
*/
|
|
1436
|
-
function spawnSync(command: string): SpawnSyncReturns<
|
|
1359
|
+
function spawnSync(command: string): SpawnSyncReturns<NonSharedBuffer>;
|
|
1437
1360
|
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
|
1438
|
-
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<
|
|
1439
|
-
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string |
|
|
1440
|
-
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<
|
|
1361
|
+
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<NonSharedBuffer>;
|
|
1362
|
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | NonSharedBuffer>;
|
|
1363
|
+
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<NonSharedBuffer>;
|
|
1441
1364
|
function spawnSync(
|
|
1442
1365
|
command: string,
|
|
1443
1366
|
args: readonly string[],
|
|
@@ -1447,12 +1370,12 @@ declare module "child_process" {
|
|
|
1447
1370
|
command: string,
|
|
1448
1371
|
args: readonly string[],
|
|
1449
1372
|
options: SpawnSyncOptionsWithBufferEncoding,
|
|
1450
|
-
): SpawnSyncReturns<
|
|
1373
|
+
): SpawnSyncReturns<NonSharedBuffer>;
|
|
1451
1374
|
function spawnSync(
|
|
1452
1375
|
command: string,
|
|
1453
1376
|
args?: readonly string[],
|
|
1454
1377
|
options?: SpawnSyncOptions,
|
|
1455
|
-
): SpawnSyncReturns<string |
|
|
1378
|
+
): SpawnSyncReturns<string | NonSharedBuffer>;
|
|
1456
1379
|
interface CommonExecOptions extends CommonOptions {
|
|
1457
1380
|
input?: string | NodeJS.ArrayBufferView | undefined;
|
|
1458
1381
|
/**
|
|
@@ -1494,10 +1417,10 @@ declare module "child_process" {
|
|
|
1494
1417
|
* @param command The command to run.
|
|
1495
1418
|
* @return The stdout from the command.
|
|
1496
1419
|
*/
|
|
1497
|
-
function execSync(command: string):
|
|
1420
|
+
function execSync(command: string): NonSharedBuffer;
|
|
1498
1421
|
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
|
|
1499
|
-
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding):
|
|
1500
|
-
function execSync(command: string, options?: ExecSyncOptions): string |
|
|
1422
|
+
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): NonSharedBuffer;
|
|
1423
|
+
function execSync(command: string, options?: ExecSyncOptions): string | NonSharedBuffer;
|
|
1501
1424
|
interface ExecFileSyncOptions extends CommonExecOptions {
|
|
1502
1425
|
shell?: boolean | string | undefined;
|
|
1503
1426
|
}
|
|
@@ -1505,7 +1428,7 @@ declare module "child_process" {
|
|
|
1505
1428
|
encoding: BufferEncoding;
|
|
1506
1429
|
}
|
|
1507
1430
|
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
|
1508
|
-
encoding?: "buffer" | null; // specify `null`.
|
|
1431
|
+
encoding?: "buffer" | null | undefined; // specify `null`.
|
|
1509
1432
|
}
|
|
1510
1433
|
/**
|
|
1511
1434
|
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
|
|
@@ -1527,11 +1450,11 @@ declare module "child_process" {
|
|
|
1527
1450
|
* @param args List of string arguments.
|
|
1528
1451
|
* @return The stdout from the command.
|
|
1529
1452
|
*/
|
|
1530
|
-
function execFileSync(file: string):
|
|
1453
|
+
function execFileSync(file: string): NonSharedBuffer;
|
|
1531
1454
|
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
|
|
1532
|
-
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding):
|
|
1533
|
-
function execFileSync(file: string, options?: ExecFileSyncOptions): string |
|
|
1534
|
-
function execFileSync(file: string, args: readonly string[]):
|
|
1455
|
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): NonSharedBuffer;
|
|
1456
|
+
function execFileSync(file: string, options?: ExecFileSyncOptions): string | NonSharedBuffer;
|
|
1457
|
+
function execFileSync(file: string, args: readonly string[]): NonSharedBuffer;
|
|
1535
1458
|
function execFileSync(
|
|
1536
1459
|
file: string,
|
|
1537
1460
|
args: readonly string[],
|
|
@@ -1541,8 +1464,12 @@ declare module "child_process" {
|
|
|
1541
1464
|
file: string,
|
|
1542
1465
|
args: readonly string[],
|
|
1543
1466
|
options: ExecFileSyncOptionsWithBufferEncoding,
|
|
1544
|
-
):
|
|
1545
|
-
function execFileSync(
|
|
1467
|
+
): NonSharedBuffer;
|
|
1468
|
+
function execFileSync(
|
|
1469
|
+
file: string,
|
|
1470
|
+
args?: readonly string[],
|
|
1471
|
+
options?: ExecFileSyncOptions,
|
|
1472
|
+
): string | NonSharedBuffer;
|
|
1546
1473
|
}
|
|
1547
1474
|
declare module "node:child_process" {
|
|
1548
1475
|
export * from "child_process";
|
|
@@ -72,7 +72,7 @@ declare module "cluster" {
|
|
|
72
72
|
* String arguments passed to worker.
|
|
73
73
|
* @default process.argv.slice(2)
|
|
74
74
|
*/
|
|
75
|
-
args?: string[] | undefined;
|
|
75
|
+
args?: readonly string[] | undefined;
|
|
76
76
|
/**
|
|
77
77
|
* Whether or not to send output to parent's stdio.
|
|
78
78
|
* @default false
|
|
@@ -481,7 +481,7 @@ declare module "cluster" {
|
|
|
481
481
|
* ```
|
|
482
482
|
* @since v0.7.0
|
|
483
483
|
*/
|
|
484
|
-
readonly worker?: Worker
|
|
484
|
+
readonly worker?: Worker;
|
|
485
485
|
/**
|
|
486
486
|
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
|
487
487
|
*
|
|
@@ -497,7 +497,7 @@ declare module "cluster" {
|
|
|
497
497
|
* ```
|
|
498
498
|
* @since v0.7.0
|
|
499
499
|
*/
|
|
500
|
-
readonly workers?: NodeJS.Dict<Worker
|
|
500
|
+
readonly workers?: NodeJS.Dict<Worker>;
|
|
501
501
|
readonly SCHED_NONE: number;
|
|
502
502
|
readonly SCHED_RR: number;
|
|
503
503
|
/**
|
|
@@ -550,10 +550,9 @@ declare module "cluster" {
|
|
|
550
550
|
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
|
551
551
|
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
|
552
552
|
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
|
553
|
-
// the handle is a net.Socket or net.Server object, or undefined.
|
|
554
553
|
prependListener(
|
|
555
554
|
event: "message",
|
|
556
|
-
listener: (worker: Worker, message: any, handle
|
|
555
|
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
|
557
556
|
): this;
|
|
558
557
|
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
|
559
558
|
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|