UNPKG

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