Pinsave/counterstrike
1
1declare module "process" {2 import * as tty from "node:tty";3 import { Worker } from "node:worker_threads";4 5 interface BuiltInModule {6 "assert": typeof import("assert");7 "node:assert": typeof import("node:assert");8 "assert/strict": typeof import("assert/strict");9 "node:assert/strict": typeof import("node:assert/strict");10 "async_hooks": typeof import("async_hooks");11 "node:async_hooks": typeof import("node:async_hooks");12 "buffer": typeof import("buffer");13 "node:buffer": typeof import("node:buffer");14 "child_process": typeof import("child_process");15 "node:child_process": typeof import("node:child_process");16 "cluster": typeof import("cluster");17 "node:cluster": typeof import("node:cluster");18 "console": typeof import("console");19 "node:console": typeof import("node:console");20 "constants": typeof import("constants");21 "node:constants": typeof import("node:constants");22 "crypto": typeof import("crypto");23 "node:crypto": typeof import("node:crypto");24 "dgram": typeof import("dgram");25 "node:dgram": typeof import("node:dgram");26 "diagnostics_channel": typeof import("diagnostics_channel");27 "node:diagnostics_channel": typeof import("node:diagnostics_channel");28 "dns": typeof import("dns");29 "node:dns": typeof import("node:dns");30 "dns/promises": typeof import("dns/promises");31 "node:dns/promises": typeof import("node:dns/promises");32 "domain": typeof import("domain");33 "node:domain": typeof import("node:domain");34 "events": typeof import("events");35 "node:events": typeof import("node:events");36 "fs": typeof import("fs");37 "node:fs": typeof import("node:fs");38 "fs/promises": typeof import("fs/promises");39 "node:fs/promises": typeof import("node:fs/promises");40 "http": typeof import("http");41 "node:http": typeof import("node:http");42 "http2": typeof import("http2");43 "node:http2": typeof import("node:http2");44 "https": typeof import("https");45 "node:https": typeof import("node:https");46 "inspector": typeof import("inspector");47 "node:inspector": typeof import("node:inspector");48 "inspector/promises": typeof import("inspector/promises");49 "node:inspector/promises": typeof import("node:inspector/promises");50 "module": typeof import("module");51 "node:module": typeof import("node:module");52 "net": typeof import("net");53 "node:net": typeof import("node:net");54 "os": typeof import("os");55 "node:os": typeof import("node:os");56 "path": typeof import("path");57 "node:path": typeof import("node:path");58 "path/posix": typeof import("path/posix");59 "node:path/posix": typeof import("node:path/posix");60 "path/win32": typeof import("path/win32");61 "node:path/win32": typeof import("node:path/win32");62 "perf_hooks": typeof import("perf_hooks");63 "node:perf_hooks": typeof import("node:perf_hooks");64 "process": typeof import("process");65 "node:process": typeof import("node:process");66 "punycode": typeof import("punycode");67 "node:punycode": typeof import("node:punycode");68 "querystring": typeof import("querystring");69 "node:querystring": typeof import("node:querystring");70 "readline": typeof import("readline");71 "node:readline": typeof import("node:readline");72 "readline/promises": typeof import("readline/promises");73 "node:readline/promises": typeof import("node:readline/promises");74 "repl": typeof import("repl");75 "node:repl": typeof import("node:repl");76 "node:sea": typeof import("node:sea");77 "node:sqlite": typeof import("node:sqlite");78 "stream": typeof import("stream");79 "node:stream": typeof import("node:stream");80 "stream/consumers": typeof import("stream/consumers");81 "node:stream/consumers": typeof import("node:stream/consumers");82 "stream/promises": typeof import("stream/promises");83 "node:stream/promises": typeof import("node:stream/promises");84 "stream/web": typeof import("stream/web");85 "node:stream/web": typeof import("node:stream/web");86 "string_decoder": typeof import("string_decoder");87 "node:string_decoder": typeof import("node:string_decoder");88 "node:test": typeof import("node:test");89 "node:test/reporters": typeof import("node:test/reporters");90 "timers": typeof import("timers");91 "node:timers": typeof import("node:timers");92 "timers/promises": typeof import("timers/promises");93 "node:timers/promises": typeof import("node:timers/promises");94 "tls": typeof import("tls");95 "node:tls": typeof import("node:tls");96 "trace_events": typeof import("trace_events");97 "node:trace_events": typeof import("node:trace_events");98 "tty": typeof import("tty");99 "node:tty": typeof import("node:tty");100 "url": typeof import("url");101 "node:url": typeof import("node:url");102 "util": typeof import("util");103 "node:util": typeof import("node:util");104 "sys": typeof import("util");105 "node:sys": typeof import("node:util");106 "util/types": typeof import("util/types");107 "node:util/types": typeof import("node:util/types");108 "v8": typeof import("v8");109 "node:v8": typeof import("node:v8");110 "vm": typeof import("vm");111 "node:vm": typeof import("node:vm");112 "wasi": typeof import("wasi");113 "node:wasi": typeof import("node:wasi");114 "worker_threads": typeof import("worker_threads");115 "node:worker_threads": typeof import("node:worker_threads");116 "zlib": typeof import("zlib");117 "node:zlib": typeof import("node:zlib");118 }119 global {120 var process: NodeJS.Process;121 namespace NodeJS {122 // this namespace merge is here because these are specifically used123 // as the type for process.stdin, process.stdout, and process.stderr.124 // they can't live in tty.d.ts because we need to disambiguate the imported name.125 interface ReadStream extends tty.ReadStream {}126 interface WriteStream extends tty.WriteStream {}127 interface MemoryUsageFn {128 /**129 * The `process.memoryUsage()` method iterate over each page to gather informations about memory130 * usage which can be slow depending on the program memory allocations.131 */132 (): MemoryUsage;133 /**134 * method returns an integer representing the Resident Set Size (RSS) in bytes.135 */136 rss(): number;137 }138 interface MemoryUsage {139 /**140 * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the141 * process, including all C++ and JavaScript objects and code.142 */143 rss: number;144 /**145 * Refers to V8's memory usage.146 */147 heapTotal: number;148 /**149 * Refers to V8's memory usage.150 */151 heapUsed: number;152 external: number;153 /**154 * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included155 * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s156 * may not be tracked in that case.157 */158 arrayBuffers: number;159 }160 interface CpuUsage {161 user: number;162 system: number;163 }164 interface ProcessRelease {165 name: string;166 sourceUrl?: string | undefined;167 headersUrl?: string | undefined;168 libUrl?: string | undefined;169 lts?: string | undefined;170 }171 interface ProcessFeatures {172 /**173 * A boolean value that is `true` if the current Node.js build is caching builtin modules.174 * @since v12.0.0175 */176 readonly cached_builtins: boolean;177 /**178 * A boolean value that is `true` if the current Node.js build is a debug build.179 * @since v0.5.5180 */181 readonly debug: boolean;182 /**183 * A boolean value that is `true` if the current Node.js build includes the inspector.184 * @since v11.10.0185 */186 readonly inspector: boolean;187 /**188 * A boolean value that is `true` if the current Node.js build includes support for IPv6.189 *190 * Since all Node.js builds have IPv6 support, this value is always `true`.191 * @since v0.5.3192 * @deprecated This property is always true, and any checks based on it are redundant.193 */194 readonly ipv6: boolean;195 /**196 * A boolean value that is `true` if the current Node.js build supports197 * [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v24.x/api/modules.md#loading-ecmascript-modules-using-require).198 * @since v22.10.0199 */200 readonly require_module: boolean;201 /**202 * A boolean value that is `true` if the current Node.js build includes support for TLS.203 * @since v0.5.3204 */205 readonly tls: boolean;206 /**207 * A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.208 *209 * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional ALPN support.210 * This value is therefore identical to that of `process.features.tls`.211 * @since v4.8.0212 * @deprecated Use `process.features.tls` instead.213 */214 readonly tls_alpn: boolean;215 /**216 * A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.217 *218 * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional OCSP support.219 * This value is therefore identical to that of `process.features.tls`.220 * @since v0.11.13221 * @deprecated Use `process.features.tls` instead.222 */223 readonly tls_ocsp: boolean;224 /**225 * A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.226 *227 * In Node.js 11.0.0 and later versions, the OpenSSL dependencies feature unconditional SNI support.228 * This value is therefore identical to that of `process.features.tls`.229 * @since v0.5.3230 * @deprecated Use `process.features.tls` instead.231 */232 readonly tls_sni: boolean;233 /**234 * A value that is `"strip"` by default,235 * `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if236 * Node.js is run with `--no-experimental-strip-types`.237 * @since v22.10.0238 */239 readonly typescript: "strip" | "transform" | false;240 /**241 * A boolean value that is `true` if the current Node.js build includes support for libuv.242 *243 * Since it's not possible to build Node.js without libuv, this value is always `true`.244 * @since v0.5.3245 * @deprecated This property is always true, and any checks based on it are redundant.246 */247 readonly uv: boolean;248 }249 interface ProcessVersions extends Dict<string> {250 http_parser: string;251 node: string;252 v8: string;253 ares: string;254 uv: string;255 zlib: string;256 modules: string;257 openssl: string;258 }259 type Platform =260 | "aix"261 | "android"262 | "darwin"263 | "freebsd"264 | "haiku"265 | "linux"266 | "openbsd"267 | "sunos"268 | "win32"269 | "cygwin"270 | "netbsd";271 type Architecture =272 | "arm"273 | "arm64"274 | "ia32"275 | "loong64"276 | "mips"277 | "mipsel"278 | "ppc64"279 | "riscv64"280 | "s390x"281 | "x64";282 type Signals =283 | "SIGABRT"284 | "SIGALRM"285 | "SIGBUS"286 | "SIGCHLD"287 | "SIGCONT"288 | "SIGFPE"289 | "SIGHUP"290 | "SIGILL"291 | "SIGINT"292 | "SIGIO"293 | "SIGIOT"294 | "SIGKILL"295 | "SIGPIPE"296 | "SIGPOLL"297 | "SIGPROF"298 | "SIGPWR"299 | "SIGQUIT"300 | "SIGSEGV"301 | "SIGSTKFLT"302 | "SIGSTOP"303 | "SIGSYS"304 | "SIGTERM"305 | "SIGTRAP"306 | "SIGTSTP"307 | "SIGTTIN"308 | "SIGTTOU"309 | "SIGUNUSED"310 | "SIGURG"311 | "SIGUSR1"312 | "SIGUSR2"313 | "SIGVTALRM"314 | "SIGWINCH"315 | "SIGXCPU"316 | "SIGXFSZ"317 | "SIGBREAK"318 | "SIGLOST"319 | "SIGINFO";320 type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";321 type MultipleResolveType = "resolve" | "reject";322 type BeforeExitListener = (code: number) => void;323 type DisconnectListener = () => void;324 type ExitListener = (code: number) => void;325 type RejectionHandledListener = (promise: Promise<unknown>) => void;326 type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;327 /**328 * Most of the time the unhandledRejection will be an Error, but this should not be relied upon329 * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.330 */331 type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;332 type WarningListener = (warning: Error) => void;333 type MessageListener = (message: unknown, sendHandle: unknown) => void;334 type SignalsListener = (signal: Signals) => void;335 type MultipleResolveListener = (336 type: MultipleResolveType,337 promise: Promise<unknown>,338 value: unknown,339 ) => void;340 type WorkerListener = (worker: Worker) => void;341 interface Socket extends ReadWriteStream {342 isTTY?: true | undefined;343 }344 // Alias for compatibility345 interface ProcessEnv extends Dict<string> {346 /**347 * Can be used to change the default timezone at runtime348 */349 TZ?: string;350 }351 interface HRTime {352 /**353 * This is the legacy version of {@link process.hrtime.bigint()}354 * before bigint was introduced in JavaScript.355 *356 * The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,357 * where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.358 *359 * `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.360 * If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.361 * Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.362 *363 * These times are relative to an arbitrary time in the past,364 * and not related to the time of day and therefore not subject to clock drift.365 * The primary use is for measuring performance between intervals:366 * ```js367 * const { hrtime } = require('node:process');368 * const NS_PER_SEC = 1e9;369 * const time = hrtime();370 * // [ 1800216, 25 ]371 *372 * setTimeout(() => {373 * const diff = hrtime(time);374 * // [ 1, 552 ]375 *376 * console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);377 * // Benchmark took 1000000552 nanoseconds378 * }, 1000);379 * ```380 * @since 0.7.6381 * @legacy Use {@link process.hrtime.bigint()} instead.382 * @param time The result of a previous call to `process.hrtime()`383 */384 (time?: [number, number]): [number, number];385 /**386 * The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.387 *388 * 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.389 * ```js390 * import { hrtime } from 'node:process';391 *392 * const start = hrtime.bigint();393 * // 191051479007711n394 *395 * setTimeout(() => {396 * const end = hrtime.bigint();397 * // 191052633396993n398 *399 * console.log(`Benchmark took ${end - start} nanoseconds`);400 * // Benchmark took 1154389282 nanoseconds401 * }, 1000);402 * ```403 * @since v10.7.0404 */405 bigint(): bigint;406 }407 interface ProcessPermission {408 /**409 * Verifies that the process is able to access the given scope and reference.410 * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')`411 * will check if the process has ALL file system read permissions.412 *413 * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders.414 *415 * The available scopes are:416 *417 * * `fs` - All File System418 * * `fs.read` - File System read operations419 * * `fs.write` - File System write operations420 * * `child` - Child process spawning operations421 * * `worker` - Worker thread spawning operation422 *423 * ```js424 * // Check if the process has permission to read the README file425 * process.permission.has('fs.read', './README.md');426 * // Check if the process has read permission operations427 * process.permission.has('fs.read');428 * ```429 * @since v20.0.0430 */431 has(scope: string, reference?: string): boolean;432 }433 interface ProcessReport {434 /**435 * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems436 * than the default multi-line format designed for human consumption.437 * @since v13.12.0, v12.17.0438 */439 compact: boolean;440 /**441 * Directory where the report is written.442 * The default value is the empty string, indicating that reports are written to the current443 * working directory of the Node.js process.444 */445 directory: string;446 /**447 * Filename where the report is written. If set to the empty string, the output filename will be comprised448 * of a timestamp, PID, and sequence number. The default value is the empty string.449 */450 filename: string;451 /**452 * Returns a JavaScript Object representation of a diagnostic report for the running process.453 * The report's JavaScript stack trace is taken from `err`, if present.454 */455 getReport(err?: Error): object;456 /**457 * If true, a diagnostic report is generated on fatal errors,458 * such as out of memory errors or failed C++ assertions.459 * @default false460 */461 reportOnFatalError: boolean;462 /**463 * If true, a diagnostic report is generated when the process464 * receives the signal specified by process.report.signal.465 * @default false466 */467 reportOnSignal: boolean;468 /**469 * If true, a diagnostic report is generated on uncaught exception.470 * @default false471 */472 reportOnUncaughtException: boolean;473 /**474 * The signal used to trigger the creation of a diagnostic report.475 * @default 'SIGUSR2'476 */477 signal: Signals;478 /**479 * Writes a diagnostic report to a file. If filename is not provided, the default filename480 * includes the date, time, PID, and a sequence number.481 * The report's JavaScript stack trace is taken from `err`, if present.482 *483 * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written484 * to the stdout or stderr of the process respectively.485 * @param fileName Name of the file where the report is written.486 * This should be a relative path, that will be appended to the directory specified in487 * `process.report.directory`, or the current working directory of the Node.js process,488 * if unspecified.489 * @param err A custom error used for reporting the JavaScript stack.490 * @return Filename of the generated report.491 */492 writeReport(fileName?: string, err?: Error): string;493 writeReport(err?: Error): string;494 }495 interface ResourceUsage {496 fsRead: number;497 fsWrite: number;498 involuntaryContextSwitches: number;499 ipcReceived: number;500 ipcSent: number;501 majorPageFault: number;502 maxRSS: number;503 minorPageFault: number;504 sharedMemorySize: number;505 signalsCount: number;506 swappedOut: number;507 systemCPUTime: number;508 unsharedDataSize: number;509 unsharedStackSize: number;510 userCPUTime: number;511 voluntaryContextSwitches: number;512 }513 interface EmitWarningOptions {514 /**515 * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.516 *517 * @default 'Warning'518 */519 type?: string | undefined;520 /**521 * A unique identifier for the warning instance being emitted.522 */523 code?: string | undefined;524 /**525 * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.526 *527 * @default process.emitWarning528 */529 ctor?: Function | undefined;530 /**531 * Additional text to include with the error.532 */533 detail?: string | undefined;534 }535 interface ProcessConfig {536 readonly target_defaults: {537 readonly cflags: any[];538 readonly default_configuration: string;539 readonly defines: string[];540 readonly include_dirs: string[];541 readonly libraries: string[];542 };543 readonly variables: {544 readonly clang: number;545 readonly host_arch: string;546 readonly node_install_npm: boolean;547 readonly node_install_waf: boolean;548 readonly node_prefix: string;549 readonly node_shared_openssl: boolean;550 readonly node_shared_v8: boolean;551 readonly node_shared_zlib: boolean;552 readonly node_use_dtrace: boolean;553 readonly node_use_etw: boolean;554 readonly node_use_openssl: boolean;555 readonly target_arch: string;556 readonly v8_no_strict_aliasing: number;557 readonly v8_use_snapshot: boolean;558 readonly visibility: string;559 };560 }561 interface Process extends EventEmitter {562 /**563 * 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 is564 * a `Writable` stream.565 *566 * For example, to copy `process.stdin` to `process.stdout`:567 *568 * ```js569 * import { stdin, stdout } from 'node:process';570 *571 * stdin.pipe(stdout);572 * ```573 *574 * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.575 */576 stdout: WriteStream & {577 fd: 1;578 };579 /**580 * 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 is581 * a `Writable` stream.582 *583 * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information.584 */585 stderr: WriteStream & {586 fd: 2;587 };588 /**589 * 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 is590 * a `Readable` stream.591 *592 * For details of how to read from `stdin` see `readable.read()`.593 *594 * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that595 * is compatible with scripts written for Node.js prior to v0.10\.596 * For more information see `Stream compatibility`.597 *598 * In "old" streams mode the `stdin` stream is paused by default, so one599 * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode.600 */601 stdin: ReadStream & {602 fd: 0;603 };604 /**605 * The `process.argv` property returns an array containing the command-line606 * arguments passed when the Node.js process was launched. The first element will607 * be {@link execPath}. See `process.argv0` if access to the original value608 * of `argv[0]` is needed. The second element will be the path to the JavaScript609 * file being executed. The remaining elements will be any additional command-line610 * arguments.611 *612 * For example, assuming the following script for `process-args.js`:613 *614 * ```js615 * import { argv } from 'node:process';616 *617 * // print process.argv618 * argv.forEach((val, index) => {619 * console.log(`${index}: ${val}`);620 * });621 * ```622 *623 * Launching the Node.js process as:624 *625 * ```bash626 * node process-args.js one two=three four627 * ```628 *629 * Would generate the output:630 *631 * ```text632 * 0: /usr/local/bin/node633 * 1: /Users/mjr/work/node/process-args.js634 * 2: one635 * 3: two=three636 * 4: four637 * ```638 * @since v0.1.27639 */640 argv: string[];641 /**642 * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts.643 *644 * ```console645 * $ bash -c 'exec -a customArgv0 ./node'646 * > process.argv[0]647 * '/Volumes/code/external/node/out/Release/node'648 * > process.argv0649 * 'customArgv0'650 * ```651 * @since v6.4.0652 */653 argv0: string;654 /**655 * The `process.execArgv` property returns the set of Node.js-specific command-line656 * options passed when the Node.js process was launched. These options do not657 * appear in the array returned by the {@link argv} property, and do not658 * include the Node.js executable, the name of the script, or any options following659 * the script name. These options are useful in order to spawn child processes with660 * the same execution environment as the parent.661 *662 * ```bash663 * node --icu-data-dir=./foo --require ./bar.js script.js --version664 * ```665 *666 * Results in `process.execArgv`:667 *668 * ```js669 * ["--icu-data-dir=./foo", "--require", "./bar.js"]670 * ```671 *672 * And `process.argv`:673 *674 * ```js675 * ['/usr/local/bin/node', 'script.js', '--version']676 * ```677 *678 * Refer to `Worker constructor` for the detailed behavior of worker679 * threads with this property.680 * @since v0.7.7681 */682 execArgv: string[];683 /**684 * The `process.execPath` property returns the absolute pathname of the executable685 * that started the Node.js process. Symbolic links, if any, are resolved.686 *687 * ```js688 * '/usr/local/bin/node'689 * ```690 * @since v0.1.100691 */692 execPath: string;693 /**694 * The `process.abort()` method causes the Node.js process to exit immediately and695 * generate a core file.696 *697 * This feature is not available in `Worker` threads.698 * @since v0.7.0699 */700 abort(): never;701 /**702 * The `process.chdir()` method changes the current working directory of the703 * Node.js process or throws an exception if doing so fails (for instance, if704 * the specified `directory` does not exist).705 *706 * ```js707 * import { chdir, cwd } from 'node:process';708 *709 * console.log(`Starting directory: ${cwd()}`);710 * try {711 * chdir('/tmp');712 * console.log(`New directory: ${cwd()}`);713 * } catch (err) {714 * console.error(`chdir: ${err}`);715 * }716 * ```717 *718 * This feature is not available in `Worker` threads.719 * @since v0.1.17720 */721 chdir(directory: string): void;722 /**723 * The `process.cwd()` method returns the current working directory of the Node.js724 * process.725 *726 * ```js727 * import { cwd } from 'node:process';728 *729 * console.log(`Current directory: ${cwd()}`);730 * ```731 * @since v0.1.8732 */733 cwd(): string;734 /**735 * The port used by the Node.js debugger when enabled.736 *737 * ```js738 * import process from 'node:process';739 *740 * process.debugPort = 5858;741 * ```742 * @since v0.7.2743 */744 debugPort: number;745 /**746 * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and747 * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`748 * unless there are specific reasons such as custom dlopen flags or loading from ES modules.749 *750 * 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)`751 * documentation for details.752 *753 * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon754 * are then accessible via `module.exports`.755 *756 * 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.757 * In this example the constant is assumed to be available.758 *759 * ```js760 * import { dlopen } from 'node:process';761 * import { constants } from 'node:os';762 * import { fileURLToPath } from 'node:url';763 *764 * const module = { exports: {} };765 * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),766 * constants.dlopen.RTLD_NOW);767 * module.exports.foo();768 * ```769 */770 dlopen(module: object, filename: string, flags?: number): void;771 /**772 * The `process.emitWarning()` method can be used to emit custom or application773 * specific process warnings. These can be listened for by adding a handler to the `'warning'` event.774 *775 * ```js776 * import { emitWarning } from 'node:process';777 *778 * // Emit a warning using a string.779 * emitWarning('Something happened!');780 * // Emits: (node: 56338) Warning: Something happened!781 * ```782 *783 * ```js784 * import { emitWarning } from 'node:process';785 *786 * // Emit a warning using a string and a type.787 * emitWarning('Something Happened!', 'CustomWarning');788 * // Emits: (node:56338) CustomWarning: Something Happened!789 * ```790 *791 * ```js792 * import { emitWarning } from 'node:process';793 *794 * emitWarning('Something happened!', 'CustomWarning', 'WARN001');795 * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!796 * ```js797 *798 * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler.799 *800 * ```js801 * import process from 'node:process';802 *803 * process.on('warning', (warning) => {804 * console.warn(warning.name); // 'Warning'805 * console.warn(warning.message); // 'Something happened!'806 * console.warn(warning.code); // 'MY_WARNING'807 * console.warn(warning.stack); // Stack trace808 * console.warn(warning.detail); // 'This is some additional information'809 * });810 * ```811 *812 * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler813 * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored):814 *815 * ```js816 * import { emitWarning } from 'node:process';817 *818 * // Emit a warning using an Error object.819 * const myWarning = new Error('Something happened!');820 * // Use the Error name property to specify the type name821 * myWarning.name = 'CustomWarning';822 * myWarning.code = 'WARN001';823 *824 * emitWarning(myWarning);825 * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!826 * ```827 *828 * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object.829 *830 * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms.831 *832 * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`:833 * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event.834 * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed.835 * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace.836 * @since v8.0.0837 * @param warning The warning to emit.838 */839 emitWarning(warning: string | Error, ctor?: Function): void;840 emitWarning(warning: string | Error, type?: string, ctor?: Function): void;841 emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;842 emitWarning(warning: string | Error, options?: EmitWarningOptions): void;843 /**844 * The `process.env` property returns an object containing the user environment.845 * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).846 *847 * An example of this object looks like:848 *849 * ```js850 * {851 * TERM: 'xterm-256color',852 * SHELL: '/usr/local/bin/bash',853 * USER: 'maciej',854 * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',855 * PWD: '/Users/maciej',856 * EDITOR: 'vim',857 * SHLVL: '1',858 * HOME: '/Users/maciej',859 * LOGNAME: 'maciej',860 * _: '/usr/local/bin/node'861 * }862 * ```863 *864 * It is possible to modify this object, but such modifications will not be865 * reflected outside the Node.js process, or (unless explicitly requested)866 * to other `Worker` threads.867 * In other words, the following example would not work:868 *869 * ```bash870 * node -e 'process.env.foo = "bar"' && echo $foo871 * ```872 *873 * While the following will:874 *875 * ```js876 * import { env } from 'node:process';877 *878 * env.foo = 'bar';879 * console.log(env.foo);880 * ```881 *882 * Assigning a property on `process.env` will implicitly convert the value883 * to a string. **This behavior is deprecated.** Future versions of Node.js may884 * throw an error when the value is not a string, number, or boolean.885 *886 * ```js887 * import { env } from 'node:process';888 *889 * env.test = null;890 * console.log(env.test);891 * // => 'null'892 * env.test = undefined;893 * console.log(env.test);894 * // => 'undefined'895 * ```896 *897 * Use `delete` to delete a property from `process.env`.898 *899 * ```js900 * import { env } from 'node:process';901 *902 * env.TEST = 1;903 * delete env.TEST;904 * console.log(env.TEST);905 * // => undefined906 * ```907 *908 * On Windows operating systems, environment variables are case-insensitive.909 *910 * ```js911 * import { env } from 'node:process';912 *913 * env.TEST = 1;914 * console.log(env.test);915 * // => 1916 * ```917 *918 * Unless explicitly specified when creating a `Worker` instance,919 * each `Worker` thread has its own copy of `process.env`, based on its920 * parent thread's `process.env`, or whatever was specified as the `env` option921 * to the `Worker` constructor. Changes to `process.env` will not be visible922 * across `Worker` threads, and only the main thread can make changes that923 * 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 manner924 * unlike the main thread.925 * @since v0.1.27926 */927 env: ProcessEnv;928 /**929 * The `process.exit()` method instructs Node.js to terminate the process930 * synchronously with an exit status of `code`. If `code` is omitted, exit uses931 * either the 'success' code `0` or the value of `process.exitCode` if it has been932 * set. Node.js will not terminate until all the `'exit'` event listeners are933 * called.934 *935 * To exit with a 'failure' code:936 *937 * ```js938 * import { exit } from 'node:process';939 *940 * exit(1);941 * ```942 *943 * The shell that executed Node.js should see the exit code as `1`.944 *945 * Calling `process.exit()` will force the process to exit as quickly as possible946 * even if there are still asynchronous operations pending that have not yet947 * completed fully, including I/O operations to `process.stdout` and `process.stderr`.948 *949 * 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_950 * _work pending_ in the event loop. The `process.exitCode` property can be set to951 * tell the process which exit code to use when the process exits gracefully.952 *953 * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being954 * truncated and lost:955 *956 * ```js957 * import { exit } from 'node:process';958 *959 * // This is an example of what *not* to do:960 * if (someConditionNotMet()) {961 * printUsageToStdout();962 * exit(1);963 * }964 * ```965 *966 * The reason this is problematic is because writes to `process.stdout` in Node.js967 * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js968 * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.969 *970 * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding971 * scheduling any additional work for the event loop:972 *973 * ```js974 * import process from 'node:process';975 *976 * // How to properly set the exit code while letting977 * // the process exit gracefully.978 * if (someConditionNotMet()) {979 * printUsageToStdout();980 * process.exitCode = 1;981 * }982 * ```983 *984 * If it is necessary to terminate the Node.js process due to an error condition,985 * throwing an _uncaught_ error and allowing the process to terminate accordingly986 * is safer than calling `process.exit()`.987 *988 * In `Worker` threads, this function stops the current thread rather989 * than the current process.990 * @since v0.1.13991 * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.992 */993 exit(code?: number | string | null | undefined): never;994 /**995 * A number which will be the process exit code, when the process either996 * exits gracefully, or is exited via {@link exit} without specifying997 * a code.998 *999 * Specifying a code to {@link exit} will override any1000 * previous setting of `process.exitCode`.1001 * @default undefined1002 * @since v0.11.81003 */1004 exitCode?: number | string | number | undefined;1005 finalization: {1006 /**1007 * This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.1008 * 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.1009 *1010 * Inside the callback you can release the resources allocated by the `ref` object.1011 * Be aware that all limitations applied to the `beforeExit` event are also applied to the callback function,1012 * this means that there is a possibility that the callback will not be called under special circumstances.1013 *1014 * 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.1015 * @param ref The reference to the resource that is being tracked.1016 * @param callback The callback function to be called when the resource is finalized.1017 * @since v22.5.01018 * @experimental1019 */1020 register<T extends object>(ref: T, callback: (ref: T, event: "exit") => void): void;1021 /**1022 * 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.1023 *1024 * 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.1025 * @param ref The reference to the resource that is being tracked.1026 * @param callback The callback function to be called when the resource is finalized.1027 * @since v22.5.01028 * @experimental1029 */1030 registerBeforeExit<T extends object>(ref: T, callback: (ref: T, event: "beforeExit") => void): void;1031 /**1032 * This function remove the register of the object from the finalization registry, so the callback will not be called anymore.1033 * @param ref The reference to the resource that was registered previously.1034 * @since v22.5.01035 * @experimental1036 */1037 unregister(ref: object): void;1038 };1039 /**1040 * The `process.getActiveResourcesInfo()` method returns an array of strings containing1041 * the types of the active resources that are currently keeping the event loop alive.1042 *1043 * ```js1044 * import { getActiveResourcesInfo } from 'node:process';1045 * import { setTimeout } from 'node:timers';1046 1047 * console.log('Before:', getActiveResourcesInfo());1048 * setTimeout(() => {}, 1000);1049 * console.log('After:', getActiveResourcesInfo());1050 * // Prints:1051 * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]1052 * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]1053 * ```1054 * @since v17.3.0, v16.14.01055 */1056 getActiveResourcesInfo(): string[];1057 /**1058 * Provides a way to load built-in modules in a globally available function.1059 * @param id ID of the built-in module being requested.1060 */1061 getBuiltinModule<ID extends keyof BuiltInModule>(id: ID): BuiltInModule[ID];1062 getBuiltinModule(id: string): object | undefined;1063 /**1064 * The `process.getgid()` method returns the numerical group identity of the1065 * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)1066 *1067 * ```js1068 * import process from 'node:process';1069 *1070 * if (process.getgid) {1071 * console.log(`Current gid: ${process.getgid()}`);1072 * }1073 * ```1074 *1075 * This function is only available on POSIX platforms (i.e. not Windows or1076 * Android).1077 * @since v0.1.311078 */1079 getgid?: () => number;1080 /**1081 * 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 a1082 * numeric ID or a group name1083 * string. If a group name is specified, this method blocks while resolving the1084 * associated numeric ID.1085 *1086 * ```js1087 * import process from 'node:process';1088 *1089 * if (process.getgid && process.setgid) {1090 * console.log(`Current gid: ${process.getgid()}`);1091 * try {1092 * process.setgid(501);1093 * console.log(`New gid: ${process.getgid()}`);1094 * } catch (err) {1095 * console.log(`Failed to set gid: ${err}`);1096 * }1097 * }1098 * ```1099 *1100 * This function is only available on POSIX platforms (i.e. not Windows or1101 * Android).1102 * This feature is not available in `Worker` threads.1103 * @since v0.1.311104 * @param id The group name or ID1105 */1106 setgid?: (id: number | string) => void;1107 /**1108 * The `process.getuid()` method returns the numeric user identity of the process.1109 * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)1110 *1111 * ```js1112 * import process from 'node:process';1113 *1114 * if (process.getuid) {1115 * console.log(`Current uid: ${process.getuid()}`);1116 * }1117 * ```1118 *1119 * This function is only available on POSIX platforms (i.e. not Windows or1120 * Android).1121 * @since v0.1.281122 */1123 getuid?: () => number;1124 /**1125 * 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 a1126 * numeric ID or a username string.1127 * If a username is specified, the method blocks while resolving the associated1128 * numeric ID.1129 *1130 * ```js1131 * import process from 'node:process';1132 *1133 * if (process.getuid && process.setuid) {1134 * console.log(`Current uid: ${process.getuid()}`);1135 * try {1136 * process.setuid(501);1137 * console.log(`New uid: ${process.getuid()}`);1138 * } catch (err) {1139 * console.log(`Failed to set uid: ${err}`);1140 * }1141 * }1142 * ```1143 *1144 * This function is only available on POSIX platforms (i.e. not Windows or1145 * Android).1146 * This feature is not available in `Worker` threads.1147 * @since v0.1.281148 */1149 setuid?: (id: number | string) => void;1150 /**1151 * The `process.geteuid()` method returns the numerical effective user identity of1152 * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)1153 *1154 * ```js1155 * import process from 'node:process';1156 *1157 * if (process.geteuid) {1158 * console.log(`Current uid: ${process.geteuid()}`);1159 * }1160 * ```1161 *1162 * This function is only available on POSIX platforms (i.e. not Windows or1163 * Android).1164 * @since v2.0.01165 */1166 geteuid?: () => number;1167 /**1168 * The `process.seteuid()` method sets the effective user identity of the process.1169 * (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 username1170 * string. If a username is specified, the method blocks while resolving the1171 * associated numeric ID.1172 *1173 * ```js1174 * import process from 'node:process';1175 *1176 * if (process.geteuid && process.seteuid) {1177 * console.log(`Current uid: ${process.geteuid()}`);1178 * try {1179 * process.seteuid(501);1180 * console.log(`New uid: ${process.geteuid()}`);1181 * } catch (err) {1182 * console.log(`Failed to set uid: ${err}`);1183 * }1184 * }1185 * ```1186 *1187 * This function is only available on POSIX platforms (i.e. not Windows or1188 * Android).1189 * This feature is not available in `Worker` threads.1190 * @since v2.0.01191 * @param id A user name or ID1192 */1193 seteuid?: (id: number | string) => void;1194 /**1195 * The `process.getegid()` method returns the numerical effective group identity1196 * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)1197 *1198 * ```js1199 * import process from 'node:process';1200 *