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