@tothalex/cloud 0.0.40
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/package.json +19 -0
- package/src/abort.d.ts +69 -0
- package/src/assert.d.ts +39 -0
- package/src/buffer.d.ts +556 -0
- package/src/child_process.d.ts +447 -0
- package/src/crypto.d.ts +854 -0
- package/src/database.d.ts +0 -0
- package/src/dns.d.ts +99 -0
- package/src/events.d.ts +245 -0
- package/src/exceptions.d.ts +26 -0
- package/src/http.d.ts +325 -0
- package/src/index.d.ts +22 -0
- package/src/net.d.ts +488 -0
- package/src/os.d.ts +293 -0
- package/src/process.d.ts +379 -0
- package/src/stream.d.ts +366 -0
- package/src/string_decoder.d.ts +63 -0
- package/src/timers.d.ts +72 -0
- package/src/tty.d.ts +10 -0
- package/src/url.d.ts +774 -0
- package/src/util.d.ts +240 -0
- package/src/zlib.d.ts +149 -0
package/src/os.d.ts
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
declare module "os" {
|
|
2
|
+
interface CpuInfo {
|
|
3
|
+
model: string;
|
|
4
|
+
speed: number;
|
|
5
|
+
/** The number of milliseconds spent by the CPU in each mode cannot be obtained at this time. */
|
|
6
|
+
times: {
|
|
7
|
+
/** The number of milliseconds the CPU has spent in user mode. */
|
|
8
|
+
user: number;
|
|
9
|
+
/** The number of milliseconds the CPU has spent in nice mode. */
|
|
10
|
+
nice: number;
|
|
11
|
+
/** The number of milliseconds the CPU has spent in sys mode. */
|
|
12
|
+
sys: number;
|
|
13
|
+
/** The number of milliseconds the CPU has spent in idle mode. */
|
|
14
|
+
idle: number;
|
|
15
|
+
/** The number of milliseconds the CPU has spent in irq mode. */
|
|
16
|
+
irq: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface NetworkInterfaceBase {
|
|
20
|
+
address: string;
|
|
21
|
+
netmask: string;
|
|
22
|
+
mac: string;
|
|
23
|
+
internal: boolean;
|
|
24
|
+
cidr: string | null;
|
|
25
|
+
}
|
|
26
|
+
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
|
|
27
|
+
family: "IPv4";
|
|
28
|
+
scopeid?: undefined;
|
|
29
|
+
}
|
|
30
|
+
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
|
|
31
|
+
family: "IPv6";
|
|
32
|
+
scopeid: number;
|
|
33
|
+
}
|
|
34
|
+
interface UserInfo<T> {
|
|
35
|
+
username: T;
|
|
36
|
+
uid: number;
|
|
37
|
+
gid: number;
|
|
38
|
+
shell: T | null;
|
|
39
|
+
homedir: T;
|
|
40
|
+
}
|
|
41
|
+
type NetworkInterfaceInfo =
|
|
42
|
+
| NetworkInterfaceInfoIPv4
|
|
43
|
+
| NetworkInterfaceInfoIPv6;
|
|
44
|
+
/**
|
|
45
|
+
* Returns an estimate of the default amount of parallelism a program should use.
|
|
46
|
+
* Always returns a value greater than zero.
|
|
47
|
+
*/
|
|
48
|
+
function availableParallelism(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the operating system CPU architecture for which the LLRT binary was compiled.
|
|
51
|
+
* Possible values are 'arm64', 'x64'. The return value is equivalent to `process.arch`.
|
|
52
|
+
*/
|
|
53
|
+
function arch(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Returns an array of objects containing information about each logical CPU core.
|
|
56
|
+
* The array will be empty if no CPU information is available, such as if the `/proc` file system is unavailable.
|
|
57
|
+
*
|
|
58
|
+
* The properties included on each object include:
|
|
59
|
+
*
|
|
60
|
+
* ```js
|
|
61
|
+
* [
|
|
62
|
+
* {
|
|
63
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
64
|
+
* speed: 2926,
|
|
65
|
+
* times: {
|
|
66
|
+
* user: 252020,
|
|
67
|
+
* nice: 0,
|
|
68
|
+
* sys: 30340,
|
|
69
|
+
* idle: 1070356870,
|
|
70
|
+
* irq: 0,
|
|
71
|
+
* },
|
|
72
|
+
* },
|
|
73
|
+
* {
|
|
74
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
75
|
+
* speed: 2926,
|
|
76
|
+
* times: {
|
|
77
|
+
* user: 306960,
|
|
78
|
+
* nice: 0,
|
|
79
|
+
* sys: 26980,
|
|
80
|
+
* idle: 1071569080,
|
|
81
|
+
* irq: 0,
|
|
82
|
+
* },
|
|
83
|
+
* },
|
|
84
|
+
* {
|
|
85
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
86
|
+
* speed: 2926,
|
|
87
|
+
* times: {
|
|
88
|
+
* user: 248450,
|
|
89
|
+
* nice: 0,
|
|
90
|
+
* sys: 21750,
|
|
91
|
+
* idle: 1070919370,
|
|
92
|
+
* irq: 0,
|
|
93
|
+
* },
|
|
94
|
+
* },
|
|
95
|
+
* {
|
|
96
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
97
|
+
* speed: 2926,
|
|
98
|
+
* times: {
|
|
99
|
+
* user: 256880,
|
|
100
|
+
* nice: 0,
|
|
101
|
+
* sys: 19430,
|
|
102
|
+
* idle: 1070905480,
|
|
103
|
+
* irq: 20,
|
|
104
|
+
* },
|
|
105
|
+
* },
|
|
106
|
+
* ]
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* `nice` values are POSIX-only. On Windows, the `nice` values of all processors
|
|
110
|
+
* are always 0.
|
|
111
|
+
*
|
|
112
|
+
* `os.cpus().length` should not be used to calculate the amount of parallelism
|
|
113
|
+
* available to an application. Use {@link availableParallelism} for this purpose.
|
|
114
|
+
*/
|
|
115
|
+
function cpus(): CpuInfo[];
|
|
116
|
+
const devNull: string;
|
|
117
|
+
/**
|
|
118
|
+
* Returns a string identifying the endianness of the CPU for which the Node.js
|
|
119
|
+
* binary was compiled.
|
|
120
|
+
*
|
|
121
|
+
* Possible values are `'BE'` for big endian and `'LE'` for little endian.
|
|
122
|
+
*/
|
|
123
|
+
function endianness(): "BE" | "LE";
|
|
124
|
+
/**
|
|
125
|
+
* The operating system-specific end-of-line marker.
|
|
126
|
+
* * `\n` on POSIX
|
|
127
|
+
* * `\r\n` on Windows
|
|
128
|
+
*/
|
|
129
|
+
const EOL: string;
|
|
130
|
+
/**
|
|
131
|
+
* Returns the amount of free system memory in bytes as an integer.
|
|
132
|
+
*/
|
|
133
|
+
function freemem(): number;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the scheduling priority for the process specified by `pid`. If `pid` is
|
|
136
|
+
* not provided or is `0`, the priority of the current process is returned.
|
|
137
|
+
* @param [pid=0] The process ID to retrieve scheduling priority for.
|
|
138
|
+
*/
|
|
139
|
+
function getPriority(pid?: number): number;
|
|
140
|
+
/**
|
|
141
|
+
* Returns the string path of the current user's home directory.
|
|
142
|
+
*
|
|
143
|
+
* On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
|
|
144
|
+
* uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory.
|
|
145
|
+
*
|
|
146
|
+
* On Windows, it uses the `USERPROFILE` environment variable if defined.
|
|
147
|
+
* Otherwise it uses the path to the profile directory of the current user.
|
|
148
|
+
*/
|
|
149
|
+
function homedir(): string;
|
|
150
|
+
/**
|
|
151
|
+
* Returns the host name of the operating system as a string.
|
|
152
|
+
*/
|
|
153
|
+
function hostname(): string;
|
|
154
|
+
/**
|
|
155
|
+
* Returns an array containing the 1, 5, and 15 minute load averages.
|
|
156
|
+
*
|
|
157
|
+
* The load average is a measure of system activity calculated by the operating
|
|
158
|
+
* system and expressed as a fractional number.
|
|
159
|
+
*
|
|
160
|
+
* The load average is a Unix-specific concept. On Windows, the return value is
|
|
161
|
+
* always `[0, 0, 0]`.
|
|
162
|
+
*/
|
|
163
|
+
function loadavg(): number[];
|
|
164
|
+
/**
|
|
165
|
+
* Returns the machine type as a string, such as `arm64`, `aarch64`, `x86_64`.
|
|
166
|
+
*
|
|
167
|
+
* On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
|
|
168
|
+
* available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
169
|
+
*/
|
|
170
|
+
function machine(): string;
|
|
171
|
+
/**
|
|
172
|
+
* Returns an object containing network interfaces that have been assigned a
|
|
173
|
+
* network address.
|
|
174
|
+
*
|
|
175
|
+
* Each key on the returned object identifies a network interface. The associated
|
|
176
|
+
* value is an array of objects that each describe an assigned network address.
|
|
177
|
+
*
|
|
178
|
+
* The properties available on the assigned network address object include:
|
|
179
|
+
*
|
|
180
|
+
* ```js
|
|
181
|
+
* {
|
|
182
|
+
* lo: [
|
|
183
|
+
* {
|
|
184
|
+
* address: '127.0.0.1',
|
|
185
|
+
* netmask: '255.0.0.0',
|
|
186
|
+
* family: 'IPv4',
|
|
187
|
+
* mac: '00:00:00:00:00:00',
|
|
188
|
+
* internal: true,
|
|
189
|
+
* cidr: '127.0.0.1/8'
|
|
190
|
+
* },
|
|
191
|
+
* {
|
|
192
|
+
* address: '::1',
|
|
193
|
+
* netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
|
|
194
|
+
* family: 'IPv6',
|
|
195
|
+
* mac: '00:00:00:00:00:00',
|
|
196
|
+
* scopeid: 0,
|
|
197
|
+
* internal: true,
|
|
198
|
+
* cidr: '::1/128'
|
|
199
|
+
* }
|
|
200
|
+
* ],
|
|
201
|
+
* eth0: [
|
|
202
|
+
* {
|
|
203
|
+
* address: '192.168.1.108',
|
|
204
|
+
* netmask: '255.255.255.0',
|
|
205
|
+
* family: 'IPv4',
|
|
206
|
+
* mac: '01:02:03:0a:0b:0c',
|
|
207
|
+
* internal: false,
|
|
208
|
+
* cidr: '192.168.1.108/24'
|
|
209
|
+
* },
|
|
210
|
+
* {
|
|
211
|
+
* address: 'fe80::a00:27ff:fe4e:66a1',
|
|
212
|
+
* netmask: 'ffff:ffff:ffff:ffff::',
|
|
213
|
+
* family: 'IPv6',
|
|
214
|
+
* mac: '01:02:03:0a:0b:0c',
|
|
215
|
+
* scopeid: 1,
|
|
216
|
+
* internal: false,
|
|
217
|
+
* cidr: 'fe80::a00:27ff:fe4e:66a1/64'
|
|
218
|
+
* }
|
|
219
|
+
* ]
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
|
|
224
|
+
/**
|
|
225
|
+
* Returns a string identifying the operating system platform for which
|
|
226
|
+
* the Node.js binary was compiled. The value is set at compile time.
|
|
227
|
+
*/
|
|
228
|
+
function platform(): Platform;
|
|
229
|
+
function release(): string;
|
|
230
|
+
/**
|
|
231
|
+
* Returns the operating system's default directory for temporary files as a
|
|
232
|
+
* string.
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* Attempts to set the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the process ID of the current process is used.
|
|
236
|
+
*
|
|
237
|
+
* The `priority` input must be an integer between `-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows
|
|
238
|
+
* priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range
|
|
239
|
+
* mapping may cause the return value to be slightly different on Windows. To avoid
|
|
240
|
+
* confusion, set `priority` to one of the priority constants.
|
|
241
|
+
*
|
|
242
|
+
* On Windows, not currently supported on Windows.
|
|
243
|
+
*
|
|
244
|
+
* @param [pid=0] The process ID to set scheduling priority for.
|
|
245
|
+
* @param priority The scheduling priority to assign to the process.
|
|
246
|
+
*/
|
|
247
|
+
function setPriority(priority: number): void;
|
|
248
|
+
function setPriority(pid: number, priority: number): void;
|
|
249
|
+
/**
|
|
250
|
+
* Returns the operating system release as a string.
|
|
251
|
+
*
|
|
252
|
+
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used. See
|
|
253
|
+
* [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
254
|
+
*/
|
|
255
|
+
function tmpdir(): string;
|
|
256
|
+
/**
|
|
257
|
+
* Returns the total amount of system memory in bytes as an integer.
|
|
258
|
+
*/
|
|
259
|
+
function totalmem(): number;
|
|
260
|
+
/**
|
|
261
|
+
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
|
|
262
|
+
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
|
|
263
|
+
*
|
|
264
|
+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information
|
|
265
|
+
* about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems.
|
|
266
|
+
*/
|
|
267
|
+
function type(): string;
|
|
268
|
+
/**
|
|
269
|
+
* Returns the system uptime in number of seconds.
|
|
270
|
+
*/
|
|
271
|
+
function uptime(): number;
|
|
272
|
+
/**
|
|
273
|
+
* Returns a string identifying the kernel version.
|
|
274
|
+
*
|
|
275
|
+
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used.
|
|
276
|
+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
277
|
+
*/
|
|
278
|
+
/**
|
|
279
|
+
* Returns information about the currently effective user. On POSIX platforms,
|
|
280
|
+
* this is typically a subset of the password file. The returned object includes
|
|
281
|
+
* the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`.
|
|
282
|
+
*
|
|
283
|
+
* The value of `homedir` returned by `os.userInfo()` is provided by the operating
|
|
284
|
+
* system. This differs from the result of `os.homedir()`, which queries
|
|
285
|
+
* environment variables for the home directory before falling back to the
|
|
286
|
+
* operating system response.
|
|
287
|
+
*
|
|
288
|
+
* Throws a [`SystemError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
|
|
289
|
+
*/
|
|
290
|
+
//function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
|
|
291
|
+
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
|
|
292
|
+
function version(): string;
|
|
293
|
+
}
|
package/src/process.d.ts
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
declare module 'process' {
|
|
2
|
+
import { EventEmitter } from 'events'
|
|
3
|
+
|
|
4
|
+
global {
|
|
5
|
+
var process: Process
|
|
6
|
+
|
|
7
|
+
namespace QuickJS {
|
|
8
|
+
type Signals =
|
|
9
|
+
| 'SIGABRT'
|
|
10
|
+
| 'SIGALRM'
|
|
11
|
+
| 'SIGFPE'
|
|
12
|
+
| 'SIGHUP'
|
|
13
|
+
| 'SIGILL'
|
|
14
|
+
| 'SIGINT'
|
|
15
|
+
| 'SIGKILL'
|
|
16
|
+
| 'SIGPIPE'
|
|
17
|
+
| 'SIGQUIT'
|
|
18
|
+
| 'SIGSEGV'
|
|
19
|
+
| 'SIGTERM'
|
|
20
|
+
}
|
|
21
|
+
type Platform = 'darwin' | 'linux' | 'win32'
|
|
22
|
+
type Architecture = 'arm64' | 'x64'
|
|
23
|
+
}
|
|
24
|
+
interface Dict<T> {
|
|
25
|
+
[key: string]: T | undefined
|
|
26
|
+
}
|
|
27
|
+
// Alias for compatibility
|
|
28
|
+
interface ProcessEnv extends Dict<string> {}
|
|
29
|
+
interface HRTime {
|
|
30
|
+
(): [number, number]
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The `bigint` version of the `{@link process.hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
|
|
34
|
+
*/
|
|
35
|
+
bigint(): bigint
|
|
36
|
+
}
|
|
37
|
+
interface ProcessRelease {
|
|
38
|
+
name: string
|
|
39
|
+
}
|
|
40
|
+
interface ProcessVersions extends Dict<string> {
|
|
41
|
+
llrt: string
|
|
42
|
+
}
|
|
43
|
+
interface Process extends EventEmitter {
|
|
44
|
+
hrtime: HRTime
|
|
45
|
+
/**
|
|
46
|
+
* The `process.cwd()` method returns the current working directory of the llrt
|
|
47
|
+
* process.
|
|
48
|
+
*
|
|
49
|
+
* ```js
|
|
50
|
+
* import { cwd } from 'process';
|
|
51
|
+
*
|
|
52
|
+
* console.log(`Current directory: ${cwd()}`);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
cwd(): string
|
|
56
|
+
/**
|
|
57
|
+
* The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when llrt starts.
|
|
58
|
+
*
|
|
59
|
+
* ```console
|
|
60
|
+
* $ ./llrt -e 'console.log(process.argv[0])'
|
|
61
|
+
* ./llrt
|
|
62
|
+
* $ ./llrt -e 'console.log(process.argv0)'
|
|
63
|
+
* ./llrt
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
argv0: string
|
|
67
|
+
/**
|
|
68
|
+
* Returns the OS-assigned process identifier associated with this process.
|
|
69
|
+
*/
|
|
70
|
+
id: number
|
|
71
|
+
/**
|
|
72
|
+
* The `process.argv` property returns an array containing the command-line
|
|
73
|
+
* arguments passed when the llrt process was launched. The first element will
|
|
74
|
+
* be {@link execPath}. See `process.argv0` if access to the original value
|
|
75
|
+
* of `argv[0]` is needed. The second element will be the path to the JavaScript
|
|
76
|
+
* file being executed. The remaining elements will be any additional command-line
|
|
77
|
+
* arguments.
|
|
78
|
+
*
|
|
79
|
+
* For example, assuming the following script for `process-args.js`:
|
|
80
|
+
*
|
|
81
|
+
* ```js
|
|
82
|
+
* import { argv } from 'process';
|
|
83
|
+
*
|
|
84
|
+
* // print process.argv
|
|
85
|
+
* argv.forEach((val, index) => {
|
|
86
|
+
* console.log(`${index}: ${val}`);
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
argv: string[]
|
|
92
|
+
/**
|
|
93
|
+
* The operating system CPU architecture for which the llrt binary was compiled.
|
|
94
|
+
* Possible values are: `'arm64'` and `'x64'`.
|
|
95
|
+
*
|
|
96
|
+
* ```js
|
|
97
|
+
* import { arch } from 'process';
|
|
98
|
+
*
|
|
99
|
+
* console.log(`This processor architecture is ${arch}`);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
readonly arch: Architecture
|
|
103
|
+
/**
|
|
104
|
+
* The `process.platform` property returns a string identifying the operating
|
|
105
|
+
* system platform for which the llrt binary was compiled.
|
|
106
|
+
*
|
|
107
|
+
* Currently possible values are:
|
|
108
|
+
*
|
|
109
|
+
* * `'darwin'`
|
|
110
|
+
* * `'linux'`
|
|
111
|
+
* * `'win32'`
|
|
112
|
+
*
|
|
113
|
+
* ```js
|
|
114
|
+
* import { platform } from 'process';
|
|
115
|
+
*
|
|
116
|
+
* console.log(`This platform is ${platform}`);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
readonly platform: Platform
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The `process.release` property returns an `Object` containing metadata related
|
|
123
|
+
* to the current release, including URLs for the source tarball and headers-only
|
|
124
|
+
* tarball.
|
|
125
|
+
*
|
|
126
|
+
* `process.release` contains the following properties:
|
|
127
|
+
*
|
|
128
|
+
* ```js
|
|
129
|
+
* {
|
|
130
|
+
* name: 'llrt',
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be
|
|
135
|
+
* relied upon to exist.
|
|
136
|
+
*/
|
|
137
|
+
readonly release: ProcessRelease
|
|
138
|
+
/**
|
|
139
|
+
* The `process.version` property contains the llrt version string.
|
|
140
|
+
*
|
|
141
|
+
* ```js
|
|
142
|
+
* import { version } from 'process';
|
|
143
|
+
*
|
|
144
|
+
* console.log(`Version: ${version}`);
|
|
145
|
+
* // Version: 0.1.15
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
readonly version: string
|
|
149
|
+
/**
|
|
150
|
+
* The `process.versions` property returns an object listing the version strings of
|
|
151
|
+
* llrt and its dependencies. `process.versions.modules` indicates the current
|
|
152
|
+
* ABI version, which is increased whenever a C++ API changes. llrt will refuse
|
|
153
|
+
* to load modules that were compiled against a different module ABI version.
|
|
154
|
+
*
|
|
155
|
+
* ```js
|
|
156
|
+
* import { versions } from 'process';
|
|
157
|
+
*
|
|
158
|
+
* console.log(versions);
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* Will generate an object similar to:
|
|
162
|
+
*
|
|
163
|
+
* ```console
|
|
164
|
+
* {
|
|
165
|
+
* llrt:'0.1.15'
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
readonly versions: ProcessVersions
|
|
170
|
+
/**
|
|
171
|
+
* The `process.exit()` method instructs llrt to terminate the process
|
|
172
|
+
* synchronously with an exit status of `code`. If `code` is omitted, exit uses
|
|
173
|
+
* either the 'success' code `0` or the value of `process.exitCode` if it has been
|
|
174
|
+
* set. llrt will not terminate until all the `'exit'` event listeners are
|
|
175
|
+
* called.
|
|
176
|
+
*
|
|
177
|
+
* To exit with a 'failure' code:
|
|
178
|
+
*
|
|
179
|
+
* ```js
|
|
180
|
+
* import { exit } from 'process';
|
|
181
|
+
*
|
|
182
|
+
* exit(1);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
exit(code?: number | string | null | undefined): never
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The `process.exitCode` property indicates the exit code that will be used
|
|
189
|
+
* when the llrt process eventually exits. If it is not specified, the default
|
|
190
|
+
* exit code is `undefined` and will be 0 on exit.
|
|
191
|
+
*
|
|
192
|
+
* ```js
|
|
193
|
+
* import { exitCode, exit } from 'process';
|
|
194
|
+
*
|
|
195
|
+
* exitCode = 42;
|
|
196
|
+
* exit();
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* This will cause the llrt process to exit with the exit code `42`.
|
|
200
|
+
*/
|
|
201
|
+
exitCode: number | null
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The `process.getgid()` method returns the numerical group identity of the
|
|
205
|
+
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
|
206
|
+
*
|
|
207
|
+
* ```js
|
|
208
|
+
* import process from 'process';
|
|
209
|
+
*
|
|
210
|
+
* if (process.getgid) {
|
|
211
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
216
|
+
* Android).
|
|
217
|
+
* @since v0.1.31
|
|
218
|
+
*/
|
|
219
|
+
getgid?: () => number
|
|
220
|
+
/**
|
|
221
|
+
* 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
|
|
222
|
+
* numeric ID or a group name
|
|
223
|
+
* string. If a group name is specified, this method blocks while resolving the
|
|
224
|
+
* associated numeric ID.
|
|
225
|
+
*
|
|
226
|
+
* ```js
|
|
227
|
+
* import process from 'process';
|
|
228
|
+
*
|
|
229
|
+
* if (process.getgid && process.setgid) {
|
|
230
|
+
* console.log(`Current gid: ${process.getgid()}`);
|
|
231
|
+
* try {
|
|
232
|
+
* process.setgid(501);
|
|
233
|
+
* console.log(`New gid: ${process.getgid()}`);
|
|
234
|
+
* } catch (err) {
|
|
235
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
236
|
+
* }
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
241
|
+
* Android).
|
|
242
|
+
* This feature is not available in `Worker` threads.
|
|
243
|
+
* @since v0.1.31
|
|
244
|
+
* @param id The group name or ID
|
|
245
|
+
*/
|
|
246
|
+
setgid?: (id: number) => void
|
|
247
|
+
/**
|
|
248
|
+
* The `process.getuid()` method returns the numeric user identity of the process.
|
|
249
|
+
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
250
|
+
*
|
|
251
|
+
* ```js
|
|
252
|
+
* import process from 'process';
|
|
253
|
+
*
|
|
254
|
+
* if (process.getuid) {
|
|
255
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
260
|
+
* Android).
|
|
261
|
+
* @since v0.1.28
|
|
262
|
+
*/
|
|
263
|
+
getuid?: () => number
|
|
264
|
+
/**
|
|
265
|
+
* 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
|
|
266
|
+
* numeric ID or a username string.
|
|
267
|
+
* If a username is specified, the method blocks while resolving the associated
|
|
268
|
+
* numeric ID.
|
|
269
|
+
*
|
|
270
|
+
* ```js
|
|
271
|
+
* import process from 'process';
|
|
272
|
+
*
|
|
273
|
+
* if (process.getuid && process.setuid) {
|
|
274
|
+
* console.log(`Current uid: ${process.getuid()}`);
|
|
275
|
+
* try {
|
|
276
|
+
* process.setuid(501);
|
|
277
|
+
* console.log(`New uid: ${process.getuid()}`);
|
|
278
|
+
* } catch (err) {
|
|
279
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
280
|
+
* }
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
285
|
+
* Android).
|
|
286
|
+
* This feature is not available in `Worker` threads.
|
|
287
|
+
* @since v0.1.28
|
|
288
|
+
*/
|
|
289
|
+
setuid?: (id: number) => void
|
|
290
|
+
/**
|
|
291
|
+
* The `process.geteuid()` method returns the numerical effective user identity of
|
|
292
|
+
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
293
|
+
*
|
|
294
|
+
* ```js
|
|
295
|
+
* import process from 'process';
|
|
296
|
+
*
|
|
297
|
+
* if (process.geteuid) {
|
|
298
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
303
|
+
* Android).
|
|
304
|
+
* @since v2.0.0
|
|
305
|
+
*/
|
|
306
|
+
geteuid?: () => number
|
|
307
|
+
/**
|
|
308
|
+
* The `process.seteuid()` method sets the effective user identity of the process.
|
|
309
|
+
* (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
|
|
310
|
+
* string. If a username is specified, the method blocks while resolving the
|
|
311
|
+
* associated numeric ID.
|
|
312
|
+
*
|
|
313
|
+
* ```js
|
|
314
|
+
* import process from 'process';
|
|
315
|
+
*
|
|
316
|
+
* if (process.geteuid && process.seteuid) {
|
|
317
|
+
* console.log(`Current uid: ${process.geteuid()}`);
|
|
318
|
+
* try {
|
|
319
|
+
* process.seteuid(501);
|
|
320
|
+
* console.log(`New uid: ${process.geteuid()}`);
|
|
321
|
+
* } catch (err) {
|
|
322
|
+
* console.log(`Failed to set uid: ${err}`);
|
|
323
|
+
* }
|
|
324
|
+
* }
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
328
|
+
* Android).
|
|
329
|
+
* This feature is not available in `Worker` threads.
|
|
330
|
+
* @since v2.0.0
|
|
331
|
+
* @param id A user name or ID
|
|
332
|
+
*/
|
|
333
|
+
seteuid?: (id: number) => void
|
|
334
|
+
/**
|
|
335
|
+
* The `process.getegid()` method returns the numerical effective group identity
|
|
336
|
+
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
337
|
+
*
|
|
338
|
+
* ```js
|
|
339
|
+
* import process from 'process';
|
|
340
|
+
*
|
|
341
|
+
* if (process.getegid) {
|
|
342
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
347
|
+
* Android).
|
|
348
|
+
* @since v2.0.0
|
|
349
|
+
*/
|
|
350
|
+
getegid?: () => number
|
|
351
|
+
/**
|
|
352
|
+
* The `process.setegid()` method sets the effective group identity of the process.
|
|
353
|
+
* (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
|
|
354
|
+
* name string. If a group name is specified, this method blocks while resolving
|
|
355
|
+
* the associated a numeric ID.
|
|
356
|
+
*
|
|
357
|
+
* ```js
|
|
358
|
+
* import process from 'process';
|
|
359
|
+
*
|
|
360
|
+
* if (process.getegid && process.setegid) {
|
|
361
|
+
* console.log(`Current gid: ${process.getegid()}`);
|
|
362
|
+
* try {
|
|
363
|
+
* process.setegid(501);
|
|
364
|
+
* console.log(`New gid: ${process.getegid()}`);
|
|
365
|
+
* } catch (err) {
|
|
366
|
+
* console.log(`Failed to set gid: ${err}`);
|
|
367
|
+
* }
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* This function is only available on POSIX platforms (i.e. not Windows or
|
|
372
|
+
* Android).
|
|
373
|
+
* This feature is not available in `Worker` threads.
|
|
374
|
+
* @since v2.0.0
|
|
375
|
+
* @param id A group name or ID
|
|
376
|
+
*/
|
|
377
|
+
setegid?: (id: number) => void
|
|
378
|
+
}
|
|
379
|
+
}
|