@types/node 18.17.18 → 18.17.19
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 v18.17/README.md +1 -1
- node v18.17/assert/strict.d.ts +4 -4
- node v18.17/assert.d.ts +48 -24
- node v18.17/async_hooks.d.ts +10 -7
- node v18.17/buffer.d.ts +32 -34
- node v18.17/child_process.d.ts +262 -122
- node v18.17/cluster.d.ts +107 -89
- node v18.17/console.d.ts +7 -7
- node v18.17/constants.d.ts +12 -11
- node v18.17/crypto.d.ts +746 -268
- node v18.17/dgram.d.ts +81 -45
- node v18.17/diagnostics_channel.d.ts +3 -3
- node v18.17/dns/promises.d.ts +28 -25
- node v18.17/dns.d.ts +203 -62
- node v18.17/dom-events.d.ts +67 -71
- node v18.17/domain.d.ts +4 -4
- node v18.17/events.d.ts +15 -7
- node v18.17/fs/promises.d.ts +102 -73
- node v18.17/fs.d.ts +513 -311
- node v18.17/globals.d.ts +16 -18
- node v18.17/http.d.ts +185 -185
- node v18.17/http2.d.ts +628 -376
- node v18.17/https.d.ts +107 -105
- node v18.17/module.d.ts +11 -8
- node v18.17/net.d.ts +112 -93
- node v18.17/os.d.ts +7 -7
- node v18.17/package.json +2 -2
- node v18.17/path.d.ts +13 -13
- node v18.17/perf_hooks.d.ts +20 -19
- node v18.17/process.d.ts +155 -125
- node v18.17/punycode.d.ts +3 -3
- node v18.17/querystring.d.ts +14 -4
- node v18.17/readline/promises.d.ts +5 -5
- node v18.17/readline.d.ts +69 -56
- node v18.17/repl.d.ts +67 -61
- node v18.17/stream/consumers.d.ts +4 -4
- node v18.17/stream/promises.d.ts +56 -15
- node v18.17/stream/web.d.ts +26 -20
- node v18.17/stream.d.ts +356 -226
- node v18.17/string_decoder.d.ts +3 -3
- node v18.17/test.d.ts +76 -91
- node v18.17/timers/promises.d.ts +4 -4
- node v18.17/timers.d.ts +23 -8
- node v18.17/tls.d.ts +151 -71
- node v18.17/trace_events.d.ts +3 -3
- node v18.17/ts4.8/assert/strict.d.ts +4 -4
- node v18.17/ts4.8/assert.d.ts +48 -24
- node v18.17/ts4.8/async_hooks.d.ts +10 -7
- node v18.17/ts4.8/buffer.d.ts +32 -34
- node v18.17/ts4.8/child_process.d.ts +262 -122
- node v18.17/ts4.8/cluster.d.ts +107 -89
- node v18.17/ts4.8/console.d.ts +7 -7
- node v18.17/ts4.8/constants.d.ts +12 -11
- node v18.17/ts4.8/crypto.d.ts +746 -268
- node v18.17/ts4.8/dgram.d.ts +81 -45
- node v18.17/ts4.8/diagnostics_channel.d.ts +3 -3
- node v18.17/ts4.8/dns/promises.d.ts +28 -25
- node v18.17/ts4.8/dns.d.ts +203 -62
- node v18.17/ts4.8/dom-events.d.ts +67 -71
- node v18.17/ts4.8/domain.d.ts +4 -4
- node v18.17/ts4.8/events.d.ts +15 -7
- node v18.17/ts4.8/fs/promises.d.ts +102 -73
- node v18.17/ts4.8/fs.d.ts +514 -312
- node v18.17/ts4.8/globals.d.ts +44 -46
- node v18.17/ts4.8/http.d.ts +185 -185
- node v18.17/ts4.8/http2.d.ts +628 -376
- node v18.17/ts4.8/https.d.ts +107 -105
- node v18.17/ts4.8/module.d.ts +11 -8
- node v18.17/ts4.8/net.d.ts +112 -93
- node v18.17/ts4.8/os.d.ts +7 -7
- node v18.17/ts4.8/path.d.ts +13 -13
- node v18.17/ts4.8/perf_hooks.d.ts +20 -19
- node v18.17/ts4.8/process.d.ts +155 -125
- node v18.17/ts4.8/punycode.d.ts +3 -3
- node v18.17/ts4.8/querystring.d.ts +14 -4
- node v18.17/ts4.8/readline/promises.d.ts +5 -5
- node v18.17/ts4.8/readline.d.ts +69 -56
- node v18.17/ts4.8/repl.d.ts +67 -61
- node v18.17/ts4.8/stream/consumers.d.ts +4 -4
- node v18.17/ts4.8/stream/promises.d.ts +56 -15
- node v18.17/ts4.8/stream/web.d.ts +26 -20
- node v18.17/ts4.8/stream.d.ts +321 -217
- node v18.17/ts4.8/string_decoder.d.ts +3 -3
- node v18.17/ts4.8/test.d.ts +75 -90
- node v18.17/ts4.8/timers/promises.d.ts +4 -4
- node v18.17/ts4.8/timers.d.ts +23 -8
- node v18.17/ts4.8/tls.d.ts +151 -71
- node v18.17/ts4.8/trace_events.d.ts +3 -3
- node v18.17/ts4.8/tty.d.ts +10 -10
- node v18.17/ts4.8/url.d.ts +26 -14
- node v18.17/ts4.8/util.d.ts +178 -117
- node v18.17/ts4.8/v8.d.ts +4 -4
- node v18.17/ts4.8/vm.d.ts +60 -42
- node v18.17/ts4.8/wasi.d.ts +3 -3
- node v18.17/ts4.8/worker_threads.d.ts +82 -85
- node v18.17/ts4.8/zlib.d.ts +9 -9
- node v18.17/tty.d.ts +10 -10
- node v18.17/url.d.ts +26 -14
- node v18.17/util.d.ts +178 -117
- node v18.17/v8.d.ts +4 -4
- node v18.17/vm.d.ts +60 -42
- node v18.17/wasi.d.ts +3 -3
- node v18.17/worker_threads.d.ts +82 -85
- node v18.17/zlib.d.ts +9 -9
node v18.17/child_process.d.ts
CHANGED
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
* stalling the event loop while spawned processes complete.
|
|
66
66
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
|
|
67
67
|
*/
|
|
68
|
-
declare module
|
|
69
|
-
import { ObjectEncodingOptions } from
|
|
70
|
-
import {
|
|
71
|
-
import * as net from
|
|
72
|
-
import {
|
|
73
|
-
import { URL } from
|
|
68
|
+
declare module "child_process" {
|
|
69
|
+
import { ObjectEncodingOptions } from "node:fs";
|
|
70
|
+
import { Abortable, EventEmitter } from "node:events";
|
|
71
|
+
import * as net from "node:net";
|
|
72
|
+
import { Pipe, Readable, Stream, Writable } from "node:stream";
|
|
73
|
+
import { URL } from "node:url";
|
|
74
74
|
type Serializable = string | object | number | boolean | bigint;
|
|
75
75
|
type SendHandle = net.Socket | net.Server;
|
|
76
76
|
/**
|
|
@@ -189,7 +189,7 @@ declare module 'child_process' {
|
|
|
189
189
|
// stderr
|
|
190
190
|
Readable | Writable | null | undefined,
|
|
191
191
|
// extra
|
|
192
|
-
Readable | Writable | null | undefined // extra
|
|
192
|
+
Readable | Writable | null | undefined, // extra
|
|
193
193
|
];
|
|
194
194
|
/**
|
|
195
195
|
* The `subprocess.killed` property indicates whether the child process
|
|
@@ -457,7 +457,12 @@ declare module 'child_process' {
|
|
|
457
457
|
*/
|
|
458
458
|
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
|
459
459
|
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
|
460
|
-
send(
|
|
460
|
+
send(
|
|
461
|
+
message: Serializable,
|
|
462
|
+
sendHandle?: SendHandle,
|
|
463
|
+
options?: MessageOptions,
|
|
464
|
+
callback?: (error: Error | null) => void,
|
|
465
|
+
): boolean;
|
|
461
466
|
/**
|
|
462
467
|
* Closes the IPC channel between parent and child, allowing the child to exit
|
|
463
468
|
* gracefully once there are no other connections keeping it alive. After calling
|
|
@@ -523,47 +528,53 @@ declare module 'child_process' {
|
|
|
523
528
|
* 6. spawn
|
|
524
529
|
*/
|
|
525
530
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
526
|
-
addListener(event:
|
|
527
|
-
addListener(event:
|
|
528
|
-
addListener(event:
|
|
529
|
-
addListener(event:
|
|
530
|
-
addListener(event:
|
|
531
|
-
addListener(event:
|
|
531
|
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
532
|
+
addListener(event: "disconnect", listener: () => void): this;
|
|
533
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
534
|
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
535
|
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
536
|
+
addListener(event: "spawn", listener: () => void): this;
|
|
532
537
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
533
|
-
emit(event:
|
|
534
|
-
emit(event:
|
|
535
|
-
emit(event:
|
|
536
|
-
emit(event:
|
|
537
|
-
emit(event:
|
|
538
|
-
emit(event:
|
|
538
|
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
|
539
|
+
emit(event: "disconnect"): boolean;
|
|
540
|
+
emit(event: "error", err: Error): boolean;
|
|
541
|
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
|
542
|
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
|
543
|
+
emit(event: "spawn", listener: () => void): boolean;
|
|
539
544
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
540
|
-
on(event:
|
|
541
|
-
on(event:
|
|
542
|
-
on(event:
|
|
543
|
-
on(event:
|
|
544
|
-
on(event:
|
|
545
|
-
on(event:
|
|
545
|
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
546
|
+
on(event: "disconnect", listener: () => void): this;
|
|
547
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
548
|
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
549
|
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
550
|
+
on(event: "spawn", listener: () => void): this;
|
|
546
551
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
547
|
-
once(event:
|
|
548
|
-
once(event:
|
|
549
|
-
once(event:
|
|
550
|
-
once(event:
|
|
551
|
-
once(event:
|
|
552
|
-
once(event:
|
|
552
|
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
553
|
+
once(event: "disconnect", listener: () => void): this;
|
|
554
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
555
|
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
556
|
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
557
|
+
once(event: "spawn", listener: () => void): this;
|
|
553
558
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
554
|
-
prependListener(event:
|
|
555
|
-
prependListener(event:
|
|
556
|
-
prependListener(event:
|
|
557
|
-
prependListener(event:
|
|
558
|
-
prependListener(event:
|
|
559
|
-
prependListener(event:
|
|
559
|
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
560
|
+
prependListener(event: "disconnect", listener: () => void): this;
|
|
561
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
562
|
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
563
|
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
564
|
+
prependListener(event: "spawn", listener: () => void): this;
|
|
560
565
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
561
|
-
prependOnceListener(
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
prependOnceListener(event:
|
|
566
|
-
prependOnceListener(event:
|
|
566
|
+
prependOnceListener(
|
|
567
|
+
event: "close",
|
|
568
|
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
|
569
|
+
): this;
|
|
570
|
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
|
571
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
572
|
+
prependOnceListener(
|
|
573
|
+
event: "exit",
|
|
574
|
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
|
575
|
+
): this;
|
|
576
|
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
577
|
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
|
567
578
|
}
|
|
568
579
|
// return this object when stdio option is undefined or not specified
|
|
569
580
|
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
|
@@ -577,11 +588,13 @@ declare module 'child_process' {
|
|
|
577
588
|
// stderr
|
|
578
589
|
Readable | Writable | null | undefined,
|
|
579
590
|
// extra, no modification
|
|
580
|
-
Readable | Writable | null | undefined // extra, no modification
|
|
591
|
+
Readable | Writable | null | undefined, // extra, no modification
|
|
581
592
|
];
|
|
582
593
|
}
|
|
583
594
|
// return this object when stdio option is a tuple of 3
|
|
584
|
-
interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
|
|
595
|
+
interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
|
|
596
|
+
extends ChildProcess
|
|
597
|
+
{
|
|
585
598
|
stdin: I;
|
|
586
599
|
stdout: O;
|
|
587
600
|
stderr: E;
|
|
@@ -591,15 +604,15 @@ declare module 'child_process' {
|
|
|
591
604
|
E,
|
|
592
605
|
Readable | Writable | null | undefined,
|
|
593
606
|
// extra, no modification
|
|
594
|
-
Readable | Writable | null | undefined // extra, no modification
|
|
607
|
+
Readable | Writable | null | undefined, // extra, no modification
|
|
595
608
|
];
|
|
596
609
|
}
|
|
597
610
|
interface MessageOptions {
|
|
598
611
|
keepOpen?: boolean | undefined;
|
|
599
612
|
}
|
|
600
|
-
type IOType =
|
|
601
|
-
type StdioOptions = IOType | Array<IOType |
|
|
602
|
-
type SerializationType =
|
|
613
|
+
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
|
614
|
+
type StdioOptions = IOType | Array<IOType | "ipc" | Stream | number | null | undefined>;
|
|
615
|
+
type SerializationType = "json" | "advanced";
|
|
603
616
|
interface MessagingOptions extends Abortable {
|
|
604
617
|
/**
|
|
605
618
|
* Specify the kind of serialization used for sending messages between processes.
|
|
@@ -653,10 +666,14 @@ declare module 'child_process' {
|
|
|
653
666
|
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
|
654
667
|
stdio?: StdioPipeNamed | StdioPipe[] | undefined;
|
|
655
668
|
}
|
|
656
|
-
type StdioNull =
|
|
657
|
-
type StdioPipeNamed =
|
|
669
|
+
type StdioNull = "inherit" | "ignore" | Stream;
|
|
670
|
+
type StdioPipeNamed = "pipe" | "overlapped";
|
|
658
671
|
type StdioPipe = undefined | null | StdioPipeNamed;
|
|
659
|
-
interface SpawnOptionsWithStdioTuple<
|
|
672
|
+
interface SpawnOptionsWithStdioTuple<
|
|
673
|
+
Stdin extends StdioNull | StdioPipe,
|
|
674
|
+
Stdout extends StdioNull | StdioPipe,
|
|
675
|
+
Stderr extends StdioNull | StdioPipe,
|
|
676
|
+
> extends SpawnOptions {
|
|
660
677
|
stdio: [Stdin, Stdout, Stderr];
|
|
661
678
|
}
|
|
662
679
|
/**
|
|
@@ -779,25 +796,85 @@ declare module 'child_process' {
|
|
|
779
796
|
* @param args List of string arguments.
|
|
780
797
|
*/
|
|
781
798
|
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
|
782
|
-
function spawn(
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
function spawn(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
799
|
+
function spawn(
|
|
800
|
+
command: string,
|
|
801
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
|
802
|
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
|
803
|
+
function spawn(
|
|
804
|
+
command: string,
|
|
805
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
|
806
|
+
): ChildProcessByStdio<Writable, Readable, null>;
|
|
807
|
+
function spawn(
|
|
808
|
+
command: string,
|
|
809
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
|
810
|
+
): ChildProcessByStdio<Writable, null, Readable>;
|
|
811
|
+
function spawn(
|
|
812
|
+
command: string,
|
|
813
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
|
814
|
+
): ChildProcessByStdio<null, Readable, Readable>;
|
|
815
|
+
function spawn(
|
|
816
|
+
command: string,
|
|
817
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
|
818
|
+
): ChildProcessByStdio<Writable, null, null>;
|
|
819
|
+
function spawn(
|
|
820
|
+
command: string,
|
|
821
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
|
822
|
+
): ChildProcessByStdio<null, Readable, null>;
|
|
823
|
+
function spawn(
|
|
824
|
+
command: string,
|
|
825
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
|
826
|
+
): ChildProcessByStdio<null, null, Readable>;
|
|
827
|
+
function spawn(
|
|
828
|
+
command: string,
|
|
829
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
|
830
|
+
): ChildProcessByStdio<null, null, null>;
|
|
790
831
|
function spawn(command: string, options: SpawnOptions): ChildProcess;
|
|
791
832
|
// overloads of spawn with 'args'
|
|
792
|
-
function spawn(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
function spawn(
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
833
|
+
function spawn(
|
|
834
|
+
command: string,
|
|
835
|
+
args?: ReadonlyArray<string>,
|
|
836
|
+
options?: SpawnOptionsWithoutStdio,
|
|
837
|
+
): ChildProcessWithoutNullStreams;
|
|
838
|
+
function spawn(
|
|
839
|
+
command: string,
|
|
840
|
+
args: ReadonlyArray<string>,
|
|
841
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
|
842
|
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
|
843
|
+
function spawn(
|
|
844
|
+
command: string,
|
|
845
|
+
args: ReadonlyArray<string>,
|
|
846
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
|
847
|
+
): ChildProcessByStdio<Writable, Readable, null>;
|
|
848
|
+
function spawn(
|
|
849
|
+
command: string,
|
|
850
|
+
args: ReadonlyArray<string>,
|
|
851
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
|
852
|
+
): ChildProcessByStdio<Writable, null, Readable>;
|
|
853
|
+
function spawn(
|
|
854
|
+
command: string,
|
|
855
|
+
args: ReadonlyArray<string>,
|
|
856
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
|
857
|
+
): ChildProcessByStdio<null, Readable, Readable>;
|
|
858
|
+
function spawn(
|
|
859
|
+
command: string,
|
|
860
|
+
args: ReadonlyArray<string>,
|
|
861
|
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
|
862
|
+
): ChildProcessByStdio<Writable, null, null>;
|
|
863
|
+
function spawn(
|
|
864
|
+
command: string,
|
|
865
|
+
args: ReadonlyArray<string>,
|
|
866
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
|
867
|
+
): ChildProcessByStdio<null, Readable, null>;
|
|
868
|
+
function spawn(
|
|
869
|
+
command: string,
|
|
870
|
+
args: ReadonlyArray<string>,
|
|
871
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
|
872
|
+
): ChildProcessByStdio<null, null, Readable>;
|
|
873
|
+
function spawn(
|
|
874
|
+
command: string,
|
|
875
|
+
args: ReadonlyArray<string>,
|
|
876
|
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
|
877
|
+
): ChildProcessByStdio<null, null, null>;
|
|
801
878
|
function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
|
|
802
879
|
interface ExecOptions extends CommonOptions {
|
|
803
880
|
shell?: string | undefined;
|
|
@@ -902,14 +979,17 @@ declare module 'child_process' {
|
|
|
902
979
|
* @param command The command to run, with space-separated arguments.
|
|
903
980
|
* @param callback called with the output when process terminates.
|
|
904
981
|
*/
|
|
905
|
-
function exec(
|
|
982
|
+
function exec(
|
|
983
|
+
command: string,
|
|
984
|
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
|
985
|
+
): ChildProcess;
|
|
906
986
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
907
987
|
function exec(
|
|
908
988
|
command: string,
|
|
909
989
|
options: {
|
|
910
|
-
encoding:
|
|
990
|
+
encoding: "buffer" | null;
|
|
911
991
|
} & ExecOptions,
|
|
912
|
-
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void
|
|
992
|
+
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
|
913
993
|
): ChildProcess;
|
|
914
994
|
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
|
915
995
|
function exec(
|
|
@@ -917,7 +997,7 @@ declare module 'child_process' {
|
|
|
917
997
|
options: {
|
|
918
998
|
encoding: BufferEncoding;
|
|
919
999
|
} & ExecOptions,
|
|
920
|
-
callback?: (error: ExecException | null, stdout: string, stderr: string) => void
|
|
1000
|
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
|
921
1001
|
): ChildProcess;
|
|
922
1002
|
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
923
1003
|
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
@@ -926,15 +1006,19 @@ declare module 'child_process' {
|
|
|
926
1006
|
options: {
|
|
927
1007
|
encoding: BufferEncoding;
|
|
928
1008
|
} & ExecOptions,
|
|
929
|
-
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void
|
|
1009
|
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
930
1010
|
): ChildProcess;
|
|
931
1011
|
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
932
|
-
function exec(
|
|
1012
|
+
function exec(
|
|
1013
|
+
command: string,
|
|
1014
|
+
options: ExecOptions,
|
|
1015
|
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
|
1016
|
+
): ChildProcess;
|
|
933
1017
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
934
1018
|
function exec(
|
|
935
1019
|
command: string,
|
|
936
1020
|
options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
|
|
937
|
-
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void
|
|
1021
|
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
938
1022
|
): ChildProcess;
|
|
939
1023
|
interface PromiseWithChild<T> extends Promise<T> {
|
|
940
1024
|
child: ChildProcess;
|
|
@@ -947,8 +1031,8 @@ declare module 'child_process' {
|
|
|
947
1031
|
function __promisify__(
|
|
948
1032
|
command: string,
|
|
949
1033
|
options: {
|
|
950
|
-
encoding:
|
|
951
|
-
} & ExecOptions
|
|
1034
|
+
encoding: "buffer" | null;
|
|
1035
|
+
} & ExecOptions,
|
|
952
1036
|
): PromiseWithChild<{
|
|
953
1037
|
stdout: Buffer;
|
|
954
1038
|
stderr: Buffer;
|
|
@@ -957,21 +1041,21 @@ declare module 'child_process' {
|
|
|
957
1041
|
command: string,
|
|
958
1042
|
options: {
|
|
959
1043
|
encoding: BufferEncoding;
|
|
960
|
-
} & ExecOptions
|
|
1044
|
+
} & ExecOptions,
|
|
961
1045
|
): PromiseWithChild<{
|
|
962
1046
|
stdout: string;
|
|
963
1047
|
stderr: string;
|
|
964
1048
|
}>;
|
|
965
1049
|
function __promisify__(
|
|
966
1050
|
command: string,
|
|
967
|
-
options: ExecOptions
|
|
1051
|
+
options: ExecOptions,
|
|
968
1052
|
): PromiseWithChild<{
|
|
969
1053
|
stdout: string;
|
|
970
1054
|
stderr: string;
|
|
971
1055
|
}>;
|
|
972
1056
|
function __promisify__(
|
|
973
1057
|
command: string,
|
|
974
|
-
options?: (ObjectEncodingOptions & ExecOptions) | null
|
|
1058
|
+
options?: (ObjectEncodingOptions & ExecOptions) | null,
|
|
975
1059
|
): PromiseWithChild<{
|
|
976
1060
|
stdout: string | Buffer;
|
|
977
1061
|
stderr: string | Buffer;
|
|
@@ -988,14 +1072,14 @@ declare module 'child_process' {
|
|
|
988
1072
|
encoding: BufferEncoding;
|
|
989
1073
|
}
|
|
990
1074
|
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
|
991
|
-
encoding:
|
|
1075
|
+
encoding: "buffer" | null;
|
|
992
1076
|
}
|
|
993
1077
|
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
|
994
1078
|
encoding: BufferEncoding;
|
|
995
1079
|
}
|
|
996
1080
|
type ExecFileException =
|
|
997
|
-
& Omit<ExecException,
|
|
998
|
-
& Omit<NodeJS.ErrnoException,
|
|
1081
|
+
& Omit<ExecException, "code">
|
|
1082
|
+
& Omit<NodeJS.ErrnoException, "code">
|
|
999
1083
|
& { code?: string | number | undefined | null };
|
|
1000
1084
|
/**
|
|
1001
1085
|
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
|
|
@@ -1061,56 +1145,92 @@ declare module 'child_process' {
|
|
|
1061
1145
|
* @param callback Called with the output when process terminates.
|
|
1062
1146
|
*/
|
|
1063
1147
|
function execFile(file: string): ChildProcess;
|
|
1064
|
-
function execFile(
|
|
1148
|
+
function execFile(
|
|
1149
|
+
file: string,
|
|
1150
|
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1151
|
+
): ChildProcess;
|
|
1065
1152
|
function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
|
1066
|
-
function execFile(
|
|
1153
|
+
function execFile(
|
|
1154
|
+
file: string,
|
|
1155
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
1156
|
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1157
|
+
): ChildProcess;
|
|
1067
1158
|
// no `options` definitely means stdout/stderr are `string`.
|
|
1068
|
-
function execFile(
|
|
1069
|
-
|
|
1159
|
+
function execFile(
|
|
1160
|
+
file: string,
|
|
1161
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1162
|
+
): ChildProcess;
|
|
1163
|
+
function execFile(
|
|
1164
|
+
file: string,
|
|
1165
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
1166
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1167
|
+
): ChildProcess;
|
|
1070
1168
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
1071
|
-
function execFile(
|
|
1169
|
+
function execFile(
|
|
1170
|
+
file: string,
|
|
1171
|
+
options: ExecFileOptionsWithBufferEncoding,
|
|
1172
|
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
|
1173
|
+
): ChildProcess;
|
|
1072
1174
|
function execFile(
|
|
1073
1175
|
file: string,
|
|
1074
1176
|
args: ReadonlyArray<string> | undefined | null,
|
|
1075
1177
|
options: ExecFileOptionsWithBufferEncoding,
|
|
1076
|
-
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void
|
|
1178
|
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
|
1077
1179
|
): ChildProcess;
|
|
1078
1180
|
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
|
1079
|
-
function execFile(
|
|
1181
|
+
function execFile(
|
|
1182
|
+
file: string,
|
|
1183
|
+
options: ExecFileOptionsWithStringEncoding,
|
|
1184
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1185
|
+
): ChildProcess;
|
|
1080
1186
|
function execFile(
|
|
1081
1187
|
file: string,
|
|
1082
1188
|
args: ReadonlyArray<string> | undefined | null,
|
|
1083
1189
|
options: ExecFileOptionsWithStringEncoding,
|
|
1084
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
|
|
1190
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1085
1191
|
): ChildProcess;
|
|
1086
1192
|
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
1087
1193
|
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
1088
|
-
function execFile(
|
|
1194
|
+
function execFile(
|
|
1195
|
+
file: string,
|
|
1196
|
+
options: ExecFileOptionsWithOtherEncoding,
|
|
1197
|
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
1198
|
+
): ChildProcess;
|
|
1089
1199
|
function execFile(
|
|
1090
1200
|
file: string,
|
|
1091
1201
|
args: ReadonlyArray<string> | undefined | null,
|
|
1092
1202
|
options: ExecFileOptionsWithOtherEncoding,
|
|
1093
|
-
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void
|
|
1203
|
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
1094
1204
|
): ChildProcess;
|
|
1095
1205
|
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
1096
|
-
function execFile(
|
|
1206
|
+
function execFile(
|
|
1207
|
+
file: string,
|
|
1208
|
+
options: ExecFileOptions,
|
|
1209
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1210
|
+
): ChildProcess;
|
|
1097
1211
|
function execFile(
|
|
1098
1212
|
file: string,
|
|
1099
1213
|
args: ReadonlyArray<string> | undefined | null,
|
|
1100
1214
|
options: ExecFileOptions,
|
|
1101
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
|
|
1215
|
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
|
1102
1216
|
): ChildProcess;
|
|
1103
1217
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
1104
1218
|
function execFile(
|
|
1105
1219
|
file: string,
|
|
1106
1220
|
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1107
|
-
callback:
|
|
1221
|
+
callback:
|
|
1222
|
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
|
1223
|
+
| undefined
|
|
1224
|
+
| null,
|
|
1108
1225
|
): ChildProcess;
|
|
1109
1226
|
function execFile(
|
|
1110
1227
|
file: string,
|
|
1111
1228
|
args: ReadonlyArray<string> | undefined | null,
|
|
1112
1229
|
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1113
|
-
callback:
|
|
1230
|
+
callback:
|
|
1231
|
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
|
1232
|
+
| undefined
|
|
1233
|
+
| null,
|
|
1114
1234
|
): ChildProcess;
|
|
1115
1235
|
namespace execFile {
|
|
1116
1236
|
function __promisify__(file: string): PromiseWithChild<{
|
|
@@ -1119,14 +1239,14 @@ declare module 'child_process' {
|
|
|
1119
1239
|
}>;
|
|
1120
1240
|
function __promisify__(
|
|
1121
1241
|
file: string,
|
|
1122
|
-
args: ReadonlyArray<string> | undefined | null
|
|
1242
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
1123
1243
|
): PromiseWithChild<{
|
|
1124
1244
|
stdout: string;
|
|
1125
1245
|
stderr: string;
|
|
1126
1246
|
}>;
|
|
1127
1247
|
function __promisify__(
|
|
1128
1248
|
file: string,
|
|
1129
|
-
options: ExecFileOptionsWithBufferEncoding
|
|
1249
|
+
options: ExecFileOptionsWithBufferEncoding,
|
|
1130
1250
|
): PromiseWithChild<{
|
|
1131
1251
|
stdout: Buffer;
|
|
1132
1252
|
stderr: Buffer;
|
|
@@ -1134,14 +1254,14 @@ declare module 'child_process' {
|
|
|
1134
1254
|
function __promisify__(
|
|
1135
1255
|
file: string,
|
|
1136
1256
|
args: ReadonlyArray<string> | undefined | null,
|
|
1137
|
-
options: ExecFileOptionsWithBufferEncoding
|
|
1257
|
+
options: ExecFileOptionsWithBufferEncoding,
|
|
1138
1258
|
): PromiseWithChild<{
|
|
1139
1259
|
stdout: Buffer;
|
|
1140
1260
|
stderr: Buffer;
|
|
1141
1261
|
}>;
|
|
1142
1262
|
function __promisify__(
|
|
1143
1263
|
file: string,
|
|
1144
|
-
options: ExecFileOptionsWithStringEncoding
|
|
1264
|
+
options: ExecFileOptionsWithStringEncoding,
|
|
1145
1265
|
): PromiseWithChild<{
|
|
1146
1266
|
stdout: string;
|
|
1147
1267
|
stderr: string;
|
|
@@ -1149,14 +1269,14 @@ declare module 'child_process' {
|
|
|
1149
1269
|
function __promisify__(
|
|
1150
1270
|
file: string,
|
|
1151
1271
|
args: ReadonlyArray<string> | undefined | null,
|
|
1152
|
-
options: ExecFileOptionsWithStringEncoding
|
|
1272
|
+
options: ExecFileOptionsWithStringEncoding,
|
|
1153
1273
|
): PromiseWithChild<{
|
|
1154
1274
|
stdout: string;
|
|
1155
1275
|
stderr: string;
|
|
1156
1276
|
}>;
|
|
1157
1277
|
function __promisify__(
|
|
1158
1278
|
file: string,
|
|
1159
|
-
options: ExecFileOptionsWithOtherEncoding
|
|
1279
|
+
options: ExecFileOptionsWithOtherEncoding,
|
|
1160
1280
|
): PromiseWithChild<{
|
|
1161
1281
|
stdout: string | Buffer;
|
|
1162
1282
|
stderr: string | Buffer;
|
|
@@ -1164,14 +1284,14 @@ declare module 'child_process' {
|
|
|
1164
1284
|
function __promisify__(
|
|
1165
1285
|
file: string,
|
|
1166
1286
|
args: ReadonlyArray<string> | undefined | null,
|
|
1167
|
-
options: ExecFileOptionsWithOtherEncoding
|
|
1287
|
+
options: ExecFileOptionsWithOtherEncoding,
|
|
1168
1288
|
): PromiseWithChild<{
|
|
1169
1289
|
stdout: string | Buffer;
|
|
1170
1290
|
stderr: string | Buffer;
|
|
1171
1291
|
}>;
|
|
1172
1292
|
function __promisify__(
|
|
1173
1293
|
file: string,
|
|
1174
|
-
options: ExecFileOptions
|
|
1294
|
+
options: ExecFileOptions,
|
|
1175
1295
|
): PromiseWithChild<{
|
|
1176
1296
|
stdout: string;
|
|
1177
1297
|
stderr: string;
|
|
@@ -1179,14 +1299,14 @@ declare module 'child_process' {
|
|
|
1179
1299
|
function __promisify__(
|
|
1180
1300
|
file: string,
|
|
1181
1301
|
args: ReadonlyArray<string> | undefined | null,
|
|
1182
|
-
options: ExecFileOptions
|
|
1302
|
+
options: ExecFileOptions,
|
|
1183
1303
|
): PromiseWithChild<{
|
|
1184
1304
|
stdout: string;
|
|
1185
1305
|
stderr: string;
|
|
1186
1306
|
}>;
|
|
1187
1307
|
function __promisify__(
|
|
1188
1308
|
file: string,
|
|
1189
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null
|
|
1309
|
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1190
1310
|
): PromiseWithChild<{
|
|
1191
1311
|
stdout: string | Buffer;
|
|
1192
1312
|
stderr: string | Buffer;
|
|
@@ -1194,7 +1314,7 @@ declare module 'child_process' {
|
|
|
1194
1314
|
function __promisify__(
|
|
1195
1315
|
file: string,
|
|
1196
1316
|
args: ReadonlyArray<string> | undefined | null,
|
|
1197
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null
|
|
1317
|
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
|
1198
1318
|
): PromiseWithChild<{
|
|
1199
1319
|
stdout: string | Buffer;
|
|
1200
1320
|
stderr: string | Buffer;
|
|
@@ -1271,13 +1391,13 @@ declare module 'child_process' {
|
|
|
1271
1391
|
interface SpawnSyncOptions extends CommonSpawnOptions {
|
|
1272
1392
|
input?: string | NodeJS.ArrayBufferView | undefined;
|
|
1273
1393
|
maxBuffer?: number | undefined;
|
|
1274
|
-
encoding?: BufferEncoding |
|
|
1394
|
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
|
1275
1395
|
}
|
|
1276
1396
|
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
|
1277
1397
|
encoding: BufferEncoding;
|
|
1278
1398
|
}
|
|
1279
1399
|
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
|
1280
|
-
encoding?:
|
|
1400
|
+
encoding?: "buffer" | null | undefined;
|
|
1281
1401
|
}
|
|
1282
1402
|
interface SpawnSyncReturns<T> {
|
|
1283
1403
|
pid: number;
|
|
@@ -1308,9 +1428,21 @@ declare module 'child_process' {
|
|
|
1308
1428
|
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
|
1309
1429
|
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
|
1310
1430
|
function spawnSync(command: string, args: ReadonlyArray<string>): SpawnSyncReturns<Buffer>;
|
|
1311
|
-
function spawnSync(
|
|
1312
|
-
|
|
1313
|
-
|
|
1431
|
+
function spawnSync(
|
|
1432
|
+
command: string,
|
|
1433
|
+
args: ReadonlyArray<string>,
|
|
1434
|
+
options: SpawnSyncOptionsWithStringEncoding,
|
|
1435
|
+
): SpawnSyncReturns<string>;
|
|
1436
|
+
function spawnSync(
|
|
1437
|
+
command: string,
|
|
1438
|
+
args: ReadonlyArray<string>,
|
|
1439
|
+
options: SpawnSyncOptionsWithBufferEncoding,
|
|
1440
|
+
): SpawnSyncReturns<Buffer>;
|
|
1441
|
+
function spawnSync(
|
|
1442
|
+
command: string,
|
|
1443
|
+
args?: ReadonlyArray<string>,
|
|
1444
|
+
options?: SpawnSyncOptions,
|
|
1445
|
+
): SpawnSyncReturns<string | Buffer>;
|
|
1314
1446
|
interface CommonExecOptions extends CommonOptions {
|
|
1315
1447
|
input?: string | NodeJS.ArrayBufferView | undefined;
|
|
1316
1448
|
/**
|
|
@@ -1325,7 +1457,7 @@ declare module 'child_process' {
|
|
|
1325
1457
|
stdio?: StdioOptions | undefined;
|
|
1326
1458
|
killSignal?: NodeJS.Signals | number | undefined;
|
|
1327
1459
|
maxBuffer?: number | undefined;
|
|
1328
|
-
encoding?: BufferEncoding |
|
|
1460
|
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
|
1329
1461
|
}
|
|
1330
1462
|
interface ExecSyncOptions extends CommonExecOptions {
|
|
1331
1463
|
shell?: string | undefined;
|
|
@@ -1334,7 +1466,7 @@ declare module 'child_process' {
|
|
|
1334
1466
|
encoding: BufferEncoding;
|
|
1335
1467
|
}
|
|
1336
1468
|
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
|
1337
|
-
encoding?:
|
|
1469
|
+
encoding?: "buffer" | null | undefined;
|
|
1338
1470
|
}
|
|
1339
1471
|
/**
|
|
1340
1472
|
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
|
|
@@ -1363,7 +1495,7 @@ declare module 'child_process' {
|
|
|
1363
1495
|
encoding: BufferEncoding;
|
|
1364
1496
|
}
|
|
1365
1497
|
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
|
1366
|
-
encoding?:
|
|
1498
|
+
encoding?: "buffer" | null; // specify `null`.
|
|
1367
1499
|
}
|
|
1368
1500
|
/**
|
|
1369
1501
|
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
|
|
@@ -1390,10 +1522,18 @@ declare module 'child_process' {
|
|
|
1390
1522
|
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
|
1391
1523
|
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
|
|
1392
1524
|
function execFileSync(file: string, args: ReadonlyArray<string>): Buffer;
|
|
1393
|
-
function execFileSync(
|
|
1394
|
-
|
|
1525
|
+
function execFileSync(
|
|
1526
|
+
file: string,
|
|
1527
|
+
args: ReadonlyArray<string>,
|
|
1528
|
+
options: ExecFileSyncOptionsWithStringEncoding,
|
|
1529
|
+
): string;
|
|
1530
|
+
function execFileSync(
|
|
1531
|
+
file: string,
|
|
1532
|
+
args: ReadonlyArray<string>,
|
|
1533
|
+
options: ExecFileSyncOptionsWithBufferEncoding,
|
|
1534
|
+
): Buffer;
|
|
1395
1535
|
function execFileSync(file: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer;
|
|
1396
1536
|
}
|
|
1397
|
-
declare module
|
|
1398
|
-
export * from
|
|
1537
|
+
declare module "node:child_process" {
|
|
1538
|
+
export * from "child_process";
|
|
1399
1539
|
}
|