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