@idlebox/stripe-node-types 24.0.14-patch.0

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 (113) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +16 -0
  3. package/assert/strict.d.ts +5 -0
  4. package/assert.d.ts +1053 -0
  5. package/async_hooks.d.ts +621 -0
  6. package/buffer.buffer.d.ts +464 -0
  7. package/buffer.d.ts +1928 -0
  8. package/child_process.d.ts +1547 -0
  9. package/cluster.d.ts +576 -0
  10. package/compatibility/iterators.d.ts +22 -0
  11. package/console.d.ts +449 -0
  12. package/constants.d.ts +18 -0
  13. package/crypto.d.ts +4514 -0
  14. package/dgram.d.ts +597 -0
  15. package/diagnostics_channel.d.ts +576 -0
  16. package/dns/promises.d.ts +501 -0
  17. package/dns.d.ts +916 -0
  18. package/dom-events.d.ts +100 -0
  19. package/domain.d.ts +168 -0
  20. package/events.d.ts +927 -0
  21. package/fs/promises.d.ts +1278 -0
  22. package/fs.d.ts +4444 -0
  23. package/globals.d.ts +368 -0
  24. package/globals.typedarray.d.ts +23 -0
  25. package/http.d.ts +2044 -0
  26. package/http2.d.ts +2626 -0
  27. package/https.d.ts +543 -0
  28. package/index.d.ts +96 -0
  29. package/inspector.d.ts +3993 -0
  30. package/module.d.ts +866 -0
  31. package/my-shim.d.ts +57 -0
  32. package/net.d.ts +1030 -0
  33. package/os.d.ts +494 -0
  34. package/package.json +158 -0
  35. package/path.d.ts +189 -0
  36. package/perf_hooks.d.ts +968 -0
  37. package/process.d.ts +2016 -0
  38. package/punycode.d.ts +115 -0
  39. package/querystring.d.ts +150 -0
  40. package/readline/promises.d.ts +159 -0
  41. package/readline.d.ts +592 -0
  42. package/repl.d.ts +426 -0
  43. package/sea.d.ts +154 -0
  44. package/sqlite.d.ts +689 -0
  45. package/stream/consumers.d.ts +36 -0
  46. package/stream/promises.d.ts +88 -0
  47. package/stream/web.d.ts +616 -0
  48. package/stream.d.ts +1654 -0
  49. package/string_decoder.d.ts +65 -0
  50. package/test.d.ts +2216 -0
  51. package/timers/promises.d.ts +106 -0
  52. package/timers.d.ts +285 -0
  53. package/tls.d.ts +1211 -0
  54. package/trace_events.d.ts +195 -0
  55. package/ts5.1/compatibility/disposable.d.ts +13 -0
  56. package/ts5.1/index.d.ts +100 -0
  57. package/ts5.6/buffer.buffer.d.ts +461 -0
  58. package/ts5.6/compatibility/float16array.d.ts +72 -0
  59. package/ts5.6/globals.typedarray.d.ts +21 -0
  60. package/ts5.6/index.d.ts +98 -0
  61. package/ts5.7/compatibility/float16array.d.ts +73 -0
  62. package/ts5.7/index.d.ts +98 -0
  63. package/tty.d.ts +206 -0
  64. package/undici-types/LICENSE +22 -0
  65. package/undici-types/README.md +7 -0
  66. package/undici-types/agent.d.ts +32 -0
  67. package/undici-types/api.d.ts +44 -0
  68. package/undici-types/balanced-pool.d.ts +30 -0
  69. package/undici-types/cache-interceptor.d.ts +173 -0
  70. package/undici-types/cache.d.ts +37 -0
  71. package/undici-types/client.d.ts +108 -0
  72. package/undici-types/connector.d.ts +35 -0
  73. package/undici-types/content-type.d.ts +22 -0
  74. package/undici-types/cookies.d.ts +31 -0
  75. package/undici-types/diagnostics-channel.d.ts +67 -0
  76. package/undici-types/dispatcher.d.ts +282 -0
  77. package/undici-types/env-http-proxy-agent.d.ts +22 -0
  78. package/undici-types/errors.d.ts +172 -0
  79. package/undici-types/eventsource.d.ts +62 -0
  80. package/undici-types/fetch.d.ts +211 -0
  81. package/undici-types/formdata.d.ts +109 -0
  82. package/undici-types/global-dispatcher.d.ts +10 -0
  83. package/undici-types/global-origin.d.ts +8 -0
  84. package/undici-types/h2c-client.d.ts +76 -0
  85. package/undici-types/handlers.d.ts +16 -0
  86. package/undici-types/header.d.ts +161 -0
  87. package/undici-types/index.d.ts +76 -0
  88. package/undici-types/interceptors.d.ts +35 -0
  89. package/undici-types/mock-agent.d.ts +66 -0
  90. package/undici-types/mock-call-history.d.ts +112 -0
  91. package/undici-types/mock-client.d.ts +26 -0
  92. package/undici-types/mock-errors.d.ts +13 -0
  93. package/undici-types/mock-interceptor.d.ts +94 -0
  94. package/undici-types/mock-pool.d.ts +26 -0
  95. package/undici-types/package.json +55 -0
  96. package/undici-types/patch.d.ts +30 -0
  97. package/undici-types/pool-stats.d.ts +20 -0
  98. package/undici-types/pool.d.ts +40 -0
  99. package/undici-types/proxy-agent.d.ts +29 -0
  100. package/undici-types/readable.d.ts +69 -0
  101. package/undici-types/retry-agent.d.ts +9 -0
  102. package/undici-types/retry-handler.d.ts +117 -0
  103. package/undici-types/util.d.ts +19 -0
  104. package/undici-types/utility.d.ts +8 -0
  105. package/undici-types/webidl.d.ts +267 -0
  106. package/undici-types/websocket.d.ts +185 -0
  107. package/url.d.ts +1012 -0
  108. package/util.d.ts +2300 -0
  109. package/v8.d.ts +917 -0
  110. package/vm.d.ts +1034 -0
  111. package/wasi.d.ts +179 -0
  112. package/worker_threads.d.ts +773 -0
  113. package/zlib.d.ts +666 -0
package/process.d.ts ADDED
@@ -0,0 +1,2016 @@
1
+
2
+ declare module "node:process" {
3
+ import * as tty from 'node:tty';
4
+ import { Worker } from 'node:worker_threads';
5
+
6
+ interface BuiltInModule {
7
+ "node:assert": typeof import('node:assert');
8
+ "node:assert/strict": typeof import('node:assert/strict');
9
+ "node:async_hooks": typeof import('node:async_hooks');
10
+ "node:buffer": typeof import('node:buffer');
11
+ "node:child_process": typeof import('node:child_process');
12
+ "node:cluster": typeof import('node:cluster');
13
+ "node:console": typeof import('node:console');
14
+ "node:constants": typeof import('node:constants');
15
+ "node:crypto": typeof import('node:crypto');
16
+ "node:dgram": typeof import('node:dgram');
17
+ "node:diagnostics_channel": typeof import('node:diagnostics_channel');
18
+ "node:dns": typeof import('_not-use-node-type_dns');
19
+ "node:dns/promises": typeof import('node:dns/promises');
20
+ "node:domain": typeof import('node:domain');
21
+ "node:events": typeof import('node:events');
22
+ "node:fs": typeof import('_not-use-node-type_fs');
23
+ "node:fs/promises": typeof import('node:fs/promises');
24
+ "node:http": typeof import('node:http');
25
+ "node:http2": typeof import('node:http2');
26
+ "node:https": typeof import('node:https');
27
+ "node:inspector": typeof import('node:inspector');
28
+ "node:inspector/promises": typeof import('node:inspector/promises');
29
+ "node:module": typeof import('node:module');
30
+ "node:net": typeof import('node:net');
31
+ "node:os": typeof import('node:os');
32
+ "node:path": typeof import('node:path');
33
+ "node:path/posix": typeof import('node:path/posix');
34
+ "node:path/win32": typeof import('node:path/win32');
35
+ "node:perf_hooks": typeof import('node:perf_hooks');
36
+ "node:process": typeof import('node:process');
37
+ "node:punycode": typeof import('node:punycode');
38
+ "node:querystring": typeof import('node:querystring');
39
+ "node:readline": typeof import('_not-use-node-type_readline');
40
+ "node:readline/promises": typeof import('node:readline/promises');
41
+ "node:repl": typeof import('node:repl');
42
+ "node:sea": typeof import('node:sea');
43
+ "node:sqlite": typeof import('node:sqlite');
44
+ "node:stream": typeof import('node:stream');
45
+ "node:stream/consumers": typeof import('node:stream/consumers');
46
+ "node:stream/promises": typeof import('node:stream/promises');
47
+ "node:stream/web": typeof import('node:stream/web');
48
+ "node:string_decoder": typeof import('node:string_decoder');
49
+ "node:test": typeof import('node:test');
50
+ "node:test/reporters": typeof import('node:test/reporters');
51
+ "node:timers": typeof import('node:timers');
52
+ "node:timers/promises": typeof import('node:timers/promises');
53
+ "node:tls": typeof import('node:tls');
54
+ "node:trace_events": typeof import('node:trace_events');
55
+ "node:tty": typeof import('node:tty');
56
+ "node:url": typeof import('node:url');
57
+ "node:util": typeof import('node:util');
58
+ "node:sys": typeof import('node:util');
59
+ "node:util/types": typeof import('node:util/types');
60
+ "node:v8": typeof import('node:v8');
61
+ "node:vm": typeof import('node:vm');
62
+ "node:wasi": typeof import('node:wasi');
63
+ "node:worker_threads": typeof import('node:worker_threads');
64
+ "node:zlib": typeof import('node:zlib');
65
+ }
66
+ global {
67
+ var process: NodeJS.Process;
68
+ namespace NodeJS {
69
+ // this namespace merge is here because these are specifically used
70
+ // as the type for process.stdin, process.stdout, and process.stderr.
71
+ // they can't live in tty.d.ts because we need to disambiguate the imported name.
72
+ interface ReadStream extends tty.ReadStream {}
73
+ interface WriteStream extends tty.WriteStream {}
74
+ interface MemoryUsageFn {
75
+ /**
76
+ * The `process.memoryUsage()` method iterate over each page to gather informations about memory
77
+ * usage which can be slow depending on the program memory allocations.
78
+ */
79
+ (): MemoryUsage;
80
+ /**
81
+ * method returns an integer representing the Resident Set Size (RSS) in bytes.
82
+ */
83
+ rss(): number;
84
+ }
85
+ interface MemoryUsage {
86
+ /**
87
+ * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the
88
+ * process, including all C++ and JavaScript objects and code.
89
+ */
90
+ rss: number;
91
+ /**
92
+ * Refers to V8's memory usage.
93
+ */
94
+ heapTotal: number;
95
+ /**
96
+ * Refers to V8's memory usage.
97
+ */
98
+ heapUsed: number;
99
+ external: number;
100
+ /**
101
+ * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included
102
+ * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s
103
+ * may not be tracked in that case.
104
+ */
105
+ arrayBuffers: number;
106
+ }
107
+ interface CpuUsage {
108
+ user: number;
109
+ system: number;
110
+ }
111
+ interface ProcessRelease {
112
+ name: string;
113
+ sourceUrl?: string | undefined;
114
+ headersUrl?: string | undefined;
115
+ libUrl?: string | undefined;
116
+ lts?: string | undefined;
117
+ }
118
+ interface ProcessFeatures {
119
+ /**
120
+ * A boolean value that is `true` if the current Node.js build is caching builtin modules.
121
+ * @since v12.0.0
122
+ */
123
+ readonly cached_builtins: boolean;
124
+ /**
125
+ * A boolean value that is `true` if the current Node.js build is a debug build.
126
+ * @since v0.5.5
127
+ */
128
+ readonly debug: boolean;
129
+ /**
130
+ * A boolean value that is `true` if the current Node.js build includes the inspector.
131
+ * @since v11.10.0
132
+ */
133
+ readonly inspector: boolean;
134
+ /**
135
+ * A boolean value that is `true` if the current Node.js build includes support for IPv6.
136
+ *
137
+ * Since all Node.js builds have IPv6 support, this value is always `true`.
138
+ * @since v0.5.3
139
+ * @deprecated This property is always true, and any checks based on it are redundant.
140
+ */
141
+ readonly ipv6: boolean;
142
+ /**
143
+ * A boolean value that is `true` if the current Node.js build supports
144
+ * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v24.x/api/modules.md#loading-ecmascript-modules-using-require).
145
+ * @since v22.10.0
146
+ */
147
+ readonly require_module: boolean;
148
+ /**
149
+ * A boolean value that is `true` if the current Node.js build includes support for TLS.
150
+ * @since v0.5.3
151
+ */
152
+ readonly tls: boolean;
153
+ /**
154
+ * A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.
155
+ *
156
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional ALPN support.
157
+ * This value is therefore identical to that of `process.features.tls`.
158
+ * @since v4.8.0
159
+ * @deprecated Use `process.features.tls` instead.
160
+ */
161
+ readonly tls_alpn: boolean;
162
+ /**
163
+ * A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.
164
+ *
165
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional OCSP support.
166
+ * This value is therefore identical to that of `process.features.tls`.
167
+ * @since v0.11.13
168
+ * @deprecated Use `process.features.tls` instead.
169
+ */
170
+ readonly tls_ocsp: boolean;
171
+ /**
172
+ * A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.
173
+ *
174
+ * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional SNI support.
175
+ * This value is therefore identical to that of `process.features.tls`.
176
+ * @since v0.5.3
177
+ * @deprecated Use `process.features.tls` instead.
178
+ */
179
+ readonly tls_sni: boolean;
180
+ /**
181
+ * A value that is `"strip"` by default,
182
+ * `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
183
+ * Node.js is run with `--no-experimental-strip-types`.
184
+ * @since v22.10.0
185
+ */
186
+ readonly typescript: "strip" | "transform" | false;
187
+ /**
188
+ * A boolean value that is `true` if the current Node.js build includes support for libuv.
189
+ *
190
+ * Since it's not possible to build Node.js without libuv, this value is always `true`.
191
+ * @since v0.5.3
192
+ * @deprecated This property is always true, and any checks based on it are redundant.
193
+ */
194
+ readonly uv: boolean;
195
+ }
196
+ interface ProcessVersions extends Dict<string> {
197
+ http_parser: string;
198
+ node: string;
199
+ v8: string;
200
+ ares: string;
201
+ uv: string;
202
+ zlib: string;
203
+ modules: string;
204
+ openssl: string;
205
+ }
206
+ type Platform =
207
+ | "aix"
208
+ | "android"
209
+ | "darwin"
210
+ | "freebsd"
211
+ | "haiku"
212
+ | "linux"
213
+ | "openbsd"
214
+ | "sunos"
215
+ | "win32"
216
+ | "cygwin"
217
+ | "netbsd";
218
+ type Architecture =
219
+ | "arm"
220
+ | "arm64"
221
+ | "ia32"
222
+ | "loong64"
223
+ | "mips"
224
+ | "mipsel"
225
+ | "ppc64"
226
+ | "riscv64"
227
+ | "s390x"
228
+ | "x64";
229
+ type Signals =
230
+ | "SIGABRT"
231
+ | "SIGALRM"
232
+ | "SIGBUS"
233
+ | "SIGCHLD"
234
+ | "SIGCONT"
235
+ | "SIGFPE"
236
+ | "SIGHUP"
237
+ | "SIGILL"
238
+ | "SIGINT"
239
+ | "SIGIO"
240
+ | "SIGIOT"
241
+ | "SIGKILL"
242
+ | "SIGPIPE"
243
+ | "SIGPOLL"
244
+ | "SIGPROF"
245
+ | "SIGPWR"
246
+ | "SIGQUIT"
247
+ | "SIGSEGV"
248
+ | "SIGSTKFLT"
249
+ | "SIGSTOP"
250
+ | "SIGSYS"
251
+ | "SIGTERM"
252
+ | "SIGTRAP"
253
+ | "SIGTSTP"
254
+ | "SIGTTIN"
255
+ | "SIGTTOU"
256
+ | "SIGUNUSED"
257
+ | "SIGURG"
258
+ | "SIGUSR1"
259
+ | "SIGUSR2"
260
+ | "SIGVTALRM"
261
+ | "SIGWINCH"
262
+ | "SIGXCPU"
263
+ | "SIGXFSZ"
264
+ | "SIGBREAK"
265
+ | "SIGLOST"
266
+ | "SIGINFO";
267
+ type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
268
+ type MultipleResolveType = "resolve" | "reject";
269
+ type BeforeExitListener = (code: number) => void;
270
+ type DisconnectListener = () => void;
271
+ type ExitListener = (code: number) => void;
272
+ type RejectionHandledListener = (promise: Promise<unknown>) => void;
273
+ type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
274
+ /**
275
+ * Most of the time the unhandledRejection will be an Error, but this should not be relied upon
276
+ * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
277
+ */
278
+ type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
279
+ type WarningListener = (warning: Error) => void;
280
+ type MessageListener = (message: unknown, sendHandle: unknown) => void;
281
+ type SignalsListener = (signal: Signals) => void;
282
+ type MultipleResolveListener = (
283
+ type: MultipleResolveType,
284
+ promise: Promise<unknown>,
285
+ value: unknown,
286
+ ) => void;
287
+ type WorkerListener = (worker: Worker) => void;
288
+ interface Socket extends ReadWriteStream {
289
+ isTTY?: true | undefined;
290
+ }
291
+ // Alias for compatibility
292
+ interface ProcessEnv extends Dict<string> {
293
+ /**
294
+ * Can be used to change the default timezone at runtime
295
+ */
296
+ TZ?: string;
297
+ }
298
+ interface HRTime {
299
+ /**
300
+ * This is the legacy version of {@link process.hrtime.bigint()}
301
+ * before bigint was introduced in JavaScript.
302
+ *
303
+ * The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
304
+ * where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
305
+ *
306
+ * `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
307
+ * If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
308
+ * Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
309
+ *
310
+ * These times are relative to an arbitrary time in the past,
311
+ * and not related to the time of day and therefore not subject to clock drift.
312
+ * The primary use is for measuring performance between intervals:
313
+ * ```js
314
+ * const { hrtime } = require('node:process');
315
+ * const NS_PER_SEC = 1e9;
316
+ * const time = hrtime();
317
+ * // [ 1800216, 25 ]
318
+ *
319
+ * setTimeout(() => {
320
+ * const diff = hrtime(time);
321
+ * // [ 1, 552 ]
322
+ *
323
+ * console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
324
+ * // Benchmark took 1000000552 nanoseconds
325
+ * }, 1000);
326
+ * ```
327
+ * @since 0.7.6
328
+ * @legacy Use {@link process.hrtime.bigint()} instead.
329
+ * @param time The result of a previous call to `process.hrtime()`
330
+ */
331
+ (time?: [number, number]): [number, number];
332
+ /**
333
+ * The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
334
+ *
335
+ * Unlike {@link process.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
336
+ * ```js
337
+ * import { hrtime } from 'node:process';
338
+ *
339
+ * const start = hrtime.bigint();
340
+ * // 191051479007711n
341
+ *
342
+ * setTimeout(() => {
343
+ * const end = hrtime.bigint();
344
+ * // 191052633396993n
345
+ *
346
+ * console.log(`Benchmark took ${end - start} nanoseconds`);
347
+ * // Benchmark took 1154389282 nanoseconds
348
+ * }, 1000);
349
+ * ```
350
+ * @since v10.7.0
351
+ */
352
+ bigint(): bigint;
353
+ }
354
+ interface ProcessPermission {
355
+ /**
356
+ * Verifies that the process is able to access the given scope and reference.
357
+ * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')`
358
+ * will check if the process has ALL file system read permissions.
359
+ *
360
+ * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders.
361
+ *
362
+ * The available scopes are:
363
+ *
364
+ * * `fs` - All File System
365
+ * * `fs.read` - File System read operations
366
+ * * `fs.write` - File System write operations
367
+ * * `child` - Child process spawning operations
368
+ * * `worker` - Worker thread spawning operation
369
+ *
370
+ * ```js
371
+ * // Check if the process has permission to read the README file
372
+ * process.permission.has('fs.read', './README.md');
373
+ * // Check if the process has read permission operations
374
+ * process.permission.has('fs.read');
375
+ * ```
376
+ * @since v20.0.0
377
+ */
378
+ has(scope: string, reference?: string): boolean;
379
+ }
380
+ interface ProcessReport {
381
+ /**
382
+ * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems
383
+ * than the default multi-line format designed for human consumption.
384
+ * @since v13.12.0, v12.17.0
385
+ */
386
+ compact: boolean;
387
+ /**
388
+ * Directory where the report is written.
389
+ * The default value is the empty string, indicating that reports are written to the current
390
+ * working directory of the Node.js process.
391
+ */
392
+ directory: string;
393
+ /**
394
+ * Filename where the report is written. If set to the empty string, the output filename will be comprised
395
+ * of a timestamp, PID, and sequence number. The default value is the empty string.
396
+ */
397
+ filename: string;
398
+ /**
399
+ * Returns a JavaScript Object representation of a diagnostic report for the running process.
400
+ * The report's JavaScript stack trace is taken from `err`, if present.
401
+ */
402
+ getReport(err?: Error): object;
403
+ /**
404
+ * If true, a diagnostic report is generated on fatal errors,
405
+ * such as out of memory errors or failed C++ assertions.
406
+ * @default false
407
+ */
408
+ reportOnFatalError: boolean;
409
+ /**
410
+ * If true, a diagnostic report is generated when the process
411
+ * receives the signal specified by process.report.signal.
412
+ * @default false
413
+ */
414
+ reportOnSignal: boolean;
415
+ /**
416
+ * If true, a diagnostic report is generated on uncaught exception.
417
+ * @default false
418
+ */
419
+ reportOnUncaughtException: boolean;
420
+ /**
421
+ * The signal used to trigger the creation of a diagnostic report.
422
+ * @default 'SIGUSR2'
423
+ */
424
+ signal: Signals;
425
+ /**
426
+ * Writes a diagnostic report to a file. If filename is not provided, the default filename
427
+ * includes the date, time, PID, and a sequence number.
428
+ * The report's JavaScript stack trace is taken from `err`, if present.
429
+ *
430
+ * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written
431
+ * to the stdout or stderr of the process respectively.
432
+ * @param fileName Name of the file where the report is written.
433
+ * This should be a relative path, that will be appended to the directory specified in
434
+ * `process.report.directory`, or the current working directory of the Node.js process,
435
+ * if unspecified.
436
+ * @param err A custom error used for reporting the JavaScript stack.
437
+ * @return Filename of the generated report.
438
+ */
439
+ writeReport(fileName?: string, err?: Error): string;
440
+ writeReport(err?: Error): string;
441
+ }
442
+ interface ResourceUsage {
443
+ fsRead: number;
444
+ fsWrite: number;
445
+ involuntaryContextSwitches: number;
446
+ ipcReceived: number;
447
+ ipcSent: number;
448
+ majorPageFault: number;
449
+ maxRSS: number;
450
+ minorPageFault: number;
451
+ sharedMemorySize: number;
452
+ signalsCount: number;
453
+ swappedOut: number;
454
+ systemCPUTime: number;
455
+ unsharedDataSize: number;
456
+ unsharedStackSize: number;
457
+ userCPUTime: number;
458
+ voluntaryContextSwitches: number;
459
+ }
460
+ interface EmitWarningOptions {
461
+ /**
462
+ * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
463
+ *
464
+ * @default 'Warning'
465
+ */
466
+ type?: string | undefined;
467
+ /**
468
+ * A unique identifier for the warning instance being emitted.
469
+ */
470
+ code?: string | undefined;
471
+ /**
472
+ * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
473
+ *
474
+ * @default process.emitWarning
475
+ */
476
+ ctor?: Function | undefined;
477
+ /**
478
+ * Additional text to include with the error.
479
+ */
480
+ detail?: string | undefined;
481
+ }
482
+ interface ProcessConfig {
483
+ readonly target_defaults: {
484
+ readonly cflags: any[];
485
+ readonly default_configuration: string;
486
+ readonly defines: string[];
487
+ readonly include_dirs: string[];
488
+ readonly libraries: string[];
489
+ };
490
+ readonly variables: {
491
+ readonly clang: number;
492
+ readonly host_arch: string;
493
+ readonly node_install_npm: boolean;
494
+ readonly node_install_waf: boolean;
495
+ readonly node_prefix: string;
496
+ readonly node_shared_openssl: boolean;
497
+ readonly node_shared_v8: boolean;
498
+ readonly node_shared_zlib: boolean;
499
+ readonly node_use_dtrace: boolean;
500
+ readonly node_use_etw: boolean;
501
+ readonly node_use_openssl: boolean;
502
+ readonly target_arch: string;
503
+ readonly v8_no_strict_aliasing: number;
504
+ readonly v8_use_snapshot: boolean;
505
+ readonly visibility: string;
506
+ };
507
+ }
508
+ interface Process extends EventEmitter {
509
+ /**
510
+ * 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
511
+ * a `Writable` stream.
512
+ *
513
+ * For example, to copy `process.stdin` to `process.stdout`:
514
+ *
515
+ * ```js
516
+ * import { stdin, stdout } from 'node:process';
517
+ *
518
+ * stdin.pipe(stdout);
519
+ * ```
520
+ *
521
+ * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
522
+ */
523
+ stdout: WriteStream & {
524
+ fd: 1;
525
+ };
526
+ /**
527
+ * 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
528
+ * a `Writable` stream.
529
+ *
530
+ * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
531
+ */
532
+ stderr: WriteStream & {
533
+ fd: 2;
534
+ };
535
+ /**
536
+ * 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
537
+ * a `Readable` stream.
538
+ *
539
+ * For details of how to read from `stdin` see `readable.read()`.
540
+ *
541
+ * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that
542
+ * is compatible with scripts written for Node.js prior to v0.10\.
543
+ * For more information see `Stream compatibility`.
544
+ *
545
+ * In "old" streams mode the `stdin` stream is paused by default, so one
546
+ * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode.
547
+ */
548
+ stdin: ReadStream & {
549
+ fd: 0;
550
+ };
551
+ /**
552
+ * The `process.argv` property returns an array containing the command-line
553
+ * arguments passed when the Node.js process was launched. The first element will
554
+ * be {@link execPath}. See `process.argv0` if access to the original value
555
+ * of `argv[0]` is needed. The second element will be the path to the JavaScript
556
+ * file being executed. The remaining elements will be any additional command-line
557
+ * arguments.
558
+ *
559
+ * For example, assuming the following script for `process-args.js`:
560
+ *
561
+ * ```js
562
+ * import { argv } from 'node:process';
563
+ *
564
+ * // print process.argv
565
+ * argv.forEach((val, index) => {
566
+ * console.log(`${index}: ${val}`);
567
+ * });
568
+ * ```
569
+ *
570
+ * Launching the Node.js process as:
571
+ *
572
+ * ```bash
573
+ * node process-args.js one two=three four
574
+ * ```
575
+ *
576
+ * Would generate the output:
577
+ *
578
+ * ```text
579
+ * 0: /usr/local/bin/node
580
+ * 1: /Users/mjr/work/node/process-args.js
581
+ * 2: one
582
+ * 3: two=three
583
+ * 4: four
584
+ * ```
585
+ * @since v0.1.27
586
+ */
587
+ argv: string[];
588
+ /**
589
+ * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts.
590
+ *
591
+ * ```console
592
+ * $ bash -c 'exec -a customArgv0 ./node'
593
+ * > process.argv[0]
594
+ * '/Volumes/code/external/node/out/Release/node'
595
+ * > process.argv0
596
+ * 'customArgv0'
597
+ * ```
598
+ * @since v6.4.0
599
+ */
600
+ argv0: string;
601
+ /**
602
+ * The `process.execArgv` property returns the set of Node.js-specific command-line
603
+ * options passed when the Node.js process was launched. These options do not
604
+ * appear in the array returned by the {@link argv} property, and do not
605
+ * include the Node.js executable, the name of the script, or any options following
606
+ * the script name. These options are useful in order to spawn child processes with
607
+ * the same execution environment as the parent.
608
+ *
609
+ * ```bash
610
+ * node --icu-data-dir=./foo --require ./bar.js script.js --version
611
+ * ```
612
+ *
613
+ * Results in `process.execArgv`:
614
+ *
615
+ * ```js
616
+ * ["--icu-data-dir=./foo", "--require", "./bar.js"]
617
+ * ```
618
+ *
619
+ * And `process.argv`:
620
+ *
621
+ * ```js
622
+ * ['/usr/local/bin/node', 'script.js', '--version']
623
+ * ```
624
+ *
625
+ * Refer to `Worker constructor` for the detailed behavior of worker
626
+ * threads with this property.
627
+ * @since v0.7.7
628
+ */
629
+ execArgv: string[];
630
+ /**
631
+ * The `process.execPath` property returns the absolute pathname of the executable
632
+ * that started the Node.js process. Symbolic links, if any, are resolved.
633
+ *
634
+ * ```js
635
+ * '/usr/local/bin/node'
636
+ * ```
637
+ * @since v0.1.100
638
+ */
639
+ execPath: string;
640
+ /**
641
+ * The `process.abort()` method causes the Node.js process to exit immediately and
642
+ * generate a core file.
643
+ *
644
+ * This feature is not available in `Worker` threads.
645
+ * @since v0.7.0
646
+ */
647
+ abort(): never;
648
+ /**
649
+ * The `process.chdir()` method changes the current working directory of the
650
+ * Node.js process or throws an exception if doing so fails (for instance, if
651
+ * the specified `directory` does not exist).
652
+ *
653
+ * ```js
654
+ * import { chdir, cwd } from 'node:process';
655
+ *
656
+ * console.log(`Starting directory: ${cwd()}`);
657
+ * try {
658
+ * chdir('/tmp');
659
+ * console.log(`New directory: ${cwd()}`);
660
+ * } catch (err) {
661
+ * console.error(`chdir: ${err}`);
662
+ * }
663
+ * ```
664
+ *
665
+ * This feature is not available in `Worker` threads.
666
+ * @since v0.1.17
667
+ */
668
+ chdir(directory: string): void;
669
+ /**
670
+ * The `process.cwd()` method returns the current working directory of the Node.js
671
+ * process.
672
+ *
673
+ * ```js
674
+ * import { cwd } from 'node:process';
675
+ *
676
+ * console.log(`Current directory: ${cwd()}`);
677
+ * ```
678
+ * @since v0.1.8
679
+ */
680
+ cwd(): string;
681
+ /**
682
+ * The port used by the Node.js debugger when enabled.
683
+ *
684
+ * ```js
685
+ * import process from 'node:process';
686
+ *
687
+ * process.debugPort = 5858;
688
+ * ```
689
+ * @since v0.7.2
690
+ */
691
+ debugPort: number;
692
+ /**
693
+ * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and
694
+ * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`
695
+ * unless there are specific reasons such as custom dlopen flags or loading from ES modules.
696
+ *
697
+ * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v24.x/api/os.html#dlopen-constants)`
698
+ * documentation for details.
699
+ *
700
+ * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon
701
+ * are then accessible via `module.exports`.
702
+ *
703
+ * The example below shows how to load a C++ Addon, named `local.node`, that exports a `foo` function. All the symbols are loaded before the call returns, by passing the `RTLD_NOW` constant.
704
+ * In this example the constant is assumed to be available.
705
+ *
706
+ * ```js
707
+ * import { dlopen } from 'node:process';
708
+ * import { constants } from 'node:os';
709
+ * import { fileURLToPath } from 'node:url';
710
+ *
711
+ * const module = { exports: {} };
712
+ * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),
713
+ * constants.dlopen.RTLD_NOW);
714
+ * module.exports.foo();
715
+ * ```
716
+ */
717
+ dlopen(module: object, filename: string, flags?: number): void;
718
+ /**
719
+ * The `process.emitWarning()` method can be used to emit custom or application
720
+ * specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
721
+ *
722
+ * ```js
723
+ * import { emitWarning } from 'node:process';
724
+ *
725
+ * // Emit a warning using a string.
726
+ * emitWarning('Something happened!');
727
+ * // Emits: (node: 56338) Warning: Something happened!
728
+ * ```
729
+ *
730
+ * ```js
731
+ * import { emitWarning } from 'node:process';
732
+ *
733
+ * // Emit a warning using a string and a type.
734
+ * emitWarning('Something Happened!', 'CustomWarning');
735
+ * // Emits: (node:56338) CustomWarning: Something Happened!
736
+ * ```
737
+ *
738
+ * ```js
739
+ * import { emitWarning } from 'node:process';
740
+ *
741
+ * emitWarning('Something happened!', 'CustomWarning', 'WARN001');
742
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
743
+ * ```js
744
+ *
745
+ * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler.
746
+ *
747
+ * ```js
748
+ * import process from 'node:process';
749
+ *
750
+ * process.on('warning', (warning) => {
751
+ * console.warn(warning.name); // 'Warning'
752
+ * console.warn(warning.message); // 'Something happened!'
753
+ * console.warn(warning.code); // 'MY_WARNING'
754
+ * console.warn(warning.stack); // Stack trace
755
+ * console.warn(warning.detail); // 'This is some additional information'
756
+ * });
757
+ * ```
758
+ *
759
+ * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler
760
+ * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored):
761
+ *
762
+ * ```js
763
+ * import { emitWarning } from 'node:process';
764
+ *
765
+ * // Emit a warning using an Error object.
766
+ * const myWarning = new Error('Something happened!');
767
+ * // Use the Error name property to specify the type name
768
+ * myWarning.name = 'CustomWarning';
769
+ * myWarning.code = 'WARN001';
770
+ *
771
+ * emitWarning(myWarning);
772
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
773
+ * ```
774
+ *
775
+ * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object.
776
+ *
777
+ * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms.
778
+ *
779
+ * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`:
780
+ * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
781
+ * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed.
782
+ * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace.
783
+ * @since v8.0.0
784
+ * @param warning The warning to emit.
785
+ */
786
+ emitWarning(warning: string | Error, ctor?: Function): void;
787
+ emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
788
+ emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
789
+ emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
790
+ /**
791
+ * The `process.env` property returns an object containing the user environment.
792
+ * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).
793
+ *
794
+ * An example of this object looks like:
795
+ *
796
+ * ```js
797
+ * {
798
+ * TERM: 'xterm-256color',
799
+ * SHELL: '/usr/local/bin/bash',
800
+ * USER: 'maciej',
801
+ * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
802
+ * PWD: '/Users/maciej',
803
+ * EDITOR: 'vim',
804
+ * SHLVL: '1',
805
+ * HOME: '/Users/maciej',
806
+ * LOGNAME: 'maciej',
807
+ * _: '/usr/local/bin/node'
808
+ * }
809
+ * ```
810
+ *
811
+ * It is possible to modify this object, but such modifications will not be
812
+ * reflected outside the Node.js process, or (unless explicitly requested)
813
+ * to other `Worker` threads.
814
+ * In other words, the following example would not work:
815
+ *
816
+ * ```bash
817
+ * node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
818
+ * ```
819
+ *
820
+ * While the following will:
821
+ *
822
+ * ```js
823
+ * import { env } from 'node:process';
824
+ *
825
+ * env.foo = 'bar';
826
+ * console.log(env.foo);
827
+ * ```
828
+ *
829
+ * Assigning a property on `process.env` will implicitly convert the value
830
+ * to a string. **This behavior is deprecated.** Future versions of Node.js may
831
+ * throw an error when the value is not a string, number, or boolean.
832
+ *
833
+ * ```js
834
+ * import { env } from 'node:process';
835
+ *
836
+ * env.test = null;
837
+ * console.log(env.test);
838
+ * // => 'null'
839
+ * env.test = undefined;
840
+ * console.log(env.test);
841
+ * // => 'undefined'
842
+ * ```
843
+ *
844
+ * Use `delete` to delete a property from `process.env`.
845
+ *
846
+ * ```js
847
+ * import { env } from 'node:process';
848
+ *
849
+ * env.TEST = 1;
850
+ * delete env.TEST;
851
+ * console.log(env.TEST);
852
+ * // => undefined
853
+ * ```
854
+ *
855
+ * On Windows operating systems, environment variables are case-insensitive.
856
+ *
857
+ * ```js
858
+ * import { env } from 'node:process';
859
+ *
860
+ * env.TEST = 1;
861
+ * console.log(env.test);
862
+ * // => 1
863
+ * ```
864
+ *
865
+ * Unless explicitly specified when creating a `Worker` instance,
866
+ * each `Worker` thread has its own copy of `process.env`, based on its
867
+ * parent thread's `process.env`, or whatever was specified as the `env` option
868
+ * to the `Worker` constructor. Changes to `process.env` will not be visible
869
+ * across `Worker` threads, and only the main thread can make changes that
870
+ * are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner
871
+ * unlike the main thread.
872
+ * @since v0.1.27
873
+ */
874
+ env: ProcessEnv;
875
+ /**
876
+ * The `process.exit()` method instructs Node.js to terminate the process
877
+ * synchronously with an exit status of `code`. If `code` is omitted, exit uses
878
+ * either the 'success' code `0` or the value of `process.exitCode` if it has been
879
+ * set. Node.js will not terminate until all the `'exit'` event listeners are
880
+ * called.
881
+ *
882
+ * To exit with a 'failure' code:
883
+ *
884
+ * ```js
885
+ * import { exit } from 'node:process';
886
+ *
887
+ * exit(1);
888
+ * ```
889
+ *
890
+ * The shell that executed Node.js should see the exit code as `1`.
891
+ *
892
+ * Calling `process.exit()` will force the process to exit as quickly as possible
893
+ * even if there are still asynchronous operations pending that have not yet
894
+ * completed fully, including I/O operations to `process.stdout` and `process.stderr`.
895
+ *
896
+ * 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_
897
+ * _work pending_ in the event loop. The `process.exitCode` property can be set to
898
+ * tell the process which exit code to use when the process exits gracefully.
899
+ *
900
+ * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being
901
+ * truncated and lost:
902
+ *
903
+ * ```js
904
+ * import { exit } from 'node:process';
905
+ *
906
+ * // This is an example of what *not* to do:
907
+ * if (someConditionNotMet()) {
908
+ * printUsageToStdout();
909
+ * exit(1);
910
+ * }
911
+ * ```
912
+ *
913
+ * The reason this is problematic is because writes to `process.stdout` in Node.js
914
+ * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
915
+ * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
916
+ *
917
+ * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding
918
+ * scheduling any additional work for the event loop:
919
+ *
920
+ * ```js
921
+ * import process from 'node:process';
922
+ *
923
+ * // How to properly set the exit code while letting
924
+ * // the process exit gracefully.
925
+ * if (someConditionNotMet()) {
926
+ * printUsageToStdout();
927
+ * process.exitCode = 1;
928
+ * }
929
+ * ```
930
+ *
931
+ * If it is necessary to terminate the Node.js process due to an error condition,
932
+ * throwing an _uncaught_ error and allowing the process to terminate accordingly
933
+ * is safer than calling `process.exit()`.
934
+ *
935
+ * In `Worker` threads, this function stops the current thread rather
936
+ * than the current process.
937
+ * @since v0.1.13
938
+ * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
939
+ */
940
+ exit(code?: number | string | null | undefined): never;
941
+ /**
942
+ * A number which will be the process exit code, when the process either
943
+ * exits gracefully, or is exited via {@link exit} without specifying
944
+ * a code.
945
+ *
946
+ * Specifying a code to {@link exit} will override any
947
+ * previous setting of `process.exitCode`.
948
+ * @default undefined
949
+ * @since v0.11.8
950
+ */
951
+ exitCode?: number | string | number | undefined;
952
+ finalization: {
953
+ /**
954
+ * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
955
+ * If the object `ref` was garbage collected before the `exit` event is emitted, the callback will be removed from the finalization registry, and it will not be called on process exit.
956
+ *
957
+ * Inside the callback you can release the resources allocated by the `ref` object.
958
+ * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function,
959
+ * this means that there is a possibility that the callback will not be called under special circumstances.
960
+ *
961
+ * The idea of ​​this function is to help you free up resources when the starts process exiting, but also let the object be garbage collected if it is no longer being used.
962
+ * @param ref The reference to the resource that is being tracked.
963
+ * @param callback The callback function to be called when the resource is finalized.
964
+ * @since v22.5.0
965
+ * @experimental
966
+ */
967
+ register<T extends object>(ref: T, callback: (ref: T, event: "exit") => void): void;
968
+ /**
969
+ * This function behaves exactly like the `register`, except that the callback will be called when the process emits the `beforeExit` event if `ref` object was not garbage collected.
970
+ *
971
+ * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function, this means that there is a possibility that the callback will not be called under special circumstances.
972
+ * @param ref The reference to the resource that is being tracked.
973
+ * @param callback The callback function to be called when the resource is finalized.
974
+ * @since v22.5.0
975
+ * @experimental
976
+ */
977
+ registerBeforeExit<T extends object>(ref: T, callback: (ref: T, event: "beforeExit") => void): void;
978
+ /**
979
+ * This function remove the register of the object from the finalization registry, so the callback will not be called anymore.
980
+ * @param ref The reference to the resource that was registered previously.
981
+ * @since v22.5.0
982
+ * @experimental
983
+ */
984
+ unregister(ref: object): void;
985
+ };
986
+ /**
987
+ * The `process.getActiveResourcesInfo()` method returns an array of strings containing
988
+ * the types of the active resources that are currently keeping the event loop alive.
989
+ *
990
+ * ```js
991
+ * import { getActiveResourcesInfo } from 'node:process';
992
+ * import { setTimeout } from 'node:timers';
993
+
994
+ * console.log('Before:', getActiveResourcesInfo());
995
+ * setTimeout(() => {}, 1000);
996
+ * console.log('After:', getActiveResourcesInfo());
997
+ * // Prints:
998
+ * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]
999
+ * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]
1000
+ * ```
1001
+ * @since v17.3.0, v16.14.0
1002
+ */
1003
+ getActiveResourcesInfo(): string[];
1004
+ /**
1005
+ * Provides a way to load built-in modules in a globally available function.
1006
+ * @param id ID of the built-in module being requested.
1007
+ */
1008
+ getBuiltinModule<ID extends keyof BuiltInModule>(id: ID): BuiltInModule[ID];
1009
+ getBuiltinModule(id: string): object | undefined;
1010
+ /**
1011
+ * The `process.getgid()` method returns the numerical group identity of the
1012
+ * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
1013
+ *
1014
+ * ```js
1015
+ * import process from 'node:process';
1016
+ *
1017
+ * if (process.getgid) {
1018
+ * console.log(`Current gid: ${process.getgid()}`);
1019
+ * }
1020
+ * ```
1021
+ *
1022
+ * This function is only available on POSIX platforms (i.e. not Windows or
1023
+ * Android).
1024
+ * @since v0.1.31
1025
+ */
1026
+ getgid?: () => number;
1027
+ /**
1028
+ * 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
1029
+ * numeric ID or a group name
1030
+ * string. If a group name is specified, this method blocks while resolving the
1031
+ * associated numeric ID.
1032
+ *
1033
+ * ```js
1034
+ * import process from 'node:process';
1035
+ *
1036
+ * if (process.getgid &#x26;&#x26; process.setgid) {
1037
+ * console.log(`Current gid: ${process.getgid()}`);
1038
+ * try {
1039
+ * process.setgid(501);
1040
+ * console.log(`New gid: ${process.getgid()}`);
1041
+ * } catch (err) {
1042
+ * console.log(`Failed to set gid: ${err}`);
1043
+ * }
1044
+ * }
1045
+ * ```
1046
+ *
1047
+ * This function is only available on POSIX platforms (i.e. not Windows or
1048
+ * Android).
1049
+ * This feature is not available in `Worker` threads.
1050
+ * @since v0.1.31
1051
+ * @param id The group name or ID
1052
+ */
1053
+ setgid?: (id: number | string) => void;
1054
+ /**
1055
+ * The `process.getuid()` method returns the numeric user identity of the process.
1056
+ * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
1057
+ *
1058
+ * ```js
1059
+ * import process from 'node:process';
1060
+ *
1061
+ * if (process.getuid) {
1062
+ * console.log(`Current uid: ${process.getuid()}`);
1063
+ * }
1064
+ * ```
1065
+ *
1066
+ * This function is only available on POSIX platforms (i.e. not Windows or
1067
+ * Android).
1068
+ * @since v0.1.28
1069
+ */
1070
+ getuid?: () => number;
1071
+ /**
1072
+ * 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
1073
+ * numeric ID or a username string.
1074
+ * If a username is specified, the method blocks while resolving the associated
1075
+ * numeric ID.
1076
+ *
1077
+ * ```js
1078
+ * import process from 'node:process';
1079
+ *
1080
+ * if (process.getuid &#x26;&#x26; process.setuid) {
1081
+ * console.log(`Current uid: ${process.getuid()}`);
1082
+ * try {
1083
+ * process.setuid(501);
1084
+ * console.log(`New uid: ${process.getuid()}`);
1085
+ * } catch (err) {
1086
+ * console.log(`Failed to set uid: ${err}`);
1087
+ * }
1088
+ * }
1089
+ * ```
1090
+ *
1091
+ * This function is only available on POSIX platforms (i.e. not Windows or
1092
+ * Android).
1093
+ * This feature is not available in `Worker` threads.
1094
+ * @since v0.1.28
1095
+ */
1096
+ setuid?: (id: number | string) => void;
1097
+ /**
1098
+ * The `process.geteuid()` method returns the numerical effective user identity of
1099
+ * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
1100
+ *
1101
+ * ```js
1102
+ * import process from 'node:process';
1103
+ *
1104
+ * if (process.geteuid) {
1105
+ * console.log(`Current uid: ${process.geteuid()}`);
1106
+ * }
1107
+ * ```
1108
+ *
1109
+ * This function is only available on POSIX platforms (i.e. not Windows or
1110
+ * Android).
1111
+ * @since v2.0.0
1112
+ */
1113
+ geteuid?: () => number;
1114
+ /**
1115
+ * The `process.seteuid()` method sets the effective user identity of the process.
1116
+ * (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
1117
+ * string. If a username is specified, the method blocks while resolving the
1118
+ * associated numeric ID.
1119
+ *
1120
+ * ```js
1121
+ * import process from 'node:process';
1122
+ *
1123
+ * if (process.geteuid &#x26;&#x26; process.seteuid) {
1124
+ * console.log(`Current uid: ${process.geteuid()}`);
1125
+ * try {
1126
+ * process.seteuid(501);
1127
+ * console.log(`New uid: ${process.geteuid()}`);
1128
+ * } catch (err) {
1129
+ * console.log(`Failed to set uid: ${err}`);
1130
+ * }
1131
+ * }
1132
+ * ```
1133
+ *
1134
+ * This function is only available on POSIX platforms (i.e. not Windows or
1135
+ * Android).
1136
+ * This feature is not available in `Worker` threads.
1137
+ * @since v2.0.0
1138
+ * @param id A user name or ID
1139
+ */
1140
+ seteuid?: (id: number | string) => void;
1141
+ /**
1142
+ * The `process.getegid()` method returns the numerical effective group identity
1143
+ * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
1144
+ *
1145
+ * ```js
1146
+ * import process from 'node:process';
1147
+ *
1148
+ * if (process.getegid) {
1149
+ * console.log(`Current gid: ${process.getegid()}`);
1150
+ * }
1151
+ * ```
1152
+ *
1153
+ * This function is only available on POSIX platforms (i.e. not Windows or
1154
+ * Android).
1155
+ * @since v2.0.0
1156
+ */
1157
+ getegid?: () => number;
1158
+ /**
1159
+ * The `process.setegid()` method sets the effective group identity of the process.
1160
+ * (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
1161
+ * name string. If a group name is specified, this method blocks while resolving
1162
+ * the associated a numeric ID.
1163
+ *
1164
+ * ```js
1165
+ * import process from 'node:process';
1166
+ *
1167
+ * if (process.getegid &#x26;&#x26; process.setegid) {
1168
+ * console.log(`Current gid: ${process.getegid()}`);
1169
+ * try {
1170
+ * process.setegid(501);
1171
+ * console.log(`New gid: ${process.getegid()}`);
1172
+ * } catch (err) {
1173
+ * console.log(`Failed to set gid: ${err}`);
1174
+ * }
1175
+ * }
1176
+ * ```
1177
+ *
1178
+ * This function is only available on POSIX platforms (i.e. not Windows or
1179
+ * Android).
1180
+ * This feature is not available in `Worker` threads.
1181
+ * @since v2.0.0
1182
+ * @param id A group name or ID
1183
+ */
1184
+ setegid?: (id: number | string) => void;
1185
+ /**
1186
+ * The `process.getgroups()` method returns an array with the supplementary group
1187
+ * IDs. POSIX leaves it unspecified if the effective group ID is included but
1188
+ * Node.js ensures it always is.
1189
+ *
1190
+ * ```js
1191
+ * import process from 'node:process';
1192
+ *
1193
+ * if (process.getgroups) {
1194
+ * console.log(process.getgroups()); // [ 16, 21, 297 ]
1195
+ * }
1196
+ * ```
1197
+ *
1198
+ * This function is only available on POSIX platforms (i.e. not Windows or
1199
+ * Android).
1200
+ * @since v0.9.4
1201
+ */
1202
+ getgroups?: () => number[];
1203
+ /**
1204
+ * The `process.setgroups()` method sets the supplementary group IDs for the
1205
+ * Node.js process. This is a privileged operation that requires the Node.js
1206
+ * process to have `root` or the `CAP_SETGID` capability.
1207
+ *
1208
+ * The `groups` array can contain numeric group IDs, group names, or both.
1209
+ *
1210
+ * ```js
1211
+ * import process from 'node:process';
1212
+ *
1213
+ * if (process.getgroups &#x26;&#x26; process.setgroups) {
1214
+ * try {
1215
+ * process.setgroups([501]);
1216
+ * console.log(process.getgroups()); // new groups
1217
+ * } catch (err) {
1218
+ * console.log(`Failed to set groups: ${err}`);
1219
+ * }
1220
+ * }
1221
+ * ```
1222
+ *
1223
+ * This function is only available on POSIX platforms (i.e. not Windows or
1224
+ * Android).
1225
+ * This feature is not available in `Worker` threads.
1226
+ * @since v0.9.4
1227
+ */
1228
+ setgroups?: (groups: ReadonlyArray<string | number>) => void;
1229
+ /**
1230
+ * The `process.setUncaughtExceptionCaptureCallback()` function sets a function
1231
+ * that will be invoked when an uncaught exception occurs, which will receive the
1232
+ * exception value itself as its first argument.
1233
+ *
1234
+ * If such a function is set, the `'uncaughtException'` event will
1235
+ * not be emitted. If `--abort-on-uncaught-exception` was passed from the
1236
+ * command line or set through `v8.setFlagsFromString()`, the process will
1237
+ * not abort. Actions configured to take place on exceptions such as report
1238
+ * generations will be affected too
1239
+ *
1240
+ * To unset the capture function, `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
1241
+ * method with a non-`null` argument while another capture function is set will
1242
+ * throw an error.
1243
+ *
1244
+ * Using this function is mutually exclusive with using the deprecated `domain` built-in module.
1245
+ * @since v9.3.0
1246
+ */
1247
+ setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
1248
+ /**
1249
+ * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}.
1250
+ * @since v9.3.0
1251
+ */
1252
+ hasUncaughtExceptionCaptureCallback(): boolean;
1253
+ /**
1254
+ * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled.
1255
+ * @since v20.7.0
1256
+ * @experimental
1257
+ */
1258
+ readonly sourceMapsEnabled: boolean;
1259
+ /**
1260
+ * This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for
1261
+ * stack traces.
1262
+ *
1263
+ * It provides same features as launching Node.js process with commandline options `--enable-source-maps`.
1264
+ *
1265
+ * Only source maps in JavaScript files that are loaded after source maps has been
1266
+ * enabled will be parsed and loaded.
1267
+ * @since v16.6.0, v14.18.0
1268
+ * @experimental
1269
+ */
1270
+ setSourceMapsEnabled(value: boolean): void;
1271
+ /**
1272
+ * The `process.version` property contains the Node.js version string.
1273
+ *
1274
+ * ```js
1275
+ * import { version } from 'node:process';
1276
+ *
1277
+ * console.log(`Version: ${version}`);
1278
+ * // Version: v14.8.0
1279
+ * ```
1280
+ *
1281
+ * To get the version string without the prepended _v_, use`process.versions.node`.
1282
+ * @since v0.1.3
1283
+ */
1284
+ readonly version: string;
1285
+ /**
1286
+ * The `process.versions` property returns an object listing the version strings of
1287
+ * Node.js and its dependencies. `process.versions.modules` indicates the current
1288
+ * ABI version, which is increased whenever a C++ API changes. Node.js will refuse
1289
+ * to load modules that were compiled against a different module ABI version.
1290
+ *
1291
+ * ```js
1292
+ * import { versions } from 'node:process';
1293
+ *
1294
+ * console.log(versions);
1295
+ * ```
1296
+ *
1297
+ * Will generate an object similar to:
1298
+ *
1299
+ * ```console
1300
+ * { node: '20.2.0',
1301
+ * acorn: '8.8.2',
1302
+ * ada: '2.4.0',
1303
+ * ares: '1.19.0',
1304
+ * base64: '0.5.0',
1305
+ * brotli: '1.0.9',
1306
+ * cjs_module_lexer: '1.2.2',
1307
+ * cldr: '43.0',
1308
+ * icu: '73.1',
1309
+ * llhttp: '8.1.0',
1310
+ * modules: '115',
1311
+ * napi: '8',
1312
+ * nghttp2: '1.52.0',
1313
+ * nghttp3: '0.7.0',
1314
+ * ngtcp2: '0.8.1',
1315
+ * openssl: '3.0.8+quic',
1316
+ * simdutf: '3.2.9',
1317
+ * tz: '2023c',
1318
+ * undici: '5.22.0',
1319
+ * unicode: '15.0',
1320
+ * uv: '1.44.2',
1321
+ * uvwasi: '0.0.16',
1322
+ * v8: '11.3.244.8-node.9',
1323
+ * zlib: '1.2.13' }
1324
+ * ```
1325
+ * @since v0.2.0
1326
+ */
1327
+ readonly versions: ProcessVersions;
1328
+ /**
1329
+ * The `process.config` property returns a frozen `Object` containing the
1330
+ * JavaScript representation of the configure options used to compile the current
1331
+ * Node.js executable. This is the same as the `config.gypi` file that was produced
1332
+ * when running the `./configure` script.
1333
+ *
1334
+ * An example of the possible output looks like:
1335
+ *
1336
+ * ```js
1337
+ * {
1338
+ * target_defaults:
1339
+ * { cflags: [],
1340
+ * default_configuration: 'Release',
1341
+ * defines: [],
1342
+ * include_dirs: [],
1343
+ * libraries: [] },
1344
+ * variables:
1345
+ * {
1346
+ * host_arch: 'x64',
1347
+ * napi_build_version: 5,
1348
+ * node_install_npm: 'true',
1349
+ * node_prefix: '',
1350
+ * node_shared_cares: 'false',
1351
+ * node_shared_http_parser: 'false',
1352
+ * node_shared_libuv: 'false',
1353
+ * node_shared_zlib: 'false',
1354
+ * node_use_openssl: 'true',
1355
+ * node_shared_openssl: 'false',
1356
+ * strict_aliasing: 'true',
1357
+ * target_arch: 'x64',
1358
+ * v8_use_snapshot: 1
1359
+ * }
1360
+ * }
1361
+ * ```
1362
+ * @since v0.7.7
1363
+ */
1364
+ readonly config: ProcessConfig;
1365
+ /**
1366
+ * The `process.kill()` method sends the `signal` to the process identified by`pid`.
1367
+ *
1368
+ * 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.
1369
+ *
1370
+ * This method will throw an error if the target `pid` does not exist. As a special
1371
+ * case, a signal of `0` can be used to test for the existence of a process.
1372
+ * Windows platforms will throw an error if the `pid` is used to kill a process
1373
+ * group.
1374
+ *
1375
+ * Even though the name of this function is `process.kill()`, it is really just a
1376
+ * signal sender, like the `kill` system call. The signal sent may do something
1377
+ * other than kill the target process.
1378
+ *
1379
+ * ```js
1380
+ * import process, { kill } from 'node:process';
1381
+ *
1382
+ * process.on('SIGHUP', () => {
1383
+ * console.log('Got SIGHUP signal.');
1384
+ * });
1385
+ *
1386
+ * setTimeout(() => {
1387
+ * console.log('Exiting.');
1388
+ * process.exit(0);
1389
+ * }, 100);
1390
+ *
1391
+ * kill(process.pid, 'SIGHUP');
1392
+ * ```
1393
+ *
1394
+ * When `SIGUSR1` is received by a Node.js process, Node.js will start the
1395
+ * debugger. See `Signal Events`.
1396
+ * @since v0.0.6
1397
+ * @param pid A process ID
1398
+ * @param [signal='SIGTERM'] The signal to send, either as a string or number.
1399
+ */
1400
+ kill(pid: number, signal?: string | number): true;
1401
+ /**
1402
+ * Loads the environment configuration from a `.env` file into `process.env`. If
1403
+ * the file is not found, error will be thrown.
1404
+ *
1405
+ * To load a specific .env file by specifying its path, use the following code:
1406
+ *
1407
+ * ```js
1408
+ * import { loadEnvFile } from 'node:process';
1409
+ *
1410
+ * loadEnvFile('./development.env')
1411
+ * ```
1412
+ * @since v20.12.0
1413
+ * @param path The path to the .env file
1414
+ */
1415
+ loadEnvFile(path?: string | URL | Buffer): void;
1416
+ /**
1417
+ * The `process.pid` property returns the PID of the process.
1418
+ *
1419
+ * ```js
1420
+ * import { pid } from 'node:process';
1421
+ *
1422
+ * console.log(`This process is pid ${pid}`);
1423
+ * ```
1424
+ * @since v0.1.15
1425
+ */
1426
+ readonly pid: number;
1427
+ /**
1428
+ * The `process.ppid` property returns the PID of the parent of the
1429
+ * current process.
1430
+ *
1431
+ * ```js
1432
+ * import { ppid } from 'node:process';
1433
+ *
1434
+ * console.log(`The parent process is pid ${ppid}`);
1435
+ * ```
1436
+ * @since v9.2.0, v8.10.0, v6.13.0
1437
+ */
1438
+ readonly ppid: number;
1439
+ /**
1440
+ * The `process.threadCpuUsage()` method returns the user and system CPU time usage of
1441
+ * the current worker thread, in an object with properties `user` and `system`, whose
1442
+ * values are microsecond values (millionth of a second).
1443
+ *
1444
+ * The result of a previous call to `process.threadCpuUsage()` can be passed as the
1445
+ * argument to the function, to get a diff reading.
1446
+ * @since v23.9.0
1447
+ * @param previousValue A previous return value from calling
1448
+ * `process.threadCpuUsage()`
1449
+ */
1450
+ threadCpuUsage(previousValue?: CpuUsage): CpuUsage;
1451
+ /**
1452
+ * The `process.title` property returns the current process title (i.e. returns
1453
+ * the current value of `ps`). Assigning a new value to `process.title` modifies
1454
+ * the current value of `ps`.
1455
+ *
1456
+ * When a new value is assigned, different platforms will impose different maximum
1457
+ * length restrictions on the title. Usually such restrictions are quite limited.
1458
+ * For instance, on Linux and macOS, `process.title` is limited to the size of the
1459
+ * 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
1460
+ * allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure)
1461
+ * cases.
1462
+ *
1463
+ * Assigning a value to `process.title` might not result in an accurate label
1464
+ * within process manager applications such as macOS Activity Monitor or Windows
1465
+ * Services Manager.
1466
+ * @since v0.1.104
1467
+ */
1468
+ title: string;
1469
+ /**
1470
+ * The operating system CPU architecture for which the Node.js binary was compiled.
1471
+ * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,
1472
+ * `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`.
1473
+ *
1474
+ * ```js
1475
+ * import { arch } from 'node:process';
1476
+ *
1477
+ * console.log(`This processor architecture is ${arch}`);
1478
+ * ```
1479
+ * @since v0.5.0
1480
+ */
1481
+ readonly arch: Architecture;
1482
+ /**
1483
+ * The `process.platform` property returns a string identifying the operating
1484
+ * system platform for which the Node.js binary was compiled.
1485
+ *
1486
+ * Currently possible values are:
1487
+ *
1488
+ * * `'aix'`
1489
+ * * `'darwin'`
1490
+ * * `'freebsd'`
1491
+ * * `'linux'`
1492
+ * * `'openbsd'`
1493
+ * * `'sunos'`
1494
+ * * `'win32'`
1495
+ *
1496
+ * ```js
1497
+ * import { platform } from 'node:process';
1498
+ *
1499
+ * console.log(`This platform is ${platform}`);
1500
+ * ```
1501
+ *
1502
+ * The value `'android'` may also be returned if the Node.js is built on the
1503
+ * 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).
1504
+ * @since v0.1.16
1505
+ */
1506
+ readonly platform: Platform;
1507
+ /**
1508
+ * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at
1509
+ * runtime, `require.main` may still refer to the original main module in
1510
+ * modules that were required before the change occurred. Generally, it's
1511
+ * safe to assume that the two refer to the same module.
1512
+ *
1513
+ * As with `require.main`, `process.mainModule` will be `undefined` if there
1514
+ * is no entry script.
1515
+ * @since v0.1.17
1516
+ * @deprecated Since v14.0.0 - Use `main` instead.
1517
+ */
1518
+ mainModule?: Module | undefined;
1519
+ memoryUsage: MemoryUsageFn;
1520
+ /**
1521
+ * Gets the amount of memory available to the process (in bytes) based on
1522
+ * limits imposed by the OS. If there is no such constraint, or the constraint
1523
+ * is unknown, `0` is returned.
1524
+ *
1525
+ * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
1526
+ * information.
1527
+ * @since v19.6.0, v18.15.0
1528
+ */
1529
+ constrainedMemory(): number;
1530
+ /**
1531
+ * Gets the amount of free memory that is still available to the process (in bytes).
1532
+ * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v24.x/api/process.html#processavailablememory) for more information.
1533
+ * @since v20.13.0
1534
+ */
1535
+ availableMemory(): number;
1536
+ /**
1537
+ * The `process.cpuUsage()` method returns the user and system CPU time usage of
1538
+ * the current process, in an object with properties `user` and `system`, whose
1539
+ * values are microsecond values (millionth of a second). These values measure time
1540
+ * spent in user and system code respectively, and may end up being greater than
1541
+ * actual elapsed time if multiple CPU cores are performing work for this process.
1542
+ *
1543
+ * The result of a previous call to `process.cpuUsage()` can be passed as the
1544
+ * argument to the function, to get a diff reading.
1545
+ *
1546
+ * ```js
1547
+ * import { cpuUsage } from 'node:process';
1548
+ *
1549
+ * const startUsage = cpuUsage();
1550
+ * // { user: 38579, system: 6986 }
1551
+ *
1552
+ * // spin the CPU for 500 milliseconds
1553
+ * const now = Date.now();
1554
+ * while (Date.now() - now < 500);
1555
+ *
1556
+ * console.log(cpuUsage(startUsage));
1557
+ * // { user: 514883, system: 11226 }
1558
+ * ```
1559
+ * @since v6.1.0
1560
+ * @param previousValue A previous return value from calling `process.cpuUsage()`
1561
+ */
1562
+ cpuUsage(previousValue?: CpuUsage): CpuUsage;
1563
+ /**
1564
+ * `process.nextTick()` adds `callback` to the "next tick queue". This queue is
1565
+ * fully drained after the current operation on the JavaScript stack runs to
1566
+ * completion and before the event loop is allowed to continue. It's possible to
1567
+ * create an infinite loop if one were to recursively call `process.nextTick()`.
1568
+ * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
1569
+ *
1570
+ * ```js
1571
+ * import { nextTick } from 'node:process';
1572
+ *
1573
+ * console.log('start');
1574
+ * nextTick(() => {
1575
+ * console.log('nextTick callback');
1576
+ * });
1577
+ * console.log('scheduled');
1578
+ * // Output:
1579
+ * // start
1580
+ * // scheduled
1581
+ * // nextTick callback
1582
+ * ```
1583
+ *
1584
+ * This is important when developing APIs in order to give users the opportunity
1585
+ * to assign event handlers _after_ an object has been constructed but before any
1586
+ * I/O has occurred:
1587
+ *
1588
+ * ```js
1589
+ * import { nextTick } from 'node:process';
1590
+ *
1591
+ * function MyThing(options) {
1592
+ * this.setupOptions(options);
1593
+ *
1594
+ * nextTick(() => {
1595
+ * this.startDoingStuff();
1596
+ * });
1597
+ * }
1598
+ *
1599
+ * const thing = new MyThing();
1600
+ * thing.getReadyForStuff();
1601
+ *
1602
+ * // thing.startDoingStuff() gets called now, not before.
1603
+ * ```
1604
+ *
1605
+ * It is very important for APIs to be either 100% synchronous or 100%
1606
+ * asynchronous. Consider this example:
1607
+ *
1608
+ * ```js
1609
+ * // WARNING! DO NOT USE! BAD UNSAFE HAZARD!
1610
+ * function maybeSync(arg, cb) {
1611
+ * if (arg) {
1612
+ * cb();
1613
+ * return;
1614
+ * }
1615
+ *
1616
+ * fs.stat('file', cb);
1617
+ * }
1618
+ * ```
1619
+ *
1620
+ * This API is hazardous because in the following case:
1621
+ *
1622
+ * ```js
1623
+ * const maybeTrue = Math.random() > 0.5;
1624
+ *
1625
+ * maybeSync(maybeTrue, () => {
1626
+ * foo();
1627
+ * });
1628
+ *
1629
+ * bar();
1630
+ * ```
1631
+ *
1632
+ * It is not clear whether `foo()` or `bar()` will be called first.
1633
+ *
1634
+ * The following approach is much better:
1635
+ *
1636
+ * ```js
1637
+ * import { nextTick } from 'node:process';
1638
+ *
1639
+ * function definitelyAsync(arg, cb) {
1640
+ * if (arg) {
1641
+ * nextTick(cb);
1642
+ * return;
1643
+ * }
1644
+ *
1645
+ * fs.stat('file', cb);
1646
+ * }
1647
+ * ```
1648
+ * @since v0.1.26
1649
+ * @param args Additional arguments to pass when invoking the `callback`
1650
+ */
1651
+ nextTick(callback: Function, ...args: any[]): void;
1652
+ /**
1653
+ * This API is available through the [--permission](https://nodejs.org/api/cli.html#--permission) flag.
1654
+ *
1655
+ * `process.permission` is an object whose methods are used to manage permissions for the current process.
1656
+ * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model).
1657
+ * @since v20.0.0
1658
+ */
1659
+ permission: ProcessPermission;
1660
+ /**
1661
+ * The `process.release` property returns an `Object` containing metadata related
1662
+ * to the current release, including URLs for the source tarball and headers-only
1663
+ * tarball.
1664
+ *
1665
+ * `process.release` contains the following properties:
1666
+ *
1667
+ * ```js
1668
+ * {
1669
+ * name: 'node',
1670
+ * lts: 'Hydrogen',
1671
+ * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
1672
+ * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
1673
+ * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
1674
+ * }
1675
+ * ```
1676
+ *
1677
+ * In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be
1678
+ * relied upon to exist.
1679
+ * @since v3.0.0
1680
+ */
1681
+ readonly release: ProcessRelease;
1682
+ readonly features: ProcessFeatures;
1683
+ /**
1684
+ * `process.umask()` returns the Node.js process's file mode creation mask. Child
1685
+ * processes inherit the mask from the parent process.
1686
+ * @since v0.1.19
1687
+ * @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
1688
+ * security vulnerability. There is no safe, cross-platform alternative API.
1689
+ */
1690
+ umask(): number;
1691
+ /**
1692
+ * Can only be set if not in worker thread.
1693
+ */
1694
+ umask(mask: string | number): number;
1695
+ /**
1696
+ * The `process.uptime()` method returns the number of seconds the current Node.js
1697
+ * process has been running.
1698
+ *
1699
+ * The return value includes fractions of a second. Use `Math.floor()` to get whole
1700
+ * seconds.
1701
+ * @since v0.5.0
1702
+ */
1703
+ uptime(): number;
1704
+ hrtime: HRTime;
1705
+ /**
1706
+ * If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel.
1707
+ * If no IPC channel exists, this property is undefined.
1708
+ * @since v7.1.0
1709
+ */
1710
+ channel?: {
1711
+ /**
1712
+ * This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
1713
+ * @since v7.1.0
1714
+ */
1715
+ ref(): void;
1716
+ /**
1717
+ * 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.
1718
+ * @since v7.1.0
1719
+ */
1720
+ unref(): void;
1721
+ };
1722
+ /**
1723
+ * If Node.js is spawned with an IPC channel, the `process.send()` method can be
1724
+ * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
1725
+ *
1726
+ * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
1727
+ *
1728
+ * The message goes through serialization and parsing. The resulting message might
1729
+ * not be the same as what is originally sent.
1730
+ * @since v0.5.9
1731
+ * @param options used to parameterize the sending of certain types of handles. `options` supports the following properties:
1732
+ */
1733
+ send?(
1734
+ message: any,
1735
+ sendHandle?: any,
1736
+ options?: {
1737
+ keepOpen?: boolean | undefined;
1738
+ },
1739
+ callback?: (error: Error | null) => void,
1740
+ ): boolean;
1741
+ /**
1742
+ * 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
1743
+ * IPC channel to the parent process, allowing the child process to exit gracefully
1744
+ * once there are no other connections keeping it alive.
1745
+ *
1746
+ * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process.
1747
+ *
1748
+ * If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`.
1749
+ * @since v0.7.2
1750
+ */
1751
+ disconnect(): void;
1752
+ /**
1753
+ * 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
1754
+ * channel is connected and will return `false` after `process.disconnect()` is called.
1755
+ *
1756
+ * Once `process.connected` is `false`, it is no longer possible to send messages
1757
+ * over the IPC channel using `process.send()`.
1758
+ * @since v0.7.2
1759
+ */
1760
+ connected: boolean;
1761
+ /**
1762
+ * The `process.allowedNodeEnvironmentFlags` property is a special,
1763
+ * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.
1764
+ *
1765
+ * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides `Set.prototype.has` to recognize several different possible flag
1766
+ * representations. `process.allowedNodeEnvironmentFlags.has()` will
1767
+ * return `true` in the following cases:
1768
+ *
1769
+ * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., `inspect-brk` for `--inspect-brk`, or `r` for `-r`.
1770
+ * * Flags passed through to V8 (as listed in `--v8-options`) may replace
1771
+ * one or more _non-leading_ dashes for an underscore, or vice-versa;
1772
+ * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,
1773
+ * etc.
1774
+ * * Flags may contain one or more equals (`=`) characters; all
1775
+ * characters after and including the first equals will be ignored;
1776
+ * e.g., `--stack-trace-limit=100`.
1777
+ * * Flags _must_ be allowable within `NODE_OPTIONS`.
1778
+ *
1779
+ * When iterating over `process.allowedNodeEnvironmentFlags`, flags will
1780
+ * appear only _once_; each will begin with one or more dashes. Flags
1781
+ * passed through to V8 will contain underscores instead of non-leading
1782
+ * dashes:
1783
+ *
1784
+ * ```js
1785
+ * import { allowedNodeEnvironmentFlags } from 'node:process';
1786
+ *
1787
+ * allowedNodeEnvironmentFlags.forEach((flag) => {
1788
+ * // -r
1789
+ * // --inspect-brk
1790
+ * // --abort_on_uncaught_exception
1791
+ * // ...
1792
+ * });
1793
+ * ```
1794
+ *
1795
+ * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail
1796
+ * silently.
1797
+ *
1798
+ * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will
1799
+ * contain what _would have_ been allowable.
1800
+ * @since v10.10.0
1801
+ */
1802
+ allowedNodeEnvironmentFlags: ReadonlySet<string>;
1803
+ /**
1804
+ * `process.report` is an object whose methods are used to generate diagnostic reports for the current process.
1805
+ * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v24.x/api/report.html).
1806
+ * @since v11.8.0
1807
+ */
1808
+ report: ProcessReport;
1809
+ /**
1810
+ * ```js
1811
+ * import { resourceUsage } from 'node:process';
1812
+ *
1813
+ * console.log(resourceUsage());
1814
+ * /*
1815
+ * Will output:
1816
+ * {
1817
+ * userCPUTime: 82872,
1818
+ * systemCPUTime: 4143,
1819
+ * maxRSS: 33164,
1820
+ * sharedMemorySize: 0,
1821
+ * unsharedDataSize: 0,
1822
+ * unsharedStackSize: 0,
1823
+ * minorPageFault: 2469,
1824
+ * majorPageFault: 0,
1825
+ * swappedOut: 0,
1826
+ * fsRead: 0,
1827
+ * fsWrite: 8,
1828
+ * ipcSent: 0,
1829
+ * ipcReceived: 0,
1830
+ * signalsCount: 0,
1831
+ * voluntaryContextSwitches: 79,
1832
+ * involuntaryContextSwitches: 1
1833
+ * }
1834
+ *
1835
+ * ```
1836
+ * @since v12.6.0
1837
+ * @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].
1838
+ */
1839
+ resourceUsage(): ResourceUsage;
1840
+ /**
1841
+ * The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation`
1842
+ * is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning()
1843
+ * method for more information.
1844
+ *
1845
+ * ```bash
1846
+ * $ node --throw-deprecation -p "process.throwDeprecation"
1847
+ * true
1848
+ * $ node -p "process.throwDeprecation"
1849
+ * undefined
1850
+ * $ node
1851
+ * > process.emitWarning('test', 'DeprecationWarning');
1852
+ * undefined
1853
+ * > (node:26598) DeprecationWarning: test
1854
+ * > process.throwDeprecation = true;
1855
+ * true
1856
+ * > process.emitWarning('test', 'DeprecationWarning');
1857
+ * Thrown:
1858
+ * [DeprecationWarning: test] { name: 'DeprecationWarning' }
1859
+ * ```
1860
+ * @since v0.9.12
1861
+ */
1862
+ throwDeprecation: boolean;
1863
+ /**
1864
+ * The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the
1865
+ * documentation for the `'warning' event` and the `emitWarning() method` for more information about this
1866
+ * flag's behavior.
1867
+ * @since v0.8.0
1868
+ */
1869
+ traceDeprecation: boolean;
1870
+ /**
1871
+ * An object is "refable" if it implements the Node.js "Refable protocol".
1872
+ * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')`
1873
+ * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js
1874
+ * event loop alive, while "unref'd" objects will not. Historically, this was
1875
+ * implemented by using `ref()` and `unref()` methods directly on the objects.
1876
+ * This pattern, however, is being deprecated in favor of the "Refable protocol"
1877
+ * in order to better support Web Platform API types whose APIs cannot be modified
1878
+ * to add `ref()` and `unref()` methods but still need to support that behavior.
1879
+ * @since v22.14.0
1880
+ * @experimental
1881
+ * @param maybeRefable An object that may be "refable".
1882
+ */
1883
+ ref(maybeRefable: any): void;
1884
+ /**
1885
+ * An object is "unrefable" if it implements the Node.js "Refable protocol".
1886
+ * Specifically, this means that the object implements the `Symbol.for('nodejs.ref')`
1887
+ * and `Symbol.for('nodejs.unref')` methods. "Ref'd" objects will keep the Node.js
1888
+ * event loop alive, while "unref'd" objects will not. Historically, this was
1889
+ * implemented by using `ref()` and `unref()` methods directly on the objects.
1890
+ * This pattern, however, is being deprecated in favor of the "Refable protocol"
1891
+ * in order to better support Web Platform API types whose APIs cannot be modified
1892
+ * to add `ref()` and `unref()` methods but still need to support that behavior.
1893
+ * @since v22.14.0
1894
+ * @experimental
1895
+ * @param maybeRefable An object that may be "unref'd".
1896
+ */
1897
+ unref(maybeRefable: any): void;
1898
+ /**
1899
+ * Replaces the current process with a new process.
1900
+ *
1901
+ * This is achieved by using the `execve` POSIX function and therefore no memory or other
1902
+ * resources from the current process are preserved, except for the standard input,
1903
+ * standard output and standard error file descriptor.
1904
+ *
1905
+ * All other resources are discarded by the system when the processes are swapped, without triggering
1906
+ * any exit or close events and without running any cleanup handler.
1907
+ *
1908
+ * This function will never return, unless an error occurred.
1909
+ *
1910
+ * This function is not available on Windows or IBM i.
1911
+ * @since v22.15.0
1912
+ * @experimental
1913
+ * @param file The name or path of the executable file to run.
1914
+ * @param args List of string arguments. No argument can contain a null-byte (`\u0000`).
1915
+ * @param env Environment key-value pairs.
1916
+ * No key or value can contain a null-byte (`\u0000`).
1917
+ * **Default:** `process.env`.
1918
+ */
1919
+ execve?(file: string, args?: readonly string[], env?: ProcessEnv): never;
1920
+ /* EventEmitter */
1921
+ addListener(event: "beforeExit", listener: BeforeExitListener): this;
1922
+ addListener(event: "disconnect", listener: DisconnectListener): this;
1923
+ addListener(event: "exit", listener: ExitListener): this;
1924
+ addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1925
+ addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1926
+ addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1927
+ addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1928
+ addListener(event: "warning", listener: WarningListener): this;
1929
+ addListener(event: "message", listener: MessageListener): this;
1930
+ addListener(event: Signals, listener: SignalsListener): this;
1931
+ addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1932
+ addListener(event: "worker", listener: WorkerListener): this;
1933
+ emit(event: "beforeExit", code: number): boolean;
1934
+ emit(event: "disconnect"): boolean;
1935
+ emit(event: "exit", code: number): boolean;
1936
+ emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
1937
+ emit(event: "uncaughtException", error: Error): boolean;
1938
+ emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
1939
+ emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
1940
+ emit(event: "warning", warning: Error): boolean;
1941
+ emit(event: "message", message: unknown, sendHandle: unknown): this;
1942
+ emit(event: Signals, signal?: Signals): boolean;
1943
+ emit(
1944
+ event: "multipleResolves",
1945
+ type: MultipleResolveType,
1946
+ promise: Promise<unknown>,
1947
+ value: unknown,
1948
+ ): this;
1949
+ emit(event: "worker", listener: WorkerListener): this;
1950
+ on(event: "beforeExit", listener: BeforeExitListener): this;
1951
+ on(event: "disconnect", listener: DisconnectListener): this;
1952
+ on(event: "exit", listener: ExitListener): this;
1953
+ on(event: "rejectionHandled", listener: RejectionHandledListener): this;
1954
+ on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1955
+ on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1956
+ on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1957
+ on(event: "warning", listener: WarningListener): this;
1958
+ on(event: "message", listener: MessageListener): this;
1959
+ on(event: Signals, listener: SignalsListener): this;
1960
+ on(event: "multipleResolves", listener: MultipleResolveListener): this;
1961
+ on(event: "worker", listener: WorkerListener): this;
1962
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
1963
+ once(event: "beforeExit", listener: BeforeExitListener): this;
1964
+ once(event: "disconnect", listener: DisconnectListener): this;
1965
+ once(event: "exit", listener: ExitListener): this;
1966
+ once(event: "rejectionHandled", listener: RejectionHandledListener): this;
1967
+ once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1968
+ once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1969
+ once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1970
+ once(event: "warning", listener: WarningListener): this;
1971
+ once(event: "message", listener: MessageListener): this;
1972
+ once(event: Signals, listener: SignalsListener): this;
1973
+ once(event: "multipleResolves", listener: MultipleResolveListener): this;
1974
+ once(event: "worker", listener: WorkerListener): this;
1975
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
1976
+ prependListener(event: "beforeExit", listener: BeforeExitListener): this;
1977
+ prependListener(event: "disconnect", listener: DisconnectListener): this;
1978
+ prependListener(event: "exit", listener: ExitListener): this;
1979
+ prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1980
+ prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1981
+ prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1982
+ prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1983
+ prependListener(event: "warning", listener: WarningListener): this;
1984
+ prependListener(event: "message", listener: MessageListener): this;
1985
+ prependListener(event: Signals, listener: SignalsListener): this;
1986
+ prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1987
+ prependListener(event: "worker", listener: WorkerListener): this;
1988
+ prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
1989
+ prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
1990
+ prependOnceListener(event: "exit", listener: ExitListener): this;
1991
+ prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1992
+ prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1993
+ prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1994
+ prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1995
+ prependOnceListener(event: "warning", listener: WarningListener): this;
1996
+ prependOnceListener(event: "message", listener: MessageListener): this;
1997
+ prependOnceListener(event: Signals, listener: SignalsListener): this;
1998
+ prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1999
+ prependOnceListener(event: "worker", listener: WorkerListener): this;
2000
+ listeners(event: "beforeExit"): BeforeExitListener[];
2001
+ listeners(event: "disconnect"): DisconnectListener[];
2002
+ listeners(event: "exit"): ExitListener[];
2003
+ listeners(event: "rejectionHandled"): RejectionHandledListener[];
2004
+ listeners(event: "uncaughtException"): UncaughtExceptionListener[];
2005
+ listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
2006
+ listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
2007
+ listeners(event: "warning"): WarningListener[];
2008
+ listeners(event: "message"): MessageListener[];
2009
+ listeners(event: Signals): SignalsListener[];
2010
+ listeners(event: "multipleResolves"): MultipleResolveListener[];
2011
+ listeners(event: "worker"): WorkerListener[];
2012
+ }
2013
+ }
2014
+ }
2015
+ export = process;
2016
+ }