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