@types/node 12.20.41 → 13.1.2
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 v12.20/LICENSE → node/LICENSE +21 -21
- node/README.md +16 -0
- node/assert.d.ts +50 -0
- node/async_hooks.d.ts +132 -0
- node/base.d.ts +41 -0
- node v12.20/buffer.d.ts → node/buffer.d.ts +1 -1
- node v12.20/child_process.d.ts → node/child_process.d.ts +111 -113
- node v12.20/cluster.d.ts → node/cluster.d.ts +25 -19
- node/console.d.ts +3 -0
- node/constants.d.ts +8 -0
- node/crypto.d.ts +615 -0
- node v12.20/dgram.d.ts → node/dgram.d.ts +48 -25
- node v12.20/dns.d.ts → node/dns.d.ts +6 -12
- node v12.20/domain.d.ts → node/domain.d.ts +2 -2
- node/events.d.ts +40 -0
- node v12.20/fs.d.ts → node/fs.d.ts +162 -262
- node v12.20/globals.d.ts → node/globals.d.ts +104 -260
- node v12.20/http.d.ts → node/http.d.ts +102 -177
- node v12.20/http2.d.ts → node/http2.d.ts +82 -87
- node/https.d.ts +53 -0
- node/index.d.ts +83 -0
- node v12.20/inspector.d.ts → node/inspector.d.ts +153 -159
- node/module.d.ts +20 -0
- node v12.20/net.d.ts → node/net.d.ts +37 -47
- node/os.d.ts +231 -0
- node v12.20/package.json → node/package.json +45 -9
- node/path.d.ts +153 -0
- node v12.20/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -31
- node v12.20/process.d.ts → node/process.d.ts +2 -2
- node/punycode.d.ts +12 -0
- node v12.20/querystring.d.ts → node/querystring.d.ts +5 -5
- node v12.20/readline.d.ts → node/readline.d.ts +16 -17
- node v12.20/repl.d.ts → node/repl.d.ts +24 -32
- node v12.20/stream.d.ts → node/stream.d.ts +33 -43
- node v12.20/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node v12.20/timers.d.ts → node/timers.d.ts +1 -1
- node v12.20/tls.d.ts → node/tls.d.ts +54 -65
- node v12.20/trace_events.d.ts → node/trace_events.d.ts +1 -1
- node/ts3.2/fs.d.ts +33 -0
- node/ts3.2/globals.d.ts +19 -0
- node/ts3.2/index.d.ts +16 -0
- node/ts3.2/util.d.ts +9 -0
- node v12.20/tty.d.ts → node/tty.d.ts +3 -3
- node v12.20/url.d.ts → node/url.d.ts +17 -24
- node v12.20/util.d.ts → node/util.d.ts +22 -37
- node v12.20/v8.d.ts → node/v8.d.ts +2 -12
- node v12.20/vm.d.ts → node/vm.d.ts +22 -24
- node v12.20/worker_threads.d.ts → node/worker_threads.d.ts +39 -85
- node v12.20/zlib.d.ts → node/zlib.d.ts +134 -138
- node v12.20/README.md +0 -16
- node v12.20/assert.d.ts +0 -117
- node v12.20/async_hooks.d.ts +0 -246
- node v12.20/console.d.ts +0 -3
- node v12.20/constants.d.ts +0 -448
- node v12.20/crypto.d.ts +0 -1159
- node v12.20/events.d.ts +0 -47
- node v12.20/globals.global.d.ts +0 -1
- node v12.20/https.d.ts +0 -156
- node v12.20/index.d.ts +0 -91
- node v12.20/module.d.ts +0 -3
- node v12.20/os.d.ts +0 -263
- node v12.20/path.d.ts +0 -159
- node v12.20/punycode.d.ts +0 -75
- node v12.20/wasi.d.ts +0 -55
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import * as events from
|
|
3
|
-
import * as net from
|
|
4
|
-
import { Writable, Readable, Stream, Pipe } from
|
|
1
|
+
declare module "child_process" {
|
|
2
|
+
import * as events from "events";
|
|
3
|
+
import * as net from "net";
|
|
4
|
+
import { Writable, Readable, Stream, Pipe } from "stream";
|
|
5
|
+
|
|
6
|
+
type Serializable = string | object | number | boolean;
|
|
7
|
+
type SendHandle = net.Socket | net.Server;
|
|
5
8
|
|
|
6
9
|
interface ChildProcess extends events.EventEmitter {
|
|
7
10
|
stdin: Writable | null;
|
|
8
11
|
stdout: Readable | null;
|
|
9
12
|
stderr: Readable | null;
|
|
10
|
-
readonly channel?: Pipe | null
|
|
13
|
+
readonly channel?: Pipe | null;
|
|
11
14
|
readonly stdio: [
|
|
12
15
|
Writable | null, // stdin
|
|
13
16
|
Readable | null, // stdout
|
|
@@ -18,14 +21,10 @@ declare module 'child_process' {
|
|
|
18
21
|
readonly killed: boolean;
|
|
19
22
|
readonly pid: number;
|
|
20
23
|
readonly connected: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
kill(signal?: NodeJS.Signals | number): boolean;
|
|
26
|
-
send(message: any, callback?: (error: Error | null) => void): boolean;
|
|
27
|
-
send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean;
|
|
28
|
-
send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
|
24
|
+
kill(signal?: NodeJS.Signals | number): void;
|
|
25
|
+
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
|
26
|
+
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
|
27
|
+
send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
|
29
28
|
disconnect(): void;
|
|
30
29
|
unref(): void;
|
|
31
30
|
ref(): void;
|
|
@@ -44,42 +43,42 @@ declare module 'child_process' {
|
|
|
44
43
|
addListener(event: "disconnect", listener: () => void): this;
|
|
45
44
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
46
45
|
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
47
|
-
addListener(event: "message", listener: (message:
|
|
46
|
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
48
47
|
|
|
49
48
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
50
49
|
emit(event: "close", code: number, signal: NodeJS.Signals): boolean;
|
|
51
50
|
emit(event: "disconnect"): boolean;
|
|
52
51
|
emit(event: "error", err: Error): boolean;
|
|
53
52
|
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
|
54
|
-
emit(event: "message", message:
|
|
53
|
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
|
55
54
|
|
|
56
55
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
57
56
|
on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
|
|
58
57
|
on(event: "disconnect", listener: () => void): this;
|
|
59
58
|
on(event: "error", listener: (err: Error) => void): this;
|
|
60
59
|
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
61
|
-
on(event: "message", listener: (message:
|
|
60
|
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
62
61
|
|
|
63
62
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
64
63
|
once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
|
|
65
64
|
once(event: "disconnect", listener: () => void): this;
|
|
66
65
|
once(event: "error", listener: (err: Error) => void): this;
|
|
67
66
|
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
68
|
-
once(event: "message", listener: (message:
|
|
67
|
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
69
68
|
|
|
70
69
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
71
70
|
prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
|
|
72
71
|
prependListener(event: "disconnect", listener: () => void): this;
|
|
73
72
|
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
74
73
|
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
75
|
-
prependListener(event: "message", listener: (message:
|
|
74
|
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
76
75
|
|
|
77
76
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
78
77
|
prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
|
|
79
78
|
prependOnceListener(event: "disconnect", listener: () => void): this;
|
|
80
79
|
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
81
80
|
prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
|
82
|
-
prependOnceListener(event: "message", listener: (message:
|
|
81
|
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
// return this object when stdio option is undefined or not specified
|
|
@@ -115,39 +114,52 @@ declare module 'child_process' {
|
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
interface MessageOptions {
|
|
118
|
-
keepOpen?: boolean
|
|
117
|
+
keepOpen?: boolean;
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>;
|
|
122
121
|
|
|
122
|
+
type SerializationType = 'json' | 'advanced';
|
|
123
|
+
|
|
124
|
+
interface MessagingOptions {
|
|
125
|
+
/**
|
|
126
|
+
* Specify the kind of serialization used for sending messages between processes.
|
|
127
|
+
* @default 'json'
|
|
128
|
+
*/
|
|
129
|
+
serialization?: SerializationType;
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
interface ProcessEnvOptions {
|
|
124
|
-
uid?: number
|
|
125
|
-
gid?: number
|
|
126
|
-
cwd?: string
|
|
127
|
-
env?: NodeJS.ProcessEnv
|
|
133
|
+
uid?: number;
|
|
134
|
+
gid?: number;
|
|
135
|
+
cwd?: string;
|
|
136
|
+
env?: NodeJS.ProcessEnv;
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
interface CommonOptions extends ProcessEnvOptions {
|
|
131
140
|
/**
|
|
132
141
|
* @default true
|
|
133
142
|
*/
|
|
134
|
-
windowsHide?: boolean
|
|
143
|
+
windowsHide?: boolean;
|
|
135
144
|
/**
|
|
136
145
|
* @default 0
|
|
137
146
|
*/
|
|
138
|
-
timeout?: number
|
|
147
|
+
timeout?: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface CommonSpawnOptions extends CommonOptions, MessagingOptions {
|
|
151
|
+
argv0?: string;
|
|
152
|
+
stdio?: StdioOptions;
|
|
153
|
+
shell?: boolean | string;
|
|
154
|
+
windowsVerbatimArguments?: boolean;
|
|
139
155
|
}
|
|
140
156
|
|
|
141
|
-
interface SpawnOptions extends
|
|
142
|
-
|
|
143
|
-
stdio?: StdioOptions | undefined;
|
|
144
|
-
detached?: boolean | undefined;
|
|
145
|
-
shell?: boolean | string | undefined;
|
|
146
|
-
windowsVerbatimArguments?: boolean | undefined;
|
|
157
|
+
interface SpawnOptions extends CommonSpawnOptions {
|
|
158
|
+
detached?: boolean;
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
|
150
|
-
stdio?: 'pipe' | Array<null | undefined | 'pipe'
|
|
162
|
+
stdio?: 'pipe' | Array<null | undefined | 'pipe'>;
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
type StdioNull = 'inherit' | 'ignore' | Stream;
|
|
@@ -246,9 +258,9 @@ declare module 'child_process' {
|
|
|
246
258
|
function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
|
|
247
259
|
|
|
248
260
|
interface ExecOptions extends CommonOptions {
|
|
249
|
-
shell?: string
|
|
250
|
-
maxBuffer?: number
|
|
251
|
-
killSignal?: NodeJS.Signals | number
|
|
261
|
+
shell?: string;
|
|
262
|
+
maxBuffer?: number;
|
|
263
|
+
killSignal?: NodeJS.Signals | number;
|
|
252
264
|
}
|
|
253
265
|
|
|
254
266
|
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
|
@@ -260,10 +272,10 @@ declare module 'child_process' {
|
|
|
260
272
|
}
|
|
261
273
|
|
|
262
274
|
interface ExecException extends Error {
|
|
263
|
-
cmd?: string
|
|
264
|
-
killed?: boolean
|
|
265
|
-
code?: number
|
|
266
|
-
signal?: NodeJS.Signals
|
|
275
|
+
cmd?: string;
|
|
276
|
+
killed?: boolean;
|
|
277
|
+
code?: number;
|
|
278
|
+
signal?: NodeJS.Signals;
|
|
267
279
|
}
|
|
268
280
|
|
|
269
281
|
// no `options` definitely means stdout/stderr are `string`.
|
|
@@ -285,7 +297,7 @@ declare module 'child_process' {
|
|
|
285
297
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
286
298
|
function exec(
|
|
287
299
|
command: string,
|
|
288
|
-
options: ({ encoding?: string | null
|
|
300
|
+
options: ({ encoding?: string | null } & ExecOptions) | undefined | null,
|
|
289
301
|
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
|
290
302
|
): ChildProcess;
|
|
291
303
|
|
|
@@ -299,14 +311,14 @@ declare module 'child_process' {
|
|
|
299
311
|
function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
|
300
312
|
function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
301
313
|
function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
302
|
-
function __promisify__(command: string, options?: ({ encoding?: string | null
|
|
314
|
+
function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
303
315
|
}
|
|
304
316
|
|
|
305
317
|
interface ExecFileOptions extends CommonOptions {
|
|
306
|
-
maxBuffer?: number
|
|
307
|
-
killSignal?: NodeJS.Signals | number
|
|
308
|
-
windowsVerbatimArguments?: boolean
|
|
309
|
-
shell?: boolean | string
|
|
318
|
+
maxBuffer?: number;
|
|
319
|
+
killSignal?: NodeJS.Signals | number;
|
|
320
|
+
windowsVerbatimArguments?: boolean;
|
|
321
|
+
shell?: boolean | string;
|
|
310
322
|
}
|
|
311
323
|
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
|
312
324
|
encoding: BufferEncoding;
|
|
@@ -319,9 +331,9 @@ declare module 'child_process' {
|
|
|
319
331
|
}
|
|
320
332
|
|
|
321
333
|
function execFile(file: string): ChildProcess;
|
|
322
|
-
function execFile(file: string, options: ({ encoding?: string | null
|
|
334
|
+
function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
|
323
335
|
function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
|
324
|
-
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null
|
|
336
|
+
function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
|
325
337
|
|
|
326
338
|
// no `options` definitely means stdout/stderr are `string`.
|
|
327
339
|
function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
@@ -371,63 +383,51 @@ declare module 'child_process' {
|
|
|
371
383
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
|
372
384
|
function execFile(
|
|
373
385
|
file: string,
|
|
374
|
-
options: ({ encoding?: string | null
|
|
386
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
375
387
|
callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
|
376
388
|
): ChildProcess;
|
|
377
389
|
function execFile(
|
|
378
390
|
file: string,
|
|
379
391
|
args: ReadonlyArray<string> | undefined | null,
|
|
380
|
-
options: ({ encoding?: string | null
|
|
392
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
381
393
|
callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
|
382
394
|
): ChildProcess;
|
|
383
395
|
|
|
384
396
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
385
397
|
namespace execFile {
|
|
386
398
|
function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
387
|
-
function __promisify__(file: string, args:
|
|
399
|
+
function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
388
400
|
function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
|
389
|
-
function __promisify__(file: string, args:
|
|
401
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
|
390
402
|
function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
391
|
-
function __promisify__(file: string, args:
|
|
403
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
392
404
|
function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
393
|
-
function __promisify__(
|
|
394
|
-
file: string,
|
|
395
|
-
args: ReadonlyArray<string> | undefined | null,
|
|
396
|
-
options: ExecFileOptionsWithOtherEncoding,
|
|
397
|
-
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
405
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
398
406
|
function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
399
|
-
function __promisify__(file: string, args:
|
|
400
|
-
function __promisify__(
|
|
401
|
-
file: string,
|
|
402
|
-
options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null
|
|
403
|
-
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
407
|
+
function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
|
408
|
+
function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
404
409
|
function __promisify__(
|
|
405
410
|
file: string,
|
|
406
|
-
args:
|
|
407
|
-
options: ({ encoding?: string | null
|
|
411
|
+
args: string[] | undefined | null,
|
|
412
|
+
options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
|
|
408
413
|
): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
|
409
414
|
}
|
|
410
415
|
|
|
411
|
-
interface ForkOptions extends ProcessEnvOptions {
|
|
412
|
-
execPath?: string
|
|
413
|
-
execArgv?: string[]
|
|
414
|
-
silent?: boolean
|
|
415
|
-
stdio?: StdioOptions
|
|
416
|
-
detached?: boolean
|
|
417
|
-
windowsVerbatimArguments?: boolean
|
|
416
|
+
interface ForkOptions extends ProcessEnvOptions, MessagingOptions {
|
|
417
|
+
execPath?: string;
|
|
418
|
+
execArgv?: string[];
|
|
419
|
+
silent?: boolean;
|
|
420
|
+
stdio?: StdioOptions;
|
|
421
|
+
detached?: boolean;
|
|
422
|
+
windowsVerbatimArguments?: boolean;
|
|
418
423
|
}
|
|
419
|
-
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
|
420
424
|
function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
|
421
425
|
|
|
422
|
-
interface SpawnSyncOptions extends
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
maxBuffer?: number | undefined;
|
|
428
|
-
encoding?: string | undefined;
|
|
429
|
-
shell?: boolean | string | undefined;
|
|
430
|
-
windowsVerbatimArguments?: boolean | undefined;
|
|
426
|
+
interface SpawnSyncOptions extends CommonSpawnOptions {
|
|
427
|
+
input?: string | NodeJS.ArrayBufferView;
|
|
428
|
+
killSignal?: NodeJS.Signals | number;
|
|
429
|
+
maxBuffer?: number;
|
|
430
|
+
encoding?: string;
|
|
431
431
|
}
|
|
432
432
|
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
|
433
433
|
encoding: BufferEncoding;
|
|
@@ -437,29 +437,28 @@ declare module 'child_process' {
|
|
|
437
437
|
}
|
|
438
438
|
interface SpawnSyncReturns<T> {
|
|
439
439
|
pid: number;
|
|
440
|
-
output:
|
|
440
|
+
output: string[];
|
|
441
441
|
stdout: T;
|
|
442
442
|
stderr: T;
|
|
443
443
|
status: number | null;
|
|
444
444
|
signal: NodeJS.Signals | null;
|
|
445
|
-
error?: Error
|
|
445
|
+
error?: Error;
|
|
446
446
|
}
|
|
447
447
|
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
|
448
|
-
function spawnSync(command: string, options
|
|
449
|
-
function spawnSync(command: string, options
|
|
450
|
-
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<
|
|
451
|
-
function spawnSync(command: string, args
|
|
452
|
-
function spawnSync(command: string, args
|
|
453
|
-
function spawnSync(command: string, args
|
|
454
|
-
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
|
448
|
+
function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
|
449
|
+
function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
|
450
|
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
|
451
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
|
452
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
|
453
|
+
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
|
455
454
|
|
|
456
455
|
interface ExecSyncOptions extends CommonOptions {
|
|
457
|
-
input?: string | Uint8Array
|
|
458
|
-
stdio?: StdioOptions
|
|
459
|
-
shell?: string
|
|
460
|
-
killSignal?: NodeJS.Signals | number
|
|
461
|
-
maxBuffer?: number
|
|
462
|
-
encoding?: string
|
|
456
|
+
input?: string | Uint8Array;
|
|
457
|
+
stdio?: StdioOptions;
|
|
458
|
+
shell?: string;
|
|
459
|
+
killSignal?: NodeJS.Signals | number;
|
|
460
|
+
maxBuffer?: number;
|
|
461
|
+
encoding?: string;
|
|
463
462
|
}
|
|
464
463
|
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
|
465
464
|
encoding: BufferEncoding;
|
|
@@ -468,17 +467,17 @@ declare module 'child_process' {
|
|
|
468
467
|
encoding: string; // specify `null`.
|
|
469
468
|
}
|
|
470
469
|
function execSync(command: string): Buffer;
|
|
471
|
-
function execSync(command: string, options
|
|
472
|
-
function execSync(command: string, options
|
|
473
|
-
function execSync(command: string, options?: ExecSyncOptions):
|
|
470
|
+
function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
|
471
|
+
function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
|
472
|
+
function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
|
474
473
|
|
|
475
474
|
interface ExecFileSyncOptions extends CommonOptions {
|
|
476
|
-
input?: string | NodeJS.ArrayBufferView
|
|
477
|
-
stdio?: StdioOptions
|
|
478
|
-
killSignal?: NodeJS.Signals | number
|
|
479
|
-
maxBuffer?: number
|
|
480
|
-
encoding?: string
|
|
481
|
-
shell?: boolean | string
|
|
475
|
+
input?: string | NodeJS.ArrayBufferView;
|
|
476
|
+
stdio?: StdioOptions;
|
|
477
|
+
killSignal?: NodeJS.Signals | number;
|
|
478
|
+
maxBuffer?: number;
|
|
479
|
+
encoding?: string;
|
|
480
|
+
shell?: boolean | string;
|
|
482
481
|
}
|
|
483
482
|
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
|
484
483
|
encoding: BufferEncoding;
|
|
@@ -487,11 +486,10 @@ declare module 'child_process' {
|
|
|
487
486
|
encoding: string; // specify `null`.
|
|
488
487
|
}
|
|
489
488
|
function execFileSync(command: string): Buffer;
|
|
490
|
-
function execFileSync(command: string, options
|
|
491
|
-
function execFileSync(command: string, options
|
|
492
|
-
function execFileSync(command: string, options?: ExecFileSyncOptions):
|
|
493
|
-
function execFileSync(command: string, args
|
|
494
|
-
function execFileSync(command: string, args
|
|
495
|
-
function execFileSync(command: string, args
|
|
496
|
-
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer;
|
|
489
|
+
function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
|
490
|
+
function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
|
491
|
+
function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
|
492
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
|
493
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
|
494
|
+
function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
|
497
495
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import * as child from
|
|
3
|
-
import
|
|
4
|
-
import * as net from
|
|
1
|
+
declare module "cluster" {
|
|
2
|
+
import * as child from "child_process";
|
|
3
|
+
import * as events from "events";
|
|
4
|
+
import * as net from "net";
|
|
5
5
|
|
|
6
6
|
// interfaces
|
|
7
7
|
interface ClusterSettings {
|
|
8
|
-
execArgv?: string[]
|
|
9
|
-
exec?: string
|
|
10
|
-
args?: string[]
|
|
11
|
-
silent?: boolean
|
|
12
|
-
stdio?: any[]
|
|
13
|
-
uid?: number
|
|
14
|
-
gid?: number
|
|
15
|
-
inspectPort?: number | (() => number)
|
|
8
|
+
execArgv?: string[]; // default: process.execArgv
|
|
9
|
+
exec?: string;
|
|
10
|
+
args?: string[];
|
|
11
|
+
silent?: boolean;
|
|
12
|
+
stdio?: any[];
|
|
13
|
+
uid?: number;
|
|
14
|
+
gid?: number;
|
|
15
|
+
inspectPort?: number | (() => number);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface Address {
|
|
@@ -21,10 +21,10 @@ declare module 'cluster' {
|
|
|
21
21
|
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
class Worker extends EventEmitter {
|
|
24
|
+
class Worker extends events.EventEmitter {
|
|
25
25
|
id: number;
|
|
26
26
|
process: child.ChildProcess;
|
|
27
|
-
send(message:
|
|
27
|
+
send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
|
28
28
|
kill(signal?: string): void;
|
|
29
29
|
destroy(signal?: string): void;
|
|
30
30
|
disconnect(): void;
|
|
@@ -90,19 +90,22 @@ declare module 'cluster' {
|
|
|
90
90
|
prependOnceListener(event: "online", listener: () => void): this;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
interface Cluster extends EventEmitter {
|
|
93
|
+
interface Cluster extends events.EventEmitter {
|
|
94
94
|
Worker: Worker;
|
|
95
95
|
disconnect(callback?: () => void): void;
|
|
96
96
|
fork(env?: any): Worker;
|
|
97
97
|
isMaster: boolean;
|
|
98
98
|
isWorker: boolean;
|
|
99
|
-
|
|
99
|
+
schedulingPolicy: number;
|
|
100
100
|
settings: ClusterSettings;
|
|
101
101
|
setupMaster(settings?: ClusterSettings): void;
|
|
102
|
-
worker?: Worker
|
|
102
|
+
worker?: Worker;
|
|
103
103
|
workers?: {
|
|
104
104
|
[index: string]: Worker | undefined
|
|
105
|
-
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
readonly SCHED_NONE: number;
|
|
108
|
+
readonly SCHED_RR: number;
|
|
106
109
|
|
|
107
110
|
/**
|
|
108
111
|
* events.EventEmitter
|
|
@@ -170,11 +173,14 @@ declare module 'cluster' {
|
|
|
170
173
|
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
|
171
174
|
}
|
|
172
175
|
|
|
176
|
+
const SCHED_NONE: number;
|
|
177
|
+
const SCHED_RR: number;
|
|
178
|
+
|
|
173
179
|
function disconnect(callback?: () => void): void;
|
|
174
180
|
function fork(env?: any): Worker;
|
|
175
181
|
const isMaster: boolean;
|
|
176
182
|
const isWorker: boolean;
|
|
177
|
-
|
|
183
|
+
let schedulingPolicy: number;
|
|
178
184
|
const settings: ClusterSettings;
|
|
179
185
|
function setupMaster(settings?: ClusterSettings): void;
|
|
180
186
|
const worker: Worker;
|
node/console.d.ts
ADDED
node/constants.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
|
2
|
+
declare module "constants" {
|
|
3
|
+
import { constants as osConstants, SignalConstants } from 'os';
|
|
4
|
+
import { constants as cryptoConstants } from 'crypto';
|
|
5
|
+
import { constants as fsConstants } from 'fs';
|
|
6
|
+
const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants;
|
|
7
|
+
export = exp;
|
|
8
|
+
}
|