@types/node 10.12.20 → 10.12.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +52 -0
- node/async_hooks.d.ts +144 -0
- node/buffer.d.ts +6 -0
- node/child_process.d.ts +358 -0
- node/cluster.d.ts +261 -0
- node/console.d.ts +3 -0
- node/constants.d.ts +279 -0
- node/crypto.d.ts +369 -0
- node/dgram.d.ts +97 -0
- node/dns.d.ts +292 -0
- node/domain.d.ts +16 -0
- node/events.d.ts +29 -0
- node/fs.d.ts +2272 -0
- node/globals.d.ts +1031 -0
- node/http.d.ts +247 -0
- node/http2.d.ts +861 -0
- node/https.d.ts +37 -0
- node/index.d.ts +40 -9186
- node/inspector.d.ts +0 -1
- node/module.d.ts +3 -0
- node/net.d.ts +251 -0
- node/os.d.ts +192 -0
- node/package.json +2 -2
- node/path.d.ts +159 -0
- node/perf_hooks.d.ts +241 -0
- node/process.d.ts +3 -0
- node/punycode.d.ts +12 -0
- node/querystring.d.ts +17 -0
- node/readline.d.ts +135 -0
- node/repl.d.ts +372 -0
- node/stream.d.ts +294 -0
- node/string_decoder.d.ts +9 -0
- node/timers.d.ts +16 -0
- node/tls.d.ts +371 -0
- node/trace_events.d.ts +61 -0
- node/tty.d.ts +15 -0
- node/url.d.ts +104 -0
- node/util.d.ts +173 -0
- node/v8.d.ts +28 -0
- node/vm.d.ts +64 -0
- node/worker_threads.d.ts +124 -0
- node/zlib.d.ts +141 -0
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js ( http://nodejs.org/ ).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
|
|
9
9
|
|
|
10
10
|
Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Fri, 01 Feb 2019 05:29:45 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
|
|
14
14
|
|
node/assert.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare module "assert" {
|
|
2
|
+
function internal(value: any, message?: string | Error): void;
|
|
3
|
+
namespace internal {
|
|
4
|
+
class AssertionError implements Error {
|
|
5
|
+
name: string;
|
|
6
|
+
message: string;
|
|
7
|
+
actual: any;
|
|
8
|
+
expected: any;
|
|
9
|
+
operator: string;
|
|
10
|
+
generatedMessage: boolean;
|
|
11
|
+
code: 'ERR_ASSERTION';
|
|
12
|
+
|
|
13
|
+
constructor(options?: {
|
|
14
|
+
message?: string; actual?: any; expected?: any;
|
|
15
|
+
operator?: string; stackStartFn?: Function
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function fail(message?: string | Error): never;
|
|
20
|
+
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
|
21
|
+
function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
|
|
22
|
+
function ok(value: any, message?: string | Error): void;
|
|
23
|
+
/** @deprecated since v9.9.0 - use strictEqual() instead. */
|
|
24
|
+
function equal(actual: any, expected: any, message?: string | Error): void;
|
|
25
|
+
/** @deprecated since v9.9.0 - use notStrictEqual() instead. */
|
|
26
|
+
function notEqual(actual: any, expected: any, message?: string | Error): void;
|
|
27
|
+
/** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
|
|
28
|
+
function deepEqual(actual: any, expected: any, message?: string | Error): void;
|
|
29
|
+
/** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
|
|
30
|
+
function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
|
|
31
|
+
function strictEqual(actual: any, expected: any, message?: string | Error): void;
|
|
32
|
+
function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
|
33
|
+
function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
|
34
|
+
function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
|
|
35
|
+
|
|
36
|
+
function throws(block: Function, message?: string | Error): void;
|
|
37
|
+
function throws(block: Function, error: RegExp | Function | Object | Error, message?: string | Error): void;
|
|
38
|
+
function doesNotThrow(block: Function, message?: string | Error): void;
|
|
39
|
+
function doesNotThrow(block: Function, error: RegExp | Function, message?: string | Error): void;
|
|
40
|
+
|
|
41
|
+
function ifError(value: any): void;
|
|
42
|
+
|
|
43
|
+
function rejects(block: Function | Promise<any>, message?: string | Error): Promise<void>;
|
|
44
|
+
function rejects(block: Function | Promise<any>, error: RegExp | Function | Object | Error, message?: string | Error): Promise<void>;
|
|
45
|
+
function doesNotReject(block: Function | Promise<any>, message?: string | Error): Promise<void>;
|
|
46
|
+
function doesNotReject(block: Function | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
|
|
47
|
+
|
|
48
|
+
const strict: typeof internal;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export = internal;
|
|
52
|
+
}
|
node/async_hooks.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async Hooks module: https://nodejs.org/api/async_hooks.html
|
|
3
|
+
*/
|
|
4
|
+
declare module "async_hooks" {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the asyncId of the current execution context.
|
|
7
|
+
*/
|
|
8
|
+
function executionAsyncId(): number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the ID of the resource responsible for calling the callback that is currently being executed.
|
|
12
|
+
*/
|
|
13
|
+
function triggerAsyncId(): number;
|
|
14
|
+
|
|
15
|
+
interface HookCallbacks {
|
|
16
|
+
/**
|
|
17
|
+
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
|
18
|
+
* @param asyncId a unique ID for the async resource
|
|
19
|
+
* @param type the type of the async resource
|
|
20
|
+
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
|
21
|
+
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
|
22
|
+
*/
|
|
23
|
+
init?(asyncId: number, type: string, triggerAsyncId: number, resource: Object): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
|
27
|
+
* The before callback is called just before said callback is executed.
|
|
28
|
+
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
|
29
|
+
*/
|
|
30
|
+
before?(asyncId: number): void;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Called immediately after the callback specified in before is completed.
|
|
34
|
+
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
|
35
|
+
*/
|
|
36
|
+
after?(asyncId: number): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Called when a promise has resolve() called. This may not be in the same execution id
|
|
40
|
+
* as the promise itself.
|
|
41
|
+
* @param asyncId the unique id for the promise that was resolve()d.
|
|
42
|
+
*/
|
|
43
|
+
promiseResolve?(asyncId: number): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Called after the resource corresponding to asyncId is destroyed
|
|
47
|
+
* @param asyncId a unique ID for the async resource
|
|
48
|
+
*/
|
|
49
|
+
destroy?(asyncId: number): void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface AsyncHook {
|
|
53
|
+
/**
|
|
54
|
+
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
|
55
|
+
*/
|
|
56
|
+
enable(): this;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
|
60
|
+
*/
|
|
61
|
+
disable(): this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Registers functions to be called for different lifetime events of each async operation.
|
|
66
|
+
* @param options the callbacks to register
|
|
67
|
+
* @return an AsyncHooks instance used for disabling and enabling hooks
|
|
68
|
+
*/
|
|
69
|
+
function createHook(options: HookCallbacks): AsyncHook;
|
|
70
|
+
|
|
71
|
+
interface AsyncResourceOptions {
|
|
72
|
+
/**
|
|
73
|
+
* The ID of the execution context that created this async event.
|
|
74
|
+
* Default: `executionAsyncId()`
|
|
75
|
+
*/
|
|
76
|
+
triggerAsyncId?: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Disables automatic `emitDestroy` when the object is garbage collected.
|
|
80
|
+
* This usually does not need to be set (even if `emitDestroy` is called
|
|
81
|
+
* manually), unless the resource's `asyncId` is retrieved and the
|
|
82
|
+
* sensitive API's `emitDestroy` is called with it.
|
|
83
|
+
* Default: `false`
|
|
84
|
+
*/
|
|
85
|
+
requireManualDestroy?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The class AsyncResource was designed to be extended by the embedder's async resources.
|
|
90
|
+
* Using this users can easily trigger the lifetime events of their own resources.
|
|
91
|
+
*/
|
|
92
|
+
class AsyncResource {
|
|
93
|
+
/**
|
|
94
|
+
* AsyncResource() is meant to be extended. Instantiating a
|
|
95
|
+
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
|
96
|
+
* async_hook.executionAsyncId() is used.
|
|
97
|
+
* @param type The type of async event.
|
|
98
|
+
* @param triggerAsyncId The ID of the execution context that created
|
|
99
|
+
* this async event (default: `executionAsyncId()`), or an
|
|
100
|
+
* AsyncResourceOptions object (since 9.3)
|
|
101
|
+
*/
|
|
102
|
+
constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Call AsyncHooks before callbacks.
|
|
106
|
+
* @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
|
|
107
|
+
*/
|
|
108
|
+
emitBefore(): void;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Call AsyncHooks after callbacks.
|
|
112
|
+
* @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
|
|
113
|
+
*/
|
|
114
|
+
emitAfter(): void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Call the provided function with the provided arguments in the
|
|
118
|
+
* execution context of the async resource. This will establish the
|
|
119
|
+
* context, trigger the AsyncHooks before callbacks, call the function,
|
|
120
|
+
* trigger the AsyncHooks after callbacks, and then restore the original
|
|
121
|
+
* execution context.
|
|
122
|
+
* @param fn The function to call in the execution context of this
|
|
123
|
+
* async resource.
|
|
124
|
+
* @param thisArg The receiver to be used for the function call.
|
|
125
|
+
* @param args Optional arguments to pass to the function.
|
|
126
|
+
*/
|
|
127
|
+
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Call AsyncHooks destroy callbacks.
|
|
131
|
+
*/
|
|
132
|
+
emitDestroy(): void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @return the unique ID assigned to this AsyncResource instance.
|
|
136
|
+
*/
|
|
137
|
+
asyncId(): number;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @return the trigger ID for this AsyncResource instance.
|
|
141
|
+
*/
|
|
142
|
+
triggerAsyncId(): number;
|
|
143
|
+
}
|
|
144
|
+
}
|
node/buffer.d.ts
ADDED
node/child_process.d.ts
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
declare module "child_process" {
|
|
2
|
+
import * as events from "events";
|
|
3
|
+
import * as stream from "stream";
|
|
4
|
+
import * as net from "net";
|
|
5
|
+
|
|
6
|
+
interface ChildProcess extends events.EventEmitter {
|
|
7
|
+
stdin: stream.Writable;
|
|
8
|
+
stdout: stream.Readable;
|
|
9
|
+
stderr: stream.Readable;
|
|
10
|
+
stdio: [stream.Writable, stream.Readable, stream.Readable];
|
|
11
|
+
killed: boolean;
|
|
12
|
+
pid: number;
|
|
13
|
+
kill(signal?: string): void;
|
|
14
|
+
send(message: any, callback?: (error: Error) => void): boolean;
|
|
15
|
+
send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error) => void): boolean;
|
|
16
|
+
send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error) => void): boolean;
|
|
17
|
+
connected: boolean;
|
|
18
|
+
disconnect(): void;
|
|
19
|
+
unref(): void;
|
|
20
|
+
ref(): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* events.EventEmitter
|
|
24
|
+
* 1. close
|
|
25
|
+
* 2. disconnect
|
|
26
|
+
* 3. error
|
|
27
|
+
* 4. exit
|
|
28
|
+
* 5. message
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
32
|
+
addListener(event: "close", listener: (code: number, signal: string) => void): this;
|
|
33
|
+
addListener(event: "disconnect", listener: () => void): this;
|
|
34
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
35
|
+
addListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
|
|
36
|
+
addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
|
|
37
|
+
|
|
38
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
39
|
+
emit(event: "close", code: number, signal: string): boolean;
|
|
40
|
+
emit(event: "disconnect"): boolean;
|
|
41
|
+
emit(event: "error", err: Error): boolean;
|
|
42
|
+
emit(event: "exit", code: number | null, signal: string | null): boolean;
|
|
43
|
+
emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean;
|
|
44
|
+
|
|
45
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
46
|
+
on(event: "close", listener: (code: number, signal: string) => void): this;
|
|
47
|
+
on(event: "disconnect", listener: () => void): this;
|
|
48
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
49
|
+
on(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
|
|
50
|
+
on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
|
|
51
|
+
|
|
52
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
53
|
+
once(event: "close", listener: (code: number, signal: string) => void): this;
|
|
54
|
+
once(event: "disconnect", listener: () => void): this;
|
|
55
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
56
|
+
once(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
|
|
57
|
+
once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
|
|
58
|
+
|
|
59
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
60
|
+
prependListener(event: "close", listener: (code: number, signal: string) => void): this;
|
|
61
|
+
prependListener(event: "disconnect", listener: () => void): this;
|
|
62
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
63
|
+
prependListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
|
|
64
|
+
prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
|
|
65
|
+
|
|
66
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
67
|
+
prependOnceListener(event: "close", listener: (code: number, signal: string) => void): this;
|
|
68
|
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
|
69
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
70
|
+
prependOnceListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this;
|
|
71
|
+
prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface MessageOptions {
|
|
75
|
+
keepOpen?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | stream.Stream | number | null | undefined)>;
|
|
79
|
+
|
|
80
|
+
interface SpawnOptions {
|
|
81
|
+
cwd?: string;
|
|
82
|
+
env?: NodeJS.ProcessEnv;
|
|
83
|
+
argv0?: string;
|
|
84
|
+
stdio?: StdioOptions;
|
|
85
|
+
detached?: boolean;
|
|
86
|
+
uid?: number;
|
|
87
|
+
gid?: number;
|
|
88
|
+
shell?: boolean | string;
|
|
89
|
+
windowsVerbatimArguments?: boolean;
|
|
90
|
+
windowsHide?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function spawn(command: string, options?: SpawnOptions): ChildProcess;
|
|
94
|
+
function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptions): ChildProcess;
|
|
95
|
+
|
|
96
|
+
interface ExecOptions {
|
|
97
|
+
cwd?: string;
|
|
98
|
+
env?: NodeJS.ProcessEnv;
|
|
99
|
+
shell?: string;
|
|
100
|
+
timeout?: number;
|
|
101
|
+
maxBuffer?: number;
|
|
102
|
+
killSignal?: string;
|
|
103
|
+
uid?: number;
|
|
104
|
+
gid?: number;
|
|
105
|
+
windowsHide?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
|
109
|
+
encoding: BufferEncoding;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
|
113
|
+
encoding: string | null; // specify `null`.
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface ExecException extends Error {
|
|
117
|
+
cmd?: string;
|
|
118
|
+
killed?: boolean;
|
|
119
|
+
code?: number;
|
|
120
|
+
signal?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// no `options` definitely means stdout/stderr are `string`.
|
|
124
|
+
function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
125
|
+
|
|
126
|
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
127
|
+
function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
|
128
|
+
|
|
129
|
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
|
130
|
+
function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
131
|
+
|
|
132
|
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
133
|
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
134
|
+
function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
|
|
135
|
+
|
|
136
|
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
137
|
+
function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
138
|
+
|
|
139
|
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
140
|
+
function exec(
|
|
141
|
+
command: string,
|
|
142
|
+
options: ({ encoding?: string | null } & ExecOptions) | undefined | null,
|
|
143
|
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
144
|
+
): ChildProcess;
|
|
145
|
+
|
|
146
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
147
|
+
namespace exec {
|
|
148
|
+
function __promisify__(command: string): Promise<{ stdout: string, stderr: string }>;
|
|
149
|
+
function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<{ stdout: Buffer, stderr: Buffer }>;
|
|
150
|
+
function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<{ stdout: string, stderr: string }>;
|
|
151
|
+
function __promisify__(command: string, options: ExecOptions): Promise<{ stdout: string, stderr: string }>;
|
|
152
|
+
function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface ExecFileOptions {
|
|
156
|
+
cwd?: string;
|
|
157
|
+
env?: NodeJS.ProcessEnv;
|
|
158
|
+
timeout?: number;
|
|
159
|
+
maxBuffer?: number;
|
|
160
|
+
killSignal?: string;
|
|
161
|
+
uid?: number;
|
|
162
|
+
gid?: number;
|
|
163
|
+
windowsHide?: boolean;
|
|
164
|
+
windowsVerbatimArguments?: boolean;
|
|
165
|
+
}
|
|
166
|
+
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
|
167
|
+
encoding: BufferEncoding;
|
|
168
|
+
}
|
|
169
|
+
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
|
170
|
+
encoding: 'buffer' | null;
|
|
171
|
+
}
|
|
172
|
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
|
173
|
+
encoding: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function execFile(file: string): ChildProcess;
|
|
177
|
+
function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
|
178
|
+
function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
|
179
|
+
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
|
180
|
+
|
|
181
|
+
// no `options` definitely means stdout/stderr are `string`.
|
|
182
|
+
function execFile(file: string, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
183
|
+
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
184
|
+
|
|
185
|
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
|
186
|
+
function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
|
187
|
+
function execFile(
|
|
188
|
+
file: string,
|
|
189
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
190
|
+
options: ExecFileOptionsWithBufferEncoding,
|
|
191
|
+
callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void,
|
|
192
|
+
): ChildProcess;
|
|
193
|
+
|
|
194
|
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
|
195
|
+
function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
196
|
+
function execFile(
|
|
197
|
+
file: string,
|
|
198
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
199
|
+
options: ExecFileOptionsWithStringEncoding,
|
|
200
|
+
callback: (error: Error | null, stdout: string, stderr: string) => void,
|
|
201
|
+
): ChildProcess;
|
|
202
|
+
|
|
203
|
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
|
204
|
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
|
205
|
+
function execFile(
|
|
206
|
+
file: string,
|
|
207
|
+
options: ExecFileOptionsWithOtherEncoding,
|
|
208
|
+
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
209
|
+
): ChildProcess;
|
|
210
|
+
function execFile(
|
|
211
|
+
file: string,
|
|
212
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
213
|
+
options: ExecFileOptionsWithOtherEncoding,
|
|
214
|
+
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
215
|
+
): ChildProcess;
|
|
216
|
+
|
|
217
|
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
|
218
|
+
function execFile(file: string, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
219
|
+
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
220
|
+
|
|
221
|
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
222
|
+
function execFile(
|
|
223
|
+
file: string,
|
|
224
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
225
|
+
callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
|
226
|
+
): ChildProcess;
|
|
227
|
+
function execFile(
|
|
228
|
+
file: string,
|
|
229
|
+
args: ReadonlyArray<string> | undefined | null,
|
|
230
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
231
|
+
callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
|
232
|
+
): ChildProcess;
|
|
233
|
+
|
|
234
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
235
|
+
namespace execFile {
|
|
236
|
+
function __promisify__(file: string): Promise<{ stdout: string, stderr: string }>;
|
|
237
|
+
function __promisify__(file: string, args: string[] | undefined | null): Promise<{ stdout: string, stderr: string }>;
|
|
238
|
+
function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
|
|
239
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
|
|
240
|
+
function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
|
|
241
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
|
|
242
|
+
function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
243
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
244
|
+
function __promisify__(file: string, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
|
|
245
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
|
|
246
|
+
function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
247
|
+
function __promisify__(
|
|
248
|
+
file: string,
|
|
249
|
+
args: string[] | undefined | null,
|
|
250
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
251
|
+
): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface ForkOptions {
|
|
255
|
+
cwd?: string;
|
|
256
|
+
env?: NodeJS.ProcessEnv;
|
|
257
|
+
execPath?: string;
|
|
258
|
+
execArgv?: string[];
|
|
259
|
+
silent?: boolean;
|
|
260
|
+
stdio?: StdioOptions;
|
|
261
|
+
windowsVerbatimArguments?: boolean;
|
|
262
|
+
uid?: number;
|
|
263
|
+
gid?: number;
|
|
264
|
+
}
|
|
265
|
+
function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
|
266
|
+
|
|
267
|
+
interface SpawnSyncOptions {
|
|
268
|
+
argv0?: string; // Not specified in the docs
|
|
269
|
+
cwd?: string;
|
|
270
|
+
input?: string | Buffer | NodeJS.TypedArray | DataView;
|
|
271
|
+
stdio?: StdioOptions;
|
|
272
|
+
env?: NodeJS.ProcessEnv;
|
|
273
|
+
uid?: number;
|
|
274
|
+
gid?: number;
|
|
275
|
+
timeout?: number;
|
|
276
|
+
killSignal?: string | number;
|
|
277
|
+
maxBuffer?: number;
|
|
278
|
+
encoding?: string;
|
|
279
|
+
shell?: boolean | string;
|
|
280
|
+
windowsVerbatimArguments?: boolean;
|
|
281
|
+
windowsHide?: boolean;
|
|
282
|
+
}
|
|
283
|
+
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
|
284
|
+
encoding: BufferEncoding;
|
|
285
|
+
}
|
|
286
|
+
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
|
287
|
+
encoding: string; // specify `null`.
|
|
288
|
+
}
|
|
289
|
+
interface SpawnSyncReturns<T> {
|
|
290
|
+
pid: number;
|
|
291
|
+
output: string[];
|
|
292
|
+
stdout: T;
|
|
293
|
+
stderr: T;
|
|
294
|
+
status: number;
|
|
295
|
+
signal: string;
|
|
296
|
+
error: Error;
|
|
297
|
+
}
|
|
298
|
+
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
|
299
|
+
function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
|
300
|
+
function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
|
301
|
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
|
302
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
|
303
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
|
304
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
|
305
|
+
|
|
306
|
+
interface ExecSyncOptions {
|
|
307
|
+
cwd?: string;
|
|
308
|
+
input?: string | Buffer | Uint8Array;
|
|
309
|
+
stdio?: StdioOptions;
|
|
310
|
+
env?: NodeJS.ProcessEnv;
|
|
311
|
+
shell?: string;
|
|
312
|
+
uid?: number;
|
|
313
|
+
gid?: number;
|
|
314
|
+
timeout?: number;
|
|
315
|
+
killSignal?: string | number;
|
|
316
|
+
maxBuffer?: number;
|
|
317
|
+
encoding?: string;
|
|
318
|
+
windowsHide?: boolean;
|
|
319
|
+
}
|
|
320
|
+
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
|
321
|
+
encoding: BufferEncoding;
|
|
322
|
+
}
|
|
323
|
+
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
|
324
|
+
encoding: string; // specify `null`.
|
|
325
|
+
}
|
|
326
|
+
function execSync(command: string): Buffer;
|
|
327
|
+
function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
|
328
|
+
function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
|
329
|
+
function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
|
330
|
+
|
|
331
|
+
interface ExecFileSyncOptions {
|
|
332
|
+
cwd?: string;
|
|
333
|
+
input?: string | Buffer | NodeJS.TypedArray | DataView;
|
|
334
|
+
stdio?: StdioOptions;
|
|
335
|
+
env?: NodeJS.ProcessEnv;
|
|
336
|
+
uid?: number;
|
|
337
|
+
gid?: number;
|
|
338
|
+
timeout?: number;
|
|
339
|
+
killSignal?: string | number;
|
|
340
|
+
maxBuffer?: number;
|
|
341
|
+
encoding?: string;
|
|
342
|
+
windowsHide?: boolean;
|
|
343
|
+
shell?: boolean | string;
|
|
344
|
+
}
|
|
345
|
+
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
|
346
|
+
encoding: BufferEncoding;
|
|
347
|
+
}
|
|
348
|
+
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
|
349
|
+
encoding: string; // specify `null`.
|
|
350
|
+
}
|
|
351
|
+
function execFileSync(command: string): Buffer;
|
|
352
|
+
function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
|
353
|
+
function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
|
354
|
+
function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
|
355
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
|
356
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
|
357
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
|
358
|
+
}
|