@types/node 18.19.21 → 18.19.23

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