@types/node 16.18.87 → 16.18.88

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