@types/node 16.4.2 → 16.4.6
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 +2 -2
- node/assert/strict.d.ts +0 -1
- node/assert.d.ts +1352 -40
- node/async_hooks.d.ts +359 -90
- node/buffer.d.ts +1503 -78
- node/child_process.d.ts +1054 -233
- node/cluster.d.ts +320 -100
- node/console.d.ts +305 -32
- node/crypto.d.ts +3115 -739
- node/dgram.d.ts +446 -55
- node/diagnostics_channel.d.ts +85 -12
- node/dns/promises.d.ts +292 -36
- node/dns.d.ts +410 -97
- node/domain.d.ts +154 -10
- node/events.d.ts +377 -31
- node/fs/promises.d.ts +697 -273
- node/fs.d.ts +2257 -858
- node/http.d.ts +888 -80
- node/http2.d.ts +1525 -459
- node/https.d.ts +261 -11
- node/index.d.ts +25 -0
- node/inspector.d.ts +354 -661
- node/module.d.ts +49 -11
- node/net.d.ts +548 -140
- node/os.d.ts +236 -26
- node/package.json +7 -2
- node/path.d.ts +9 -5
- node/perf_hooks.d.ts +288 -90
- node/process.d.ts +1092 -153
- node/punycode.d.ts +65 -26
- node/querystring.d.ts +107 -8
- node/readline.d.ts +425 -79
- node/repl.d.ts +135 -110
- node/stream/promises.d.ts +15 -44
- node/stream.d.ts +927 -225
- node/string_decoder.d.ts +57 -1
- node/timers/promises.d.ts +97 -9
- node/timers.d.ts +29 -10
- node/tls.d.ts +444 -221
- node/trace_events.d.ts +107 -11
- node/tty.d.ts +163 -23
- node/url.d.ts +739 -29
- node/util.d.ts +1361 -73
- node/v8.d.ts +254 -78
- node/vm.d.ts +381 -33
- node/wasi.d.ts +107 -24
- node/worker_threads.d.ts +494 -131
- node/zlib.d.ts +215 -63
node/process.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
declare module 'process' {
|
|
2
2
|
import * as tty from 'node:tty';
|
|
3
3
|
import { Worker } from 'node:worker_threads';
|
|
4
|
-
|
|
5
4
|
global {
|
|
6
5
|
var process: NodeJS.Process;
|
|
7
|
-
|
|
8
6
|
namespace NodeJS {
|
|
9
7
|
// this namespace merge is here because these are specifically used
|
|
10
8
|
// as the type for process.stdin, process.stdout, and process.stderr.
|
|
11
9
|
// they can't live in tty.d.ts because we need to disambiguate the imported name.
|
|
12
10
|
interface ReadStream extends tty.ReadStream {}
|
|
13
11
|
interface WriteStream extends tty.WriteStream {}
|
|
14
|
-
|
|
15
12
|
interface MemoryUsageFn {
|
|
16
13
|
/**
|
|
17
14
|
* The `process.memoryUsage()` method iterate over each page to gather informations about memory
|
|
@@ -23,7 +20,6 @@ declare module 'process' {
|
|
|
23
20
|
*/
|
|
24
21
|
rss(): number;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
interface MemoryUsage {
|
|
28
24
|
rss: number;
|
|
29
25
|
heapTotal: number;
|
|
@@ -31,12 +27,10 @@ declare module 'process' {
|
|
|
31
27
|
external: number;
|
|
32
28
|
arrayBuffers: number;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
interface CpuUsage {
|
|
36
31
|
user: number;
|
|
37
32
|
system: number;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
interface ProcessRelease {
|
|
41
35
|
name: string;
|
|
42
36
|
sourceUrl?: string | undefined;
|
|
@@ -44,7 +38,6 @@ declare module 'process' {
|
|
|
44
38
|
libUrl?: string | undefined;
|
|
45
39
|
lts?: string | undefined;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
41
|
interface ProcessVersions extends Dict<string> {
|
|
49
42
|
http_parser: string;
|
|
50
43
|
node: string;
|
|
@@ -55,27 +48,46 @@ declare module 'process' {
|
|
|
55
48
|
modules: string;
|
|
56
49
|
openssl: string;
|
|
57
50
|
}
|
|
58
|
-
|
|
59
|
-
type Platform = 'aix'
|
|
60
|
-
| 'android'
|
|
61
|
-
| 'darwin'
|
|
62
|
-
| 'freebsd'
|
|
63
|
-
| 'haiku'
|
|
64
|
-
| 'linux'
|
|
65
|
-
| 'openbsd'
|
|
66
|
-
| 'sunos'
|
|
67
|
-
| 'win32'
|
|
68
|
-
| 'cygwin'
|
|
69
|
-
| 'netbsd';
|
|
70
|
-
|
|
51
|
+
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
|
71
52
|
type Signals =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
53
|
+
| 'SIGABRT'
|
|
54
|
+
| 'SIGALRM'
|
|
55
|
+
| 'SIGBUS'
|
|
56
|
+
| 'SIGCHLD'
|
|
57
|
+
| 'SIGCONT'
|
|
58
|
+
| 'SIGFPE'
|
|
59
|
+
| 'SIGHUP'
|
|
60
|
+
| 'SIGILL'
|
|
61
|
+
| 'SIGINT'
|
|
62
|
+
| 'SIGIO'
|
|
63
|
+
| 'SIGIOT'
|
|
64
|
+
| 'SIGKILL'
|
|
65
|
+
| 'SIGPIPE'
|
|
66
|
+
| 'SIGPOLL'
|
|
67
|
+
| 'SIGPROF'
|
|
68
|
+
| 'SIGPWR'
|
|
69
|
+
| 'SIGQUIT'
|
|
70
|
+
| 'SIGSEGV'
|
|
71
|
+
| 'SIGSTKFLT'
|
|
72
|
+
| 'SIGSTOP'
|
|
73
|
+
| 'SIGSYS'
|
|
74
|
+
| 'SIGTERM'
|
|
75
|
+
| 'SIGTRAP'
|
|
76
|
+
| 'SIGTSTP'
|
|
77
|
+
| 'SIGTTIN'
|
|
78
|
+
| 'SIGTTOU'
|
|
79
|
+
| 'SIGUNUSED'
|
|
80
|
+
| 'SIGURG'
|
|
81
|
+
| 'SIGUSR1'
|
|
82
|
+
| 'SIGUSR2'
|
|
83
|
+
| 'SIGVTALRM'
|
|
84
|
+
| 'SIGWINCH'
|
|
85
|
+
| 'SIGXCPU'
|
|
86
|
+
| 'SIGXFSZ'
|
|
87
|
+
| 'SIGBREAK'
|
|
88
|
+
| 'SIGLOST'
|
|
89
|
+
| 'SIGINFO';
|
|
77
90
|
type MultipleResolveType = 'resolve' | 'reject';
|
|
78
|
-
|
|
79
91
|
type BeforeExitListener = (code: number) => void;
|
|
80
92
|
type DisconnectListener = () => void;
|
|
81
93
|
type ExitListener = (code: number) => void;
|
|
@@ -87,11 +99,9 @@ declare module 'process' {
|
|
|
87
99
|
type SignalsListener = (signal: Signals) => void;
|
|
88
100
|
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<unknown>, value: unknown) => void;
|
|
89
101
|
type WorkerListener = (worker: Worker) => void;
|
|
90
|
-
|
|
91
102
|
interface Socket extends ReadWriteStream {
|
|
92
103
|
isTTY?: true | undefined;
|
|
93
104
|
}
|
|
94
|
-
|
|
95
105
|
// Alias for compatibility
|
|
96
106
|
interface ProcessEnv extends Dict<string> {
|
|
97
107
|
/**
|
|
@@ -99,12 +109,10 @@ declare module 'process' {
|
|
|
99
109
|
*/
|
|
100
110
|
TZ?: string;
|
|
101
111
|
}
|
|
102
|
-
|
|
103
112
|
interface HRTime {
|
|
104
113
|
(time?: [number, number]): [number, number];
|
|
105
114
|
bigint(): bigint;
|
|
106
115
|
}
|
|
107
|
-
|
|
108
116
|
interface ProcessReport {
|
|
109
117
|
/**
|
|
110
118
|
* Directory where the report is written.
|
|
@@ -112,7 +120,6 @@ declare module 'process' {
|
|
|
112
120
|
* @default '' indicating that reports are written to the current
|
|
113
121
|
*/
|
|
114
122
|
directory: string;
|
|
115
|
-
|
|
116
123
|
/**
|
|
117
124
|
* Filename where the report is written.
|
|
118
125
|
* The default value is the empty string.
|
|
@@ -120,39 +127,33 @@ declare module 'process' {
|
|
|
120
127
|
* PID, and sequence number.
|
|
121
128
|
*/
|
|
122
129
|
filename: string;
|
|
123
|
-
|
|
124
130
|
/**
|
|
125
131
|
* Returns a JSON-formatted diagnostic report for the running process.
|
|
126
132
|
* The report's JavaScript stack trace is taken from err, if present.
|
|
127
133
|
*/
|
|
128
134
|
getReport(err?: Error): string;
|
|
129
|
-
|
|
130
135
|
/**
|
|
131
136
|
* If true, a diagnostic report is generated on fatal errors,
|
|
132
137
|
* such as out of memory errors or failed C++ assertions.
|
|
133
138
|
* @default false
|
|
134
139
|
*/
|
|
135
140
|
reportOnFatalError: boolean;
|
|
136
|
-
|
|
137
141
|
/**
|
|
138
142
|
* If true, a diagnostic report is generated when the process
|
|
139
143
|
* receives the signal specified by process.report.signal.
|
|
140
144
|
* @defaul false
|
|
141
145
|
*/
|
|
142
146
|
reportOnSignal: boolean;
|
|
143
|
-
|
|
144
147
|
/**
|
|
145
148
|
* If true, a diagnostic report is generated on uncaught exception.
|
|
146
149
|
* @default false
|
|
147
150
|
*/
|
|
148
151
|
reportOnUncaughtException: boolean;
|
|
149
|
-
|
|
150
152
|
/**
|
|
151
153
|
* The signal used to trigger the creation of a diagnostic report.
|
|
152
154
|
* @default 'SIGUSR2'
|
|
153
155
|
*/
|
|
154
156
|
signal: Signals;
|
|
155
|
-
|
|
156
157
|
/**
|
|
157
158
|
* Writes a diagnostic report to a file. If filename is not provided, the default filename
|
|
158
159
|
* includes the date, time, PID, and a sequence number.
|
|
@@ -169,7 +170,6 @@ declare module 'process' {
|
|
|
169
170
|
writeReport(error?: Error): string;
|
|
170
171
|
writeReport(fileName?: string, err?: Error): string;
|
|
171
172
|
}
|
|
172
|
-
|
|
173
173
|
interface ResourceUsage {
|
|
174
174
|
fsRead: number;
|
|
175
175
|
fsWrite: number;
|
|
@@ -188,7 +188,6 @@ declare module 'process' {
|
|
|
188
188
|
userCPUTime: number;
|
|
189
189
|
voluntaryContextSwitches: number;
|
|
190
190
|
}
|
|
191
|
-
|
|
192
191
|
interface EmitWarningOptions {
|
|
193
192
|
/**
|
|
194
193
|
* When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
|
|
@@ -196,25 +195,21 @@ declare module 'process' {
|
|
|
196
195
|
* @default 'Warning'
|
|
197
196
|
*/
|
|
198
197
|
type?: string | undefined;
|
|
199
|
-
|
|
200
198
|
/**
|
|
201
199
|
* A unique identifier for the warning instance being emitted.
|
|
202
200
|
*/
|
|
203
201
|
code?: string | undefined;
|
|
204
|
-
|
|
205
202
|
/**
|
|
206
203
|
* When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
|
|
207
204
|
*
|
|
208
205
|
* @default process.emitWarning
|
|
209
206
|
*/
|
|
210
207
|
ctor?: Function | undefined;
|
|
211
|
-
|
|
212
208
|
/**
|
|
213
209
|
* Additional text to include with the error.
|
|
214
210
|
*/
|
|
215
211
|
detail?: string | undefined;
|
|
216
212
|
}
|
|
217
|
-
|
|
218
213
|
interface ProcessConfig {
|
|
219
214
|
readonly target_defaults: {
|
|
220
215
|
readonly cflags: any[];
|
|
@@ -241,77 +236,920 @@ declare module 'process' {
|
|
|
241
236
|
readonly visibility: string;
|
|
242
237
|
};
|
|
243
238
|
}
|
|
244
|
-
|
|
245
239
|
interface Process extends EventEmitter {
|
|
246
240
|
/**
|
|
247
|
-
*
|
|
241
|
+
* The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is
|
|
242
|
+
* a `Writable` stream.
|
|
243
|
+
*
|
|
244
|
+
* For example, to copy `process.stdin` to `process.stdout`:
|
|
245
|
+
*
|
|
246
|
+
* ```js
|
|
247
|
+
* process.stdin.pipe(process.stdout);
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
|
|
248
251
|
*/
|
|
249
252
|
stdout: WriteStream & {
|
|
250
253
|
fd: 1;
|
|
251
254
|
};
|
|
252
255
|
/**
|
|
253
|
-
*
|
|
256
|
+
* The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is
|
|
257
|
+
* a `Writable` stream.
|
|
258
|
+
*
|
|
259
|
+
* `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
|
|
254
260
|
*/
|
|
255
261
|
stderr: WriteStream & {
|
|
256
262
|
fd: 2;
|
|
257
263
|
};
|
|
264
|
+
/**
|
|
265
|
+
* The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is
|
|
266
|
+
* a `Readable` stream.
|
|
267
|
+
*
|
|
268
|
+
* For details of how to read from `stdin` see `readable.read()`.
|
|
269
|
+
*
|
|
270
|
+
* As a `Duplex` stream, `process.stdin` can also be used in "old" mode that
|
|
271
|
+
* is compatible with scripts written for Node.js prior to v0.10\.
|
|
272
|
+
* For more information see `Stream compatibility`.
|
|
273
|
+
*
|
|
274
|
+
* In "old" streams mode the `stdin` stream is paused by default, so one
|
|
275
|
+
* must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode.
|
|
276
|
+
*/
|
|
258
277
|
stdin: ReadStream & {
|
|
259
278
|
fd: 0;
|
|
260
279
|
};
|
|
261
280
|
openStdin(): Socket;
|
|
281
|
+
/**
|
|
282
|
+
* The `process.argv` property returns an array containing the command-line
|
|
283
|
+
* arguments passed when the Node.js process was launched. The first element will
|
|
284
|
+
* be {@link execPath}. See `process.argv0` if access to the original value
|
|
285
|
+
* of `argv[0]` is needed. The second element will be the path to the JavaScript
|
|
286
|
+
* file being executed. The remaining elements will be any additional command-line
|
|
287
|
+
* arguments.
|
|
288
|
+
*
|
|
289
|
+
* For example, assuming the following script for `process-args.js`:
|
|
290
|
+
*
|
|
291
|
+
* ```js
|
|
292
|
+
* // print process.argv
|
|
293
|
+
* process.argv.forEach((val, index) => {
|
|
294
|
+
* console.log(`${index}: ${val}`);
|
|
295
|
+
* });
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* Launching the Node.js process as:
|
|
299
|
+
*
|
|
300
|
+
* ```console
|
|
301
|
+
* $ node process-args.js one two=three four
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* Would generate the output:
|
|
305
|
+
*
|
|
306
|
+
* ```text
|
|
307
|
+
* 0: /usr/local/bin/node
|
|
308
|
+
* 1: /Users/mjr/work/node/process-args.js
|
|
309
|
+
* 2: one
|
|
310
|
+
* 3: two=three
|
|
311
|
+
* 4: four
|
|
312
|
+
* ```
|
|
313
|
+
* @since v0.1.27
|
|
314
|
+
*/
|
|
262
315
|
argv: string[];
|
|
316
|
+
/**
|
|
317
|
+
* The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts.
|
|
318
|
+
*
|
|
319
|
+
* ```console
|
|
320
|
+
* $ bash -c 'exec -a customArgv0 ./node'
|
|
321
|
+
* > process.argv[0]
|
|
322
|
+
* '/Volumes/code/external/node/out/Release/node'
|
|
323
|
+
* > process.argv0
|
|
324
|
+
* 'customArgv0'
|
|
325
|
+
* ```
|
|
326
|
+
* @since v6.4.0
|
|
327
|
+
*/
|
|
263
328
|
argv0: string;
|
|
329
|
+
/**
|
|
330
|
+
* The `process.execArgv` property returns the set of Node.js-specific command-line
|
|
331
|
+
* options passed when the Node.js process was launched. These options do not
|
|
332
|
+
* appear in the array returned by the {@link argv} property, and do not
|
|
333
|
+
* include the Node.js executable, the name of the script, or any options following
|
|
334
|
+
* the script name. These options are useful in order to spawn child processes with
|
|
335
|
+
* the same execution environment as the parent.
|
|
336
|
+
*
|
|
337
|
+
* ```console
|
|
338
|
+
* $ node --harmony script.js --version
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* Results in `process.execArgv`:
|
|
342
|
+
*
|
|
343
|
+
* ```js
|
|
344
|
+
* ['--harmony']
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* And `process.argv`:
|
|
348
|
+
*
|
|
349
|
+
* ```js
|
|
350
|
+
* ['/usr/local/bin/node', 'script.js', '--version']
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* Refer to `Worker constructor` for the detailed behavior of worker
|
|
354
|
+
* threads with this property.
|
|
355
|
+
* @since v0.7.7
|
|
356
|
+
*/
|
|
264
357
|
execArgv: string[];
|
|
358
|
+
/**
|
|
359
|
+
* The `process.execPath` property returns the absolute pathname of the executable
|
|
360
|
+
* that started the Node.js process. Symbolic links, if any, are resolved.
|
|
361
|
+
*
|
|
362
|
+
* ```js
|
|
363
|
+
* '/usr/local/bin/node'
|
|
364
|
+
* ```
|
|
365
|
+
* @since v0.1.100
|
|
366
|
+
*/
|
|
265
367
|
execPath: string;
|
|
368
|
+
/**
|
|
369
|
+
* The `process.abort()` method causes the Node.js process to exit immediately and
|
|
370
|
+
* generate a core file.
|
|
371
|
+
*
|
|
372
|
+
* This feature is not available in `Worker` threads.
|
|
373
|
+
* @since v0.7.0
|
|
374
|
+
*/
|
|
266
375
|
abort(): never;
|
|
376
|
+
/**
|
|
377
|
+
* The `process.chdir()` method changes the current working directory of the
|
|
378
|
+
* Node.js process or throws an exception if doing so fails (for instance, if
|
|
379
|
+
* the specified `directory` does not exist).
|
|
380
|
+
*
|
|
381
|
+
* ```js
|
|
382
|
+
* console.log(`Starting directory: ${process.cwd()}`);
|
|
383
|
+
* try {
|
|
384
|
+
* process.chdir('/tmp');
|
|
385
|
+
* console.log(`New directory: ${process.cwd()}`);
|
|
386
|
+
* } catch (err) {
|
|
387
|
+
* console.error(`chdir: ${err}`);
|
|
388
|
+
* }
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* This feature is not available in `Worker` threads.
|
|
392
|
+
* @since v0.1.17
|
|
393
|
+
*/
|
|
267
394
|
chdir(directory: string): void;
|
|
395
|
+
/**
|
|
396
|
+
* The `process.cwd()` method returns the current working directory of the Node.js
|
|
397
|
+
* process.
|
|
398
|
+
*
|
|
399
|
+
* ```js
|
|
400
|
+
* console.log(`Current directory: ${process.cwd()}`);
|
|
401
|
+
* ```
|
|
402
|
+
* @since v0.1.8
|
|
403
|
+
*/
|
|
268
404
|
cwd(): string;
|
|
405
|
+
/**
|
|
406
|
+
* The port used by the Node.js debugger when enabled.
|
|
407
|
+
*
|
|
408
|
+
* ```js
|
|
409
|
+
* process.debugPort = 5858;
|
|
410
|
+
* ```
|
|
411
|
+
* @since v0.7.2
|
|
412
|
+
*/
|
|
269
413
|
debugPort: number;
|
|
270
|
-
|
|
271
414
|
/**
|
|
272
|
-
* The `process.emitWarning()` method can be used to emit custom or application
|
|
415
|
+
* The `process.emitWarning()` method can be used to emit custom or application
|
|
416
|
+
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
|
|
417
|
+
*
|
|
418
|
+
* ```js
|
|
419
|
+
* // Emit a warning with a code and additional detail.
|
|
420
|
+
* process.emitWarning('Something happened!', {
|
|
421
|
+
* code: 'MY_WARNING',
|
|
422
|
+
* detail: 'This is some additional information'
|
|
423
|
+
* });
|
|
424
|
+
* // Emits:
|
|
425
|
+
* // (node:56338) [MY_WARNING] Warning: Something happened!
|
|
426
|
+
* // This is some additional information
|
|
427
|
+
* ```
|
|
273
428
|
*
|
|
274
|
-
*
|
|
429
|
+
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
|
|
275
430
|
*
|
|
431
|
+
* ```js
|
|
432
|
+
* process.on('warning', (warning) => {
|
|
433
|
+
* console.warn(warning.name); // 'Warning'
|
|
434
|
+
* console.warn(warning.message); // 'Something happened!'
|
|
435
|
+
* console.warn(warning.code); // 'MY_WARNING'
|
|
436
|
+
* console.warn(warning.stack); // Stack trace
|
|
437
|
+
* console.warn(warning.detail); // 'This is some additional information'
|
|
438
|
+
* });
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* If `warning` is passed as an `Error` object, the `options` argument is ignored.
|
|
442
|
+
* @since v8.0.0
|
|
276
443
|
* @param warning The warning to emit.
|
|
277
|
-
* @param type When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. Default: `'Warning'`.
|
|
278
|
-
* @param code A unique identifier for the warning instance being emitted.
|
|
279
|
-
* @param ctor When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. Default: `process.emitWarning`.
|
|
280
444
|
*/
|
|
281
445
|
emitWarning(warning: string | Error, ctor?: Function): void;
|
|
282
446
|
emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
|
|
283
447
|
emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
|
|
284
448
|
emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
|
|
285
|
-
|
|
449
|
+
/**
|
|
450
|
+
* The `process.env` property returns an object containing the user environment.
|
|
451
|
+
* See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).
|
|
452
|
+
*
|
|
453
|
+
* An example of this object looks like:
|
|
454
|
+
*
|
|
455
|
+
* ```js
|
|
456
|
+
* {
|
|
457
|
+
* TERM: 'xterm-256color',
|
|
458
|
+
* SHELL: '/usr/local/bin/bash',
|
|
459
|
+
* USER: 'maciej',
|
|
460
|
+
* PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
|
|
461
|
+
* PWD: '/Users/maciej',
|
|
462
|
+
* EDITOR: 'vim',
|
|
463
|
+
* SHLVL: '1',
|
|
464
|
+
* HOME: '/Users/maciej',
|
|
465
|
+
* LOGNAME: 'maciej',
|
|
466
|
+
* _: '/usr/local/bin/node'
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
469
|
+
*
|
|
470
|
+
* It is possible to modify this object, but such modifications will not be
|
|
471
|
+
* reflected outside the Node.js process, or (unless explicitly requested)
|
|
472
|
+
* to other `Worker` threads.
|
|
473
|
+
* In other words, the following example would not work:
|
|
474
|
+
*
|
|
475
|
+
* ```console
|
|
476
|
+
* $ node -e 'process.env.foo = "bar"' && echo $foo
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* While the following will:
|
|
480
|
+
*
|
|
481
|
+
* ```js
|
|
482
|
+
* process.env.foo = 'bar';
|
|
483
|
+
* console.log(process.env.foo);
|
|
484
|
+
* ```
|
|
485
|
+
*
|
|
486
|
+
* Assigning a property on `process.env` will implicitly convert the value
|
|
487
|
+
* to a string. **This behavior is deprecated.** Future versions of Node.js may
|
|
488
|
+
* throw an error when the value is not a string, number, or boolean.
|
|
489
|
+
*
|
|
490
|
+
* ```js
|
|
491
|
+
* process.env.test = null;
|
|
492
|
+
* console.log(process.env.test);
|
|
493
|
+
* // => 'null'
|
|
494
|
+
* process.env.test = undefined;
|
|
495
|
+
* console.log(process.env.test);
|
|
496
|
+
* // => 'undefined'
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* Use `delete` to delete a property from `process.env`.
|
|
500
|
+
*
|
|
501
|
+
* ```js
|
|
502
|
+
* process.env.TEST = 1;
|
|
503
|
+
* delete process.env.TEST;
|
|
504
|
+
* console.log(process.env.TEST);
|
|
505
|
+
* // => undefined
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* On Windows operating systems, environment variables are case-insensitive.
|
|
509
|
+
*
|
|
510
|
+
* ```js
|
|
511
|
+
* process.env.TEST = 1;
|
|
512
|
+
* console.log(process.env.test);
|
|
513
|
+
* // => 1
|
|
514
|
+
* ```
|
|
515
|
+
*
|
|
516
|
+
* Unless explicitly specified when creating a `Worker` instance,
|
|
517
|
+
* each `Worker` thread has its own copy of `process.env`, based on its
|
|
518
|
+
* parent thread’s `process.env`, or whatever was specified as the `env` option
|
|
519
|
+
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
520
|
+
* across `Worker` threads, and only the main thread can make changes that
|
|
521
|
+
* are visible to the operating system or to native add-ons.
|
|
522
|
+
* @since v0.1.27
|
|
523
|
+
*/
|
|
286
524
|
env: ProcessEnv;
|
|
525
|
+
/**
|
|
526
|
+
* The `process.exit()` method instructs Node.js to terminate the process
|
|
527
|
+
* synchronously with an exit status of `code`. If `code` is omitted, exit uses
|
|
528
|
+
* either the 'success' code `0` or the value of `process.exitCode` if it has been
|
|
529
|
+
* set. Node.js will not terminate until all the `'exit'` event listeners are
|
|
530
|
+
* called.
|
|
531
|
+
*
|
|
532
|
+
* To exit with a 'failure' code:
|
|
533
|
+
*
|
|
534
|
+
* ```js
|
|
535
|
+
* process.exit(1);
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* The shell that executed Node.js should see the exit code as `1`.
|
|
539
|
+
*
|
|
540
|
+
* Calling `process.exit()` will force the process to exit as quickly as possible
|
|
541
|
+
* even if there are still asynchronous operations pending that have not yet
|
|
542
|
+
* completed fully, including I/O operations to `process.stdout` and`process.stderr`.
|
|
543
|
+
*
|
|
544
|
+
* In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_
|
|
545
|
+
* _work pending_ in the event loop. The `process.exitCode` property can be set to
|
|
546
|
+
* tell the process which exit code to use when the process exits gracefully.
|
|
547
|
+
*
|
|
548
|
+
* For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being
|
|
549
|
+
* truncated and lost:
|
|
550
|
+
*
|
|
551
|
+
* ```js
|
|
552
|
+
* // This is an example of what *not* to do:
|
|
553
|
+
* if (someConditionNotMet()) {
|
|
554
|
+
* printUsageToStdout();
|
|
555
|
+
* process.exit(1);
|
|
556
|
+
* }
|
|
557
|
+
* ```
|
|
558
|
+
*
|
|
559
|
+
* The reason this is problematic is because writes to `process.stdout` in Node.js
|
|
560
|
+
* are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
|
|
561
|
+
* event loop. Calling `process.exit()`, however, forces the process to exit_before_ those additional writes to `stdout` can be performed.
|
|
562
|
+
*
|
|
563
|
+
* Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
|
|
564
|
+
* scheduling any additional work for the event loop:
|
|
565
|
+
*
|
|
566
|
+
* ```js
|
|
567
|
+
* // How to properly set the exit code while letting
|
|
568
|
+
* // the process exit gracefully.
|
|
569
|
+
* if (someConditionNotMet()) {
|
|
570
|
+
* printUsageToStdout();
|
|
571
|
+
* process.exitCode = 1;
|
|
572
|
+
* }
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* If it is necessary to terminate the Node.js process due to an error condition,
|
|
576
|
+
* throwing an _uncaught_ error and allowing the process to terminate accordingly
|
|
577
|
+
* is safer than calling `process.exit()`.
|
|
578
|
+
*
|
|
579
|
+
* In `Worker` threads, this function stops the current thread rather
|
|
580
|
+
* than the current process.
|
|
581
|
+
* @since v0.1.13
|
|
582
|
+
* @param code The exit code.
|
|
583
|
+
*/
|
|
287
584
|
exit(code?: number): never;
|
|
585
|
+
/**
|
|
586
|
+
* A number which will be the process exit code, when the process either
|
|
587
|
+
* exits gracefully, or is exited via {@link exit} without specifying
|
|
588
|
+
* a code.
|
|
589
|
+
*
|
|
590
|
+
* Specifying a code to {@link exit} will override any
|
|
591
|
+
* previous setting of `process.exitCode`.
|
|
592
|
+
* @since v0.11.8
|
|
593
|
+
*/
|
|
288
594
|
exitCode?: number | undefined;
|
|
595
|
+
/**
|
|
596
|
+
* The `process.getgid()` method returns the numerical group identity of the
|
|
597
|
+
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
|
598
|
+
*
|
|
599
|
+
* ```js
|
|
600
|
+
* if (process.getgid) {
|
|
601
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
602
|
+
* }
|
|
603
|
+
* ```
|
|
604
|
+
*
|
|
605
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
606
|
+
* Android).
|
|
607
|
+
* @since v0.1.31
|
|
608
|
+
*/
|
|
289
609
|
getgid(): number;
|
|
610
|
+
/**
|
|
611
|
+
* The `process.setgid()` method sets the group identity of the process. (See[`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
|
|
612
|
+
* numeric ID or a group name
|
|
613
|
+
* string. If a group name is specified, this method blocks while resolving the
|
|
614
|
+
* associated numeric ID.
|
|
615
|
+
*
|
|
616
|
+
* ```js
|
|
617
|
+
* if (process.getgid && process.setgid) {
|
|
618
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
619
|
+
* try {
|
|
620
|
+
* process.setgid(501);
|
|
621
|
+
* console.log(`New gid: ${process.getgid()}`);
|
|
622
|
+
* } catch (err) {
|
|
623
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
624
|
+
* }
|
|
625
|
+
* }
|
|
626
|
+
* ```
|
|
627
|
+
*
|
|
628
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
629
|
+
* Android).
|
|
630
|
+
* This feature is not available in `Worker` threads.
|
|
631
|
+
* @since v0.1.31
|
|
632
|
+
* @param id The group name or ID
|
|
633
|
+
*/
|
|
290
634
|
setgid(id: number | string): void;
|
|
635
|
+
/**
|
|
636
|
+
* The `process.getuid()` method returns the numeric user identity of the process.
|
|
637
|
+
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
638
|
+
*
|
|
639
|
+
* ```js
|
|
640
|
+
* if (process.getuid) {
|
|
641
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
642
|
+
* }
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
646
|
+
* Android).
|
|
647
|
+
* @since v0.1.28
|
|
648
|
+
*/
|
|
291
649
|
getuid(): number;
|
|
650
|
+
/**
|
|
651
|
+
* The `process.setuid(id)` method sets the user identity of the process. (See[`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
|
|
652
|
+
* numeric ID or a username string.
|
|
653
|
+
* If a username is specified, the method blocks while resolving the associated
|
|
654
|
+
* numeric ID.
|
|
655
|
+
*
|
|
656
|
+
* ```js
|
|
657
|
+
* if (process.getuid && process.setuid) {
|
|
658
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
659
|
+
* try {
|
|
660
|
+
* process.setuid(501);
|
|
661
|
+
* console.log(`New uid: ${process.getuid()}`);
|
|
662
|
+
* } catch (err) {
|
|
663
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
664
|
+
* }
|
|
665
|
+
* }
|
|
666
|
+
* ```
|
|
667
|
+
*
|
|
668
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
669
|
+
* Android).
|
|
670
|
+
* This feature is not available in `Worker` threads.
|
|
671
|
+
* @since v0.1.28
|
|
672
|
+
*/
|
|
292
673
|
setuid(id: number | string): void;
|
|
674
|
+
/**
|
|
675
|
+
* The `process.geteuid()` method returns the numerical effective user identity of
|
|
676
|
+
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
677
|
+
*
|
|
678
|
+
* ```js
|
|
679
|
+
* if (process.geteuid) {
|
|
680
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
681
|
+
* }
|
|
682
|
+
* ```
|
|
683
|
+
*
|
|
684
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
685
|
+
* Android).
|
|
686
|
+
* @since v2.0.0
|
|
687
|
+
*/
|
|
293
688
|
geteuid(): number;
|
|
689
|
+
/**
|
|
690
|
+
* The `process.seteuid()` method sets the effective user identity of the process.
|
|
691
|
+
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
|
|
692
|
+
* string. If a username is specified, the method blocks while resolving the
|
|
693
|
+
* associated numeric ID.
|
|
694
|
+
*
|
|
695
|
+
* ```js
|
|
696
|
+
* if (process.geteuid && process.seteuid) {
|
|
697
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
698
|
+
* try {
|
|
699
|
+
* process.seteuid(501);
|
|
700
|
+
* console.log(`New uid: ${process.geteuid()}`);
|
|
701
|
+
* } catch (err) {
|
|
702
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
703
|
+
* }
|
|
704
|
+
* }
|
|
705
|
+
* ```
|
|
706
|
+
*
|
|
707
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
708
|
+
* Android).
|
|
709
|
+
* This feature is not available in `Worker` threads.
|
|
710
|
+
* @since v2.0.0
|
|
711
|
+
* @param id A user name or ID
|
|
712
|
+
*/
|
|
294
713
|
seteuid(id: number | string): void;
|
|
714
|
+
/**
|
|
715
|
+
* The `process.getegid()` method returns the numerical effective group identity
|
|
716
|
+
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
717
|
+
*
|
|
718
|
+
* ```js
|
|
719
|
+
* if (process.getegid) {
|
|
720
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
721
|
+
* }
|
|
722
|
+
* ```
|
|
723
|
+
*
|
|
724
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
725
|
+
* Android).
|
|
726
|
+
* @since v2.0.0
|
|
727
|
+
*/
|
|
295
728
|
getegid(): number;
|
|
729
|
+
/**
|
|
730
|
+
* The `process.setegid()` method sets the effective group identity of the process.
|
|
731
|
+
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
|
|
732
|
+
* name string. If a group name is specified, this method blocks while resolving
|
|
733
|
+
* the associated a numeric ID.
|
|
734
|
+
*
|
|
735
|
+
* ```js
|
|
736
|
+
* if (process.getegid && process.setegid) {
|
|
737
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
738
|
+
* try {
|
|
739
|
+
* process.setegid(501);
|
|
740
|
+
* console.log(`New gid: ${process.getegid()}`);
|
|
741
|
+
* } catch (err) {
|
|
742
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
743
|
+
* }
|
|
744
|
+
* }
|
|
745
|
+
* ```
|
|
746
|
+
*
|
|
747
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
748
|
+
* Android).
|
|
749
|
+
* This feature is not available in `Worker` threads.
|
|
750
|
+
* @since v2.0.0
|
|
751
|
+
* @param id A group name or ID
|
|
752
|
+
*/
|
|
296
753
|
setegid(id: number | string): void;
|
|
754
|
+
/**
|
|
755
|
+
* The `process.getgroups()` method returns an array with the supplementary group
|
|
756
|
+
* IDs. POSIX leaves it unspecified if the effective group ID is included but
|
|
757
|
+
* Node.js ensures it always is.
|
|
758
|
+
*
|
|
759
|
+
* ```js
|
|
760
|
+
* if (process.getgroups) {
|
|
761
|
+
* console.log(process.getgroups()); // [ 16, 21, 297 ]
|
|
762
|
+
* }
|
|
763
|
+
* ```
|
|
764
|
+
*
|
|
765
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
766
|
+
* Android).
|
|
767
|
+
* @since v0.9.4
|
|
768
|
+
*/
|
|
297
769
|
getgroups(): number[];
|
|
770
|
+
/**
|
|
771
|
+
* The `process.setgroups()` method sets the supplementary group IDs for the
|
|
772
|
+
* Node.js process. This is a privileged operation that requires the Node.js
|
|
773
|
+
* process to have `root` or the `CAP_SETGID` capability.
|
|
774
|
+
*
|
|
775
|
+
* The `groups` array can contain numeric group IDs, group names, or both.
|
|
776
|
+
*
|
|
777
|
+
* ```js
|
|
778
|
+
* if (process.getgroups && process.setgroups) {
|
|
779
|
+
* try {
|
|
780
|
+
* process.setgroups([501]);
|
|
781
|
+
* console.log(process.getgroups()); // new groups
|
|
782
|
+
* } catch (err) {
|
|
783
|
+
* console.log(`Failed to set groups: ${err}`);
|
|
784
|
+
* }
|
|
785
|
+
* }
|
|
786
|
+
* ```
|
|
787
|
+
*
|
|
788
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
789
|
+
* Android).
|
|
790
|
+
* This feature is not available in `Worker` threads.
|
|
791
|
+
* @since v0.9.4
|
|
792
|
+
*/
|
|
298
793
|
setgroups(groups: ReadonlyArray<string | number>): void;
|
|
794
|
+
/**
|
|
795
|
+
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
|
|
796
|
+
* that will be invoked when an uncaught exception occurs, which will receive the
|
|
797
|
+
* exception value itself as its first argument.
|
|
798
|
+
*
|
|
799
|
+
* If such a function is set, the `'uncaughtException'` event will
|
|
800
|
+
* not be emitted. If `--abort-on-uncaught-exception` was passed from the
|
|
801
|
+
* command line or set through `v8.setFlagsFromString()`, the process will
|
|
802
|
+
* not abort. Actions configured to take place on exceptions such as report
|
|
803
|
+
* generations will be affected too
|
|
804
|
+
*
|
|
805
|
+
* To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
|
|
806
|
+
* method with a non-`null` argument while another capture function is set will
|
|
807
|
+
* throw an error.
|
|
808
|
+
*
|
|
809
|
+
* Using this function is mutually exclusive with using the deprecated `domain` built-in module.
|
|
810
|
+
* @since v9.3.0
|
|
811
|
+
*/
|
|
299
812
|
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
|
813
|
+
/**
|
|
814
|
+
* Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}.
|
|
815
|
+
* @since v9.3.0
|
|
816
|
+
*/
|
|
300
817
|
hasUncaughtExceptionCaptureCallback(): boolean;
|
|
818
|
+
/**
|
|
819
|
+
* The `process.version` property contains the Node.js version string.
|
|
820
|
+
*
|
|
821
|
+
* ```js
|
|
822
|
+
* console.log(`Version: ${process.version}`);
|
|
823
|
+
* // Version: v14.8.0
|
|
824
|
+
* ```
|
|
825
|
+
*
|
|
826
|
+
* To get the version string without the prepended _v_, use`process.versions.node`.
|
|
827
|
+
* @since v0.1.3
|
|
828
|
+
*/
|
|
301
829
|
readonly version: string;
|
|
830
|
+
/**
|
|
831
|
+
* The `process.versions` property returns an object listing the version strings of
|
|
832
|
+
* Node.js and its dependencies. `process.versions.modules` indicates the current
|
|
833
|
+
* ABI version, which is increased whenever a C++ API changes. Node.js will refuse
|
|
834
|
+
* to load modules that were compiled against a different module ABI version.
|
|
835
|
+
*
|
|
836
|
+
* ```js
|
|
837
|
+
* console.log(process.versions);
|
|
838
|
+
* ```
|
|
839
|
+
*
|
|
840
|
+
* Will generate an object similar to:
|
|
841
|
+
*
|
|
842
|
+
* ```console
|
|
843
|
+
* { node: '11.13.0',
|
|
844
|
+
* v8: '7.0.276.38-node.18',
|
|
845
|
+
* uv: '1.27.0',
|
|
846
|
+
* zlib: '1.2.11',
|
|
847
|
+
* brotli: '1.0.7',
|
|
848
|
+
* ares: '1.15.0',
|
|
849
|
+
* modules: '67',
|
|
850
|
+
* nghttp2: '1.34.0',
|
|
851
|
+
* napi: '4',
|
|
852
|
+
* llhttp: '1.1.1',
|
|
853
|
+
* openssl: '1.1.1b',
|
|
854
|
+
* cldr: '34.0',
|
|
855
|
+
* icu: '63.1',
|
|
856
|
+
* tz: '2018e',
|
|
857
|
+
* unicode: '11.0' }
|
|
858
|
+
* ```
|
|
859
|
+
* @since v0.2.0
|
|
860
|
+
*/
|
|
302
861
|
readonly versions: ProcessVersions;
|
|
862
|
+
/**
|
|
863
|
+
* The `process.config` property returns an `Object` containing the JavaScript
|
|
864
|
+
* representation of the configure options used to compile the current Node.js
|
|
865
|
+
* executable. This is the same as the `config.gypi` file that was produced when
|
|
866
|
+
* running the `./configure` script.
|
|
867
|
+
*
|
|
868
|
+
* An example of the possible output looks like:
|
|
869
|
+
*
|
|
870
|
+
* ```js
|
|
871
|
+
* {
|
|
872
|
+
* target_defaults:
|
|
873
|
+
* { cflags: [],
|
|
874
|
+
* default_configuration: 'Release',
|
|
875
|
+
* defines: [],
|
|
876
|
+
* include_dirs: [],
|
|
877
|
+
* libraries: [] },
|
|
878
|
+
* variables:
|
|
879
|
+
* {
|
|
880
|
+
* host_arch: 'x64',
|
|
881
|
+
* napi_build_version: 5,
|
|
882
|
+
* node_install_npm: 'true',
|
|
883
|
+
* node_prefix: '',
|
|
884
|
+
* node_shared_cares: 'false',
|
|
885
|
+
* node_shared_http_parser: 'false',
|
|
886
|
+
* node_shared_libuv: 'false',
|
|
887
|
+
* node_shared_zlib: 'false',
|
|
888
|
+
* node_use_dtrace: 'false',
|
|
889
|
+
* node_use_openssl: 'true',
|
|
890
|
+
* node_shared_openssl: 'false',
|
|
891
|
+
* strict_aliasing: 'true',
|
|
892
|
+
* target_arch: 'x64',
|
|
893
|
+
* v8_use_snapshot: 1
|
|
894
|
+
* }
|
|
895
|
+
* }
|
|
896
|
+
* ```
|
|
897
|
+
*
|
|
898
|
+
* The `process.config` property is **not** read-only and there are existing
|
|
899
|
+
* modules in the ecosystem that are known to extend, modify, or entirely replace
|
|
900
|
+
* the value of `process.config`.
|
|
901
|
+
*
|
|
902
|
+
* Modifying the `process.config` property, or any child-property of the`process.config` object has been deprecated. The `process.config` will be made
|
|
903
|
+
* read-only in a future release.
|
|
904
|
+
* @since v0.7.7
|
|
905
|
+
*/
|
|
303
906
|
readonly config: ProcessConfig;
|
|
907
|
+
/**
|
|
908
|
+
* The `process.kill()` method sends the `signal` to the process identified by`pid`.
|
|
909
|
+
*
|
|
910
|
+
* Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information.
|
|
911
|
+
*
|
|
912
|
+
* This method will throw an error if the target `pid` does not exist. As a special
|
|
913
|
+
* case, a signal of `0` can be used to test for the existence of a process.
|
|
914
|
+
* Windows platforms will throw an error if the `pid` is used to kill a process
|
|
915
|
+
* group.
|
|
916
|
+
*
|
|
917
|
+
* Even though the name of this function is `process.kill()`, it is really just a
|
|
918
|
+
* signal sender, like the `kill` system call. The signal sent may do something
|
|
919
|
+
* other than kill the target process.
|
|
920
|
+
*
|
|
921
|
+
* ```js
|
|
922
|
+
* process.on('SIGHUP', () => {
|
|
923
|
+
* console.log('Got SIGHUP signal.');
|
|
924
|
+
* });
|
|
925
|
+
*
|
|
926
|
+
* setTimeout(() => {
|
|
927
|
+
* console.log('Exiting.');
|
|
928
|
+
* process.exit(0);
|
|
929
|
+
* }, 100);
|
|
930
|
+
*
|
|
931
|
+
* process.kill(process.pid, 'SIGHUP');
|
|
932
|
+
* ```
|
|
933
|
+
*
|
|
934
|
+
* When `SIGUSR1` is received by a Node.js process, Node.js will start the
|
|
935
|
+
* debugger. See `Signal Events`.
|
|
936
|
+
* @since v0.0.6
|
|
937
|
+
* @param pid A process ID
|
|
938
|
+
* @param signal The signal to send, either as a string or number.
|
|
939
|
+
*/
|
|
304
940
|
kill(pid: number, signal?: string | number): true;
|
|
941
|
+
/**
|
|
942
|
+
* The `process.pid` property returns the PID of the process.
|
|
943
|
+
*
|
|
944
|
+
* ```js
|
|
945
|
+
* console.log(`This process is pid ${process.pid}`);
|
|
946
|
+
* ```
|
|
947
|
+
* @since v0.1.15
|
|
948
|
+
*/
|
|
305
949
|
readonly pid: number;
|
|
950
|
+
/**
|
|
951
|
+
* The `process.ppid` property returns the PID of the parent of the
|
|
952
|
+
* current process.
|
|
953
|
+
*
|
|
954
|
+
* ```js
|
|
955
|
+
* console.log(`The parent process is pid ${process.ppid}`);
|
|
956
|
+
* ```
|
|
957
|
+
* @since v9.2.0, v8.10.0, v6.13.0
|
|
958
|
+
*/
|
|
306
959
|
readonly ppid: number;
|
|
960
|
+
/**
|
|
961
|
+
* The `process.title` property returns the current process title (i.e. returns
|
|
962
|
+
* the current value of `ps`). Assigning a new value to `process.title` modifies
|
|
963
|
+
* the current value of `ps`.
|
|
964
|
+
*
|
|
965
|
+
* When a new value is assigned, different platforms will impose different maximum
|
|
966
|
+
* length restrictions on the title. Usually such restrictions are quite limited.
|
|
967
|
+
* For instance, on Linux and macOS, `process.title` is limited to the size of the
|
|
968
|
+
* binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8
|
|
969
|
+
* allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure)
|
|
970
|
+
* cases.
|
|
971
|
+
*
|
|
972
|
+
* Assigning a value to `process.title` might not result in an accurate label
|
|
973
|
+
* within process manager applications such as macOS Activity Monitor or Windows
|
|
974
|
+
* Services Manager.
|
|
975
|
+
* @since v0.1.104
|
|
976
|
+
*/
|
|
307
977
|
title: string;
|
|
978
|
+
/**
|
|
979
|
+
* The operating system CPU architecture for which the Node.js binary was compiled.
|
|
980
|
+
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
|
|
981
|
+
*
|
|
982
|
+
* ```js
|
|
983
|
+
* console.log(`This processor architecture is ${process.arch}`);
|
|
984
|
+
* ```
|
|
985
|
+
* @since v0.5.0
|
|
986
|
+
*/
|
|
308
987
|
readonly arch: string;
|
|
988
|
+
/**
|
|
989
|
+
* The `process.platform` property returns a string identifying the operating
|
|
990
|
+
* system platform on which the Node.js process is running.
|
|
991
|
+
*
|
|
992
|
+
* Currently possible values are:
|
|
993
|
+
*
|
|
994
|
+
* * `'aix'`
|
|
995
|
+
* * `'darwin'`
|
|
996
|
+
* * `'freebsd'`
|
|
997
|
+
* * `'linux'`
|
|
998
|
+
* * `'openbsd'`
|
|
999
|
+
* * `'sunos'`
|
|
1000
|
+
* * `'win32'`
|
|
1001
|
+
*
|
|
1002
|
+
* ```js
|
|
1003
|
+
* console.log(`This platform is ${process.platform}`);
|
|
1004
|
+
* ```
|
|
1005
|
+
*
|
|
1006
|
+
* The value `'android'` may also be returned if the Node.js is built on the
|
|
1007
|
+
* Android operating system. However, Android support in Node.js[is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
|
|
1008
|
+
* @since v0.1.16
|
|
1009
|
+
*/
|
|
309
1010
|
readonly platform: Platform;
|
|
310
|
-
/**
|
|
1011
|
+
/**
|
|
1012
|
+
* The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at
|
|
1013
|
+
* runtime, `require.main` may still refer to the original main module in
|
|
1014
|
+
* modules that were required before the change occurred. Generally, it's
|
|
1015
|
+
* safe to assume that the two refer to the same module.
|
|
1016
|
+
*
|
|
1017
|
+
* As with `require.main`, `process.mainModule` will be `undefined` if there
|
|
1018
|
+
* is no entry script.
|
|
1019
|
+
* @since v0.1.17
|
|
1020
|
+
* @deprecated Since v14.0.0 - Use `main` instead.
|
|
1021
|
+
*/
|
|
311
1022
|
mainModule?: Module | undefined;
|
|
312
1023
|
memoryUsage: MemoryUsageFn;
|
|
1024
|
+
/**
|
|
1025
|
+
* The `process.cpuUsage()` method returns the user and system CPU time usage of
|
|
1026
|
+
* the current process, in an object with properties `user` and `system`, whose
|
|
1027
|
+
* values are microsecond values (millionth of a second). These values measure time
|
|
1028
|
+
* spent in user and system code respectively, and may end up being greater than
|
|
1029
|
+
* actual elapsed time if multiple CPU cores are performing work for this process.
|
|
1030
|
+
*
|
|
1031
|
+
* The result of a previous call to `process.cpuUsage()` can be passed as the
|
|
1032
|
+
* argument to the function, to get a diff reading.
|
|
1033
|
+
*
|
|
1034
|
+
* ```js
|
|
1035
|
+
* const startUsage = process.cpuUsage();
|
|
1036
|
+
* // { user: 38579, system: 6986 }
|
|
1037
|
+
*
|
|
1038
|
+
* // spin the CPU for 500 milliseconds
|
|
1039
|
+
* const now = Date.now();
|
|
1040
|
+
* while (Date.now() - now < 500);
|
|
1041
|
+
*
|
|
1042
|
+
* console.log(process.cpuUsage(startUsage));
|
|
1043
|
+
* // { user: 514883, system: 11226 }
|
|
1044
|
+
* ```
|
|
1045
|
+
* @since v6.1.0
|
|
1046
|
+
* @param previousValue A previous return value from calling `process.cpuUsage()`
|
|
1047
|
+
*/
|
|
313
1048
|
cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
|
1049
|
+
/**
|
|
1050
|
+
* `process.nextTick()` adds `callback` to the "next tick queue". This queue is
|
|
1051
|
+
* fully drained after the current operation on the JavaScript stack runs to
|
|
1052
|
+
* completion and before the event loop is allowed to continue. It's possible to
|
|
1053
|
+
* create an infinite loop if one were to recursively call `process.nextTick()`.
|
|
1054
|
+
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
|
|
1055
|
+
*
|
|
1056
|
+
* ```js
|
|
1057
|
+
* console.log('start');
|
|
1058
|
+
* process.nextTick(() => {
|
|
1059
|
+
* console.log('nextTick callback');
|
|
1060
|
+
* });
|
|
1061
|
+
* console.log('scheduled');
|
|
1062
|
+
* // Output:
|
|
1063
|
+
* // start
|
|
1064
|
+
* // scheduled
|
|
1065
|
+
* // nextTick callback
|
|
1066
|
+
* ```
|
|
1067
|
+
*
|
|
1068
|
+
* This is important when developing APIs in order to give users the opportunity
|
|
1069
|
+
* to assign event handlers _after_ an object has been constructed but before any
|
|
1070
|
+
* I/O has occurred:
|
|
1071
|
+
*
|
|
1072
|
+
* ```js
|
|
1073
|
+
* function MyThing(options) {
|
|
1074
|
+
* this.setupOptions(options);
|
|
1075
|
+
*
|
|
1076
|
+
* process.nextTick(() => {
|
|
1077
|
+
* this.startDoingStuff();
|
|
1078
|
+
* });
|
|
1079
|
+
* }
|
|
1080
|
+
*
|
|
1081
|
+
* const thing = new MyThing();
|
|
1082
|
+
* thing.getReadyForStuff();
|
|
1083
|
+
*
|
|
1084
|
+
* // thing.startDoingStuff() gets called now, not before.
|
|
1085
|
+
* ```
|
|
1086
|
+
*
|
|
1087
|
+
* It is very important for APIs to be either 100% synchronous or 100%
|
|
1088
|
+
* asynchronous. Consider this example:
|
|
1089
|
+
*
|
|
1090
|
+
* ```js
|
|
1091
|
+
* // WARNING! DO NOT USE! BAD UNSAFE HAZARD!
|
|
1092
|
+
* function maybeSync(arg, cb) {
|
|
1093
|
+
* if (arg) {
|
|
1094
|
+
* cb();
|
|
1095
|
+
* return;
|
|
1096
|
+
* }
|
|
1097
|
+
*
|
|
1098
|
+
* fs.stat('file', cb);
|
|
1099
|
+
* }
|
|
1100
|
+
* ```
|
|
1101
|
+
*
|
|
1102
|
+
* This API is hazardous because in the following case:
|
|
1103
|
+
*
|
|
1104
|
+
* ```js
|
|
1105
|
+
* const maybeTrue = Math.random() > 0.5;
|
|
1106
|
+
*
|
|
1107
|
+
* maybeSync(maybeTrue, () => {
|
|
1108
|
+
* foo();
|
|
1109
|
+
* });
|
|
1110
|
+
*
|
|
1111
|
+
* bar();
|
|
1112
|
+
* ```
|
|
1113
|
+
*
|
|
1114
|
+
* It is not clear whether `foo()` or `bar()` will be called first.
|
|
1115
|
+
*
|
|
1116
|
+
* The following approach is much better:
|
|
1117
|
+
*
|
|
1118
|
+
* ```js
|
|
1119
|
+
* function definitelyAsync(arg, cb) {
|
|
1120
|
+
* if (arg) {
|
|
1121
|
+
* process.nextTick(cb);
|
|
1122
|
+
* return;
|
|
1123
|
+
* }
|
|
1124
|
+
*
|
|
1125
|
+
* fs.stat('file', cb);
|
|
1126
|
+
* }
|
|
1127
|
+
* ```
|
|
1128
|
+
* @since v0.1.26
|
|
1129
|
+
* @param args Additional arguments to pass when invoking the `callback`
|
|
1130
|
+
*/
|
|
314
1131
|
nextTick(callback: Function, ...args: any[]): void;
|
|
1132
|
+
/**
|
|
1133
|
+
* The `process.release` property returns an `Object` containing metadata related
|
|
1134
|
+
* to the current release, including URLs for the source tarball and headers-only
|
|
1135
|
+
* tarball.
|
|
1136
|
+
*
|
|
1137
|
+
* `process.release` contains the following properties:
|
|
1138
|
+
*
|
|
1139
|
+
* ```js
|
|
1140
|
+
* {
|
|
1141
|
+
* name: 'node',
|
|
1142
|
+
* lts: 'Erbium',
|
|
1143
|
+
* sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
|
|
1144
|
+
* headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
|
|
1145
|
+
* libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
|
|
1146
|
+
* }
|
|
1147
|
+
* ```
|
|
1148
|
+
*
|
|
1149
|
+
* In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be
|
|
1150
|
+
* relied upon to exist.
|
|
1151
|
+
* @since v3.0.0
|
|
1152
|
+
*/
|
|
315
1153
|
readonly release: ProcessRelease;
|
|
316
1154
|
features: {
|
|
317
1155
|
inspector: boolean;
|
|
@@ -324,139 +1162,240 @@ declare module 'process' {
|
|
|
324
1162
|
tls: boolean;
|
|
325
1163
|
};
|
|
326
1164
|
/**
|
|
327
|
-
*
|
|
328
|
-
* the
|
|
329
|
-
*
|
|
1165
|
+
* `process.umask()` returns the Node.js process's file mode creation mask. Child
|
|
1166
|
+
* processes inherit the mask from the parent process.
|
|
1167
|
+
* @since v0.1.19
|
|
1168
|
+
* @deprecated Deprecated. Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a *
|
|
1169
|
+
* potential security vulnerability. There is no safe, cross-platform alternative API.
|
|
330
1170
|
*/
|
|
331
1171
|
umask(): number;
|
|
332
1172
|
/**
|
|
333
1173
|
* Can only be set if not in worker thread.
|
|
334
1174
|
*/
|
|
335
1175
|
umask(mask: string | number): number;
|
|
1176
|
+
/**
|
|
1177
|
+
* The `process.uptime()` method returns the number of seconds the current Node.js
|
|
1178
|
+
* process has been running.
|
|
1179
|
+
*
|
|
1180
|
+
* The return value includes fractions of a second. Use `Math.floor()` to get whole
|
|
1181
|
+
* seconds.
|
|
1182
|
+
* @since v0.5.0
|
|
1183
|
+
*/
|
|
336
1184
|
uptime(): number;
|
|
337
1185
|
hrtime: HRTime;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
1186
|
+
/**
|
|
1187
|
+
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
|
|
1188
|
+
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
|
|
1189
|
+
*
|
|
1190
|
+
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
|
|
1191
|
+
*
|
|
1192
|
+
* The message goes through serialization and parsing. The resulting message might
|
|
1193
|
+
* not be the same as what is originally sent.
|
|
1194
|
+
* @since v0.5.9
|
|
1195
|
+
* @param options used to parameterize the sending of certain types of handles.`options` supports the following properties:
|
|
1196
|
+
*/
|
|
1197
|
+
send?(
|
|
1198
|
+
message: any,
|
|
1199
|
+
sendHandle?: any,
|
|
1200
|
+
options?: {
|
|
1201
|
+
swallowErrors?: boolean | undefined;
|
|
1202
|
+
},
|
|
1203
|
+
callback?: (error: Error | null) => void
|
|
1204
|
+
): boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
|
|
1207
|
+
* IPC channel to the parent process, allowing the child process to exit gracefully
|
|
1208
|
+
* once there are no other connections keeping it alive.
|
|
1209
|
+
*
|
|
1210
|
+
* The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process.
|
|
1211
|
+
*
|
|
1212
|
+
* If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`.
|
|
1213
|
+
* @since v0.7.2
|
|
1214
|
+
*/
|
|
341
1215
|
disconnect(): void;
|
|
1216
|
+
/**
|
|
1217
|
+
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC
|
|
1218
|
+
* channel is connected and will return `false` after`process.disconnect()` is called.
|
|
1219
|
+
*
|
|
1220
|
+
* Once `process.connected` is `false`, it is no longer possible to send messages
|
|
1221
|
+
* over the IPC channel using `process.send()`.
|
|
1222
|
+
* @since v0.7.2
|
|
1223
|
+
*/
|
|
342
1224
|
connected: boolean;
|
|
343
|
-
|
|
344
1225
|
/**
|
|
345
1226
|
* The `process.allowedNodeEnvironmentFlags` property is a special,
|
|
346
|
-
* read-only `Set` of flags allowable within the `NODE_OPTIONS`
|
|
347
|
-
*
|
|
1227
|
+
* read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.
|
|
1228
|
+
*
|
|
1229
|
+
* `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag
|
|
1230
|
+
* representations. `process.allowedNodeEnvironmentFlags.has()` will
|
|
1231
|
+
* return `true` in the following cases:
|
|
1232
|
+
*
|
|
1233
|
+
* * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`.
|
|
1234
|
+
* * Flags passed through to V8 (as listed in `--v8-options`) may replace
|
|
1235
|
+
* one or more _non-leading_ dashes for an underscore, or vice-versa;
|
|
1236
|
+
* e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,
|
|
1237
|
+
* etc.
|
|
1238
|
+
* * Flags may contain one or more equals (`=`) characters; all
|
|
1239
|
+
* characters after and including the first equals will be ignored;
|
|
1240
|
+
* e.g., `--stack-trace-limit=100`.
|
|
1241
|
+
* * Flags _must_ be allowable within `NODE_OPTIONS`.
|
|
1242
|
+
*
|
|
1243
|
+
* When iterating over `process.allowedNodeEnvironmentFlags`, flags will
|
|
1244
|
+
* appear only _once_; each will begin with one or more dashes. Flags
|
|
1245
|
+
* passed through to V8 will contain underscores instead of non-leading
|
|
1246
|
+
* dashes:
|
|
1247
|
+
*
|
|
1248
|
+
* ```js
|
|
1249
|
+
* process.allowedNodeEnvironmentFlags.forEach((flag) => {
|
|
1250
|
+
* // -r
|
|
1251
|
+
* // --inspect-brk
|
|
1252
|
+
* // --abort_on_uncaught_exception
|
|
1253
|
+
* // ...
|
|
1254
|
+
* });
|
|
1255
|
+
* ```
|
|
1256
|
+
*
|
|
1257
|
+
* The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail
|
|
1258
|
+
* silently.
|
|
1259
|
+
*
|
|
1260
|
+
* If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will
|
|
1261
|
+
* contain what _would have_ been allowable.
|
|
1262
|
+
* @since v10.10.0
|
|
348
1263
|
*/
|
|
349
1264
|
allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
|
350
|
-
|
|
351
1265
|
/**
|
|
352
|
-
*
|
|
1266
|
+
* `process.report` is an object whose methods are used to generate diagnostic
|
|
1267
|
+
* reports for the current process. Additional documentation is available in the `report documentation`.
|
|
1268
|
+
* @since v11.8.0
|
|
353
1269
|
*/
|
|
354
1270
|
report?: ProcessReport | undefined;
|
|
355
|
-
|
|
1271
|
+
/**
|
|
1272
|
+
* ```js
|
|
1273
|
+
* console.log(process.resourceUsage());
|
|
1274
|
+
* /*
|
|
1275
|
+
* Will output:
|
|
1276
|
+
* {
|
|
1277
|
+
* userCPUTime: 82872,
|
|
1278
|
+
* systemCPUTime: 4143,
|
|
1279
|
+
* maxRSS: 33164,
|
|
1280
|
+
* sharedMemorySize: 0,
|
|
1281
|
+
* unsharedDataSize: 0,
|
|
1282
|
+
* unsharedStackSize: 0,
|
|
1283
|
+
* minorPageFault: 2469,
|
|
1284
|
+
* majorPageFault: 0,
|
|
1285
|
+
* swappedOut: 0,
|
|
1286
|
+
* fsRead: 0,
|
|
1287
|
+
* fsWrite: 8,
|
|
1288
|
+
* ipcSent: 0,
|
|
1289
|
+
* ipcReceived: 0,
|
|
1290
|
+
* signalsCount: 0,
|
|
1291
|
+
* voluntaryContextSwitches: 79,
|
|
1292
|
+
* involuntaryContextSwitches: 1
|
|
1293
|
+
* }
|
|
1294
|
+
*
|
|
1295
|
+
* ```
|
|
1296
|
+
* @since v12.6.0
|
|
1297
|
+
* @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t].
|
|
1298
|
+
*/
|
|
356
1299
|
resourceUsage(): ResourceUsage;
|
|
357
|
-
|
|
1300
|
+
/**
|
|
1301
|
+
* The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the
|
|
1302
|
+
* documentation for the `'warning' event` and the `emitWarning() method` for more information about this
|
|
1303
|
+
* flag's behavior.
|
|
1304
|
+
* @since v0.8.0
|
|
1305
|
+
*/
|
|
358
1306
|
traceDeprecation: boolean;
|
|
359
|
-
|
|
360
1307
|
/* EventEmitter */
|
|
361
|
-
addListener(event:
|
|
362
|
-
addListener(event:
|
|
363
|
-
addListener(event:
|
|
364
|
-
addListener(event:
|
|
365
|
-
addListener(event:
|
|
366
|
-
addListener(event:
|
|
367
|
-
addListener(event:
|
|
368
|
-
addListener(event:
|
|
369
|
-
addListener(event:
|
|
1308
|
+
addListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1309
|
+
addListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1310
|
+
addListener(event: 'exit', listener: ExitListener): this;
|
|
1311
|
+
addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1312
|
+
addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1313
|
+
addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1314
|
+
addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1315
|
+
addListener(event: 'warning', listener: WarningListener): this;
|
|
1316
|
+
addListener(event: 'message', listener: MessageListener): this;
|
|
370
1317
|
addListener(event: Signals, listener: SignalsListener): this;
|
|
371
|
-
addListener(event:
|
|
372
|
-
addListener(event:
|
|
373
|
-
|
|
374
|
-
emit(event:
|
|
375
|
-
emit(event:
|
|
376
|
-
emit(event:
|
|
377
|
-
emit(event:
|
|
378
|
-
emit(event:
|
|
379
|
-
emit(event:
|
|
380
|
-
emit(event:
|
|
381
|
-
emit(event:
|
|
382
|
-
emit(event: "message", message: unknown, sendHandle: unknown): this;
|
|
1318
|
+
addListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1319
|
+
addListener(event: 'worker', listener: WorkerListener): this;
|
|
1320
|
+
emit(event: 'beforeExit', code: number): boolean;
|
|
1321
|
+
emit(event: 'disconnect'): boolean;
|
|
1322
|
+
emit(event: 'exit', code: number): boolean;
|
|
1323
|
+
emit(event: 'rejectionHandled', promise: Promise<unknown>): boolean;
|
|
1324
|
+
emit(event: 'uncaughtException', error: Error): boolean;
|
|
1325
|
+
emit(event: 'uncaughtExceptionMonitor', error: Error): boolean;
|
|
1326
|
+
emit(event: 'unhandledRejection', reason: unknown, promise: Promise<unknown>): boolean;
|
|
1327
|
+
emit(event: 'warning', warning: Error): boolean;
|
|
1328
|
+
emit(event: 'message', message: unknown, sendHandle: unknown): this;
|
|
383
1329
|
emit(event: Signals, signal: Signals): boolean;
|
|
384
|
-
emit(event:
|
|
385
|
-
emit(event:
|
|
386
|
-
|
|
387
|
-
on(event:
|
|
388
|
-
on(event:
|
|
389
|
-
on(event:
|
|
390
|
-
on(event:
|
|
391
|
-
on(event:
|
|
392
|
-
on(event:
|
|
393
|
-
on(event:
|
|
394
|
-
on(event:
|
|
395
|
-
on(event: "message", listener: MessageListener): this;
|
|
1330
|
+
emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
|
|
1331
|
+
emit(event: 'worker', listener: WorkerListener): this;
|
|
1332
|
+
on(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1333
|
+
on(event: 'disconnect', listener: DisconnectListener): this;
|
|
1334
|
+
on(event: 'exit', listener: ExitListener): this;
|
|
1335
|
+
on(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1336
|
+
on(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1337
|
+
on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1338
|
+
on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1339
|
+
on(event: 'warning', listener: WarningListener): this;
|
|
1340
|
+
on(event: 'message', listener: MessageListener): this;
|
|
396
1341
|
on(event: Signals, listener: SignalsListener): this;
|
|
397
|
-
on(event:
|
|
398
|
-
on(event:
|
|
1342
|
+
on(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1343
|
+
on(event: 'worker', listener: WorkerListener): this;
|
|
399
1344
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
400
|
-
|
|
401
|
-
once(event:
|
|
402
|
-
once(event:
|
|
403
|
-
once(event:
|
|
404
|
-
once(event:
|
|
405
|
-
once(event:
|
|
406
|
-
once(event:
|
|
407
|
-
once(event:
|
|
408
|
-
once(event:
|
|
409
|
-
once(event: "message", listener: MessageListener): this;
|
|
1345
|
+
once(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1346
|
+
once(event: 'disconnect', listener: DisconnectListener): this;
|
|
1347
|
+
once(event: 'exit', listener: ExitListener): this;
|
|
1348
|
+
once(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1349
|
+
once(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1350
|
+
once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1351
|
+
once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1352
|
+
once(event: 'warning', listener: WarningListener): this;
|
|
1353
|
+
once(event: 'message', listener: MessageListener): this;
|
|
410
1354
|
once(event: Signals, listener: SignalsListener): this;
|
|
411
|
-
once(event:
|
|
412
|
-
once(event:
|
|
1355
|
+
once(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1356
|
+
once(event: 'worker', listener: WorkerListener): this;
|
|
413
1357
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
414
|
-
|
|
415
|
-
prependListener(event:
|
|
416
|
-
prependListener(event:
|
|
417
|
-
prependListener(event:
|
|
418
|
-
prependListener(event:
|
|
419
|
-
prependListener(event:
|
|
420
|
-
prependListener(event:
|
|
421
|
-
prependListener(event:
|
|
422
|
-
prependListener(event:
|
|
423
|
-
prependListener(event: "message", listener: MessageListener): this;
|
|
1358
|
+
prependListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1359
|
+
prependListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1360
|
+
prependListener(event: 'exit', listener: ExitListener): this;
|
|
1361
|
+
prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1362
|
+
prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1363
|
+
prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1364
|
+
prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1365
|
+
prependListener(event: 'warning', listener: WarningListener): this;
|
|
1366
|
+
prependListener(event: 'message', listener: MessageListener): this;
|
|
424
1367
|
prependListener(event: Signals, listener: SignalsListener): this;
|
|
425
|
-
prependListener(event:
|
|
426
|
-
prependListener(event:
|
|
427
|
-
|
|
428
|
-
prependOnceListener(event:
|
|
429
|
-
prependOnceListener(event:
|
|
430
|
-
prependOnceListener(event:
|
|
431
|
-
prependOnceListener(event:
|
|
432
|
-
prependOnceListener(event:
|
|
433
|
-
prependOnceListener(event:
|
|
434
|
-
prependOnceListener(event:
|
|
435
|
-
prependOnceListener(event:
|
|
436
|
-
prependOnceListener(event: "message", listener: MessageListener): this;
|
|
1368
|
+
prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1369
|
+
prependListener(event: 'worker', listener: WorkerListener): this;
|
|
1370
|
+
prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this;
|
|
1371
|
+
prependOnceListener(event: 'disconnect', listener: DisconnectListener): this;
|
|
1372
|
+
prependOnceListener(event: 'exit', listener: ExitListener): this;
|
|
1373
|
+
prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
|
|
1374
|
+
prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
|
|
1375
|
+
prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
|
|
1376
|
+
prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
|
|
1377
|
+
prependOnceListener(event: 'warning', listener: WarningListener): this;
|
|
1378
|
+
prependOnceListener(event: 'message', listener: MessageListener): this;
|
|
437
1379
|
prependOnceListener(event: Signals, listener: SignalsListener): this;
|
|
438
|
-
prependOnceListener(event:
|
|
439
|
-
prependOnceListener(event:
|
|
440
|
-
|
|
441
|
-
listeners(event:
|
|
442
|
-
listeners(event:
|
|
443
|
-
listeners(event:
|
|
444
|
-
listeners(event:
|
|
445
|
-
listeners(event:
|
|
446
|
-
listeners(event:
|
|
447
|
-
listeners(event:
|
|
448
|
-
listeners(event:
|
|
449
|
-
listeners(event: "message"): MessageListener[];
|
|
1380
|
+
prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
|
|
1381
|
+
prependOnceListener(event: 'worker', listener: WorkerListener): this;
|
|
1382
|
+
listeners(event: 'beforeExit'): BeforeExitListener[];
|
|
1383
|
+
listeners(event: 'disconnect'): DisconnectListener[];
|
|
1384
|
+
listeners(event: 'exit'): ExitListener[];
|
|
1385
|
+
listeners(event: 'rejectionHandled'): RejectionHandledListener[];
|
|
1386
|
+
listeners(event: 'uncaughtException'): UncaughtExceptionListener[];
|
|
1387
|
+
listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[];
|
|
1388
|
+
listeners(event: 'unhandledRejection'): UnhandledRejectionListener[];
|
|
1389
|
+
listeners(event: 'warning'): WarningListener[];
|
|
1390
|
+
listeners(event: 'message'): MessageListener[];
|
|
450
1391
|
listeners(event: Signals): SignalsListener[];
|
|
451
|
-
listeners(event:
|
|
452
|
-
listeners(event:
|
|
1392
|
+
listeners(event: 'multipleResolves'): MultipleResolveListener[];
|
|
1393
|
+
listeners(event: 'worker'): WorkerListener[];
|
|
453
1394
|
}
|
|
454
1395
|
}
|
|
455
1396
|
}
|
|
456
|
-
|
|
457
1397
|
export = process;
|
|
458
1398
|
}
|
|
459
|
-
|
|
460
1399
|
declare module 'node:process' {
|
|
461
1400
|
import process = require('process');
|
|
462
1401
|
export = process;
|