@types/node 16.4.2 → 16.4.6
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.
- node/README.md +2 -2
- node/assert/strict.d.ts +0 -1
- node/assert.d.ts +1352 -40
- node/async_hooks.d.ts +359 -90
- node/buffer.d.ts +1503 -78
- node/child_process.d.ts +1054 -233
- node/cluster.d.ts +320 -100
- node/console.d.ts +305 -32
- node/crypto.d.ts +3115 -739
- node/dgram.d.ts +446 -55
- node/diagnostics_channel.d.ts +85 -12
- node/dns/promises.d.ts +292 -36
- node/dns.d.ts +410 -97
- node/domain.d.ts +154 -10
- node/events.d.ts +377 -31
- node/fs/promises.d.ts +697 -273
- node/fs.d.ts +2257 -858
- node/http.d.ts +888 -80
- node/http2.d.ts +1525 -459
- node/https.d.ts +261 -11
- node/index.d.ts +25 -0
- node/inspector.d.ts +354 -661
- node/module.d.ts +49 -11
- node/net.d.ts +548 -140
- node/os.d.ts +236 -26
- node/package.json +7 -2
- node/path.d.ts +9 -5
- node/perf_hooks.d.ts +288 -90
- node/process.d.ts +1092 -153
- node/punycode.d.ts +65 -26
- node/querystring.d.ts +107 -8
- node/readline.d.ts +425 -79
- node/repl.d.ts +135 -110
- node/stream/promises.d.ts +15 -44
- node/stream.d.ts +927 -225
- node/string_decoder.d.ts +57 -1
- node/timers/promises.d.ts +97 -9
- node/timers.d.ts +29 -10
- node/tls.d.ts +444 -221
- node/trace_events.d.ts +107 -11
- node/tty.d.ts +163 -23
- node/url.d.ts +739 -29
- node/util.d.ts +1361 -73
- node/v8.d.ts +254 -78
- node/vm.d.ts +381 -33
- node/wasi.d.ts +107 -24
- node/worker_threads.d.ts +494 -131
- node/zlib.d.ts +215 -63
node/os.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `os` module provides operating system-related utility methods and
|
|
3
|
+
* properties. It can be accessed using:
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const os = require('os');
|
|
7
|
+
* ```
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/os.js)
|
|
9
|
+
*/
|
|
1
10
|
declare module 'os' {
|
|
2
11
|
interface CpuInfo {
|
|
3
12
|
model: string;
|
|
@@ -10,7 +19,6 @@ declare module 'os' {
|
|
|
10
19
|
irq: number;
|
|
11
20
|
};
|
|
12
21
|
}
|
|
13
|
-
|
|
14
22
|
interface NetworkInterfaceBase {
|
|
15
23
|
address: string;
|
|
16
24
|
netmask: string;
|
|
@@ -18,16 +26,13 @@ declare module 'os' {
|
|
|
18
26
|
internal: boolean;
|
|
19
27
|
cidr: string | null;
|
|
20
28
|
}
|
|
21
|
-
|
|
22
29
|
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
|
|
23
|
-
family:
|
|
30
|
+
family: 'IPv4';
|
|
24
31
|
}
|
|
25
|
-
|
|
26
32
|
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
|
|
27
|
-
family:
|
|
33
|
+
family: 'IPv6';
|
|
28
34
|
scopeid: number;
|
|
29
35
|
}
|
|
30
|
-
|
|
31
36
|
interface UserInfo<T> {
|
|
32
37
|
username: T;
|
|
33
38
|
uid: number;
|
|
@@ -35,26 +40,197 @@ declare module 'os' {
|
|
|
35
40
|
shell: T;
|
|
36
41
|
homedir: T;
|
|
37
42
|
}
|
|
38
|
-
|
|
39
43
|
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
|
|
40
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Returns the host name of the operating system as a string.
|
|
46
|
+
* @since v0.3.3
|
|
47
|
+
*/
|
|
41
48
|
function hostname(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns an array containing the 1, 5, and 15 minute load averages.
|
|
51
|
+
*
|
|
52
|
+
* The load average is a measure of system activity calculated by the operating
|
|
53
|
+
* system and expressed as a fractional number.
|
|
54
|
+
*
|
|
55
|
+
* The load average is a Unix-specific concept. On Windows, the return value is
|
|
56
|
+
* always `[0, 0, 0]`.
|
|
57
|
+
* @since v0.3.3
|
|
58
|
+
*/
|
|
42
59
|
function loadavg(): number[];
|
|
60
|
+
/**
|
|
61
|
+
* Returns the system uptime in number of seconds.
|
|
62
|
+
* @since v0.3.3
|
|
63
|
+
*/
|
|
43
64
|
function uptime(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the amount of free system memory in bytes as an integer.
|
|
67
|
+
* @since v0.3.3
|
|
68
|
+
*/
|
|
44
69
|
function freemem(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the total amount of system memory in bytes as an integer.
|
|
72
|
+
* @since v0.3.3
|
|
73
|
+
*/
|
|
45
74
|
function totalmem(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Returns an array of objects containing information about each logical CPU core.
|
|
77
|
+
*
|
|
78
|
+
* The properties included on each object include:
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* [
|
|
82
|
+
* {
|
|
83
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
84
|
+
* speed: 2926,
|
|
85
|
+
* times: {
|
|
86
|
+
* user: 252020,
|
|
87
|
+
* nice: 0,
|
|
88
|
+
* sys: 30340,
|
|
89
|
+
* idle: 1070356870,
|
|
90
|
+
* irq: 0
|
|
91
|
+
* }
|
|
92
|
+
* },
|
|
93
|
+
* {
|
|
94
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
95
|
+
* speed: 2926,
|
|
96
|
+
* times: {
|
|
97
|
+
* user: 306960,
|
|
98
|
+
* nice: 0,
|
|
99
|
+
* sys: 26980,
|
|
100
|
+
* idle: 1071569080,
|
|
101
|
+
* irq: 0
|
|
102
|
+
* }
|
|
103
|
+
* },
|
|
104
|
+
* {
|
|
105
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
106
|
+
* speed: 2926,
|
|
107
|
+
* times: {
|
|
108
|
+
* user: 248450,
|
|
109
|
+
* nice: 0,
|
|
110
|
+
* sys: 21750,
|
|
111
|
+
* idle: 1070919370,
|
|
112
|
+
* irq: 0
|
|
113
|
+
* }
|
|
114
|
+
* },
|
|
115
|
+
* {
|
|
116
|
+
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
|
117
|
+
* speed: 2926,
|
|
118
|
+
* times: {
|
|
119
|
+
* user: 256880,
|
|
120
|
+
* nice: 0,
|
|
121
|
+
* sys: 19430,
|
|
122
|
+
* idle: 1070905480,
|
|
123
|
+
* irq: 20
|
|
124
|
+
* }
|
|
125
|
+
* },
|
|
126
|
+
* ]
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* `nice` values are POSIX-only. On Windows, the `nice` values of all processors
|
|
130
|
+
* are always 0.
|
|
131
|
+
* @since v0.3.3
|
|
132
|
+
*/
|
|
46
133
|
function cpus(): CpuInfo[];
|
|
134
|
+
/**
|
|
135
|
+
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
|
|
136
|
+
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
|
|
137
|
+
*
|
|
138
|
+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information
|
|
139
|
+
* about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems.
|
|
140
|
+
* @since v0.3.3
|
|
141
|
+
*/
|
|
47
142
|
function type(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the operating system as a string.
|
|
145
|
+
*
|
|
146
|
+
* On POSIX systems, the operating system release is determined by calling[`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used.
|
|
147
|
+
* See[https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
148
|
+
* @since v0.3.3
|
|
149
|
+
*/
|
|
48
150
|
function release(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Returns an object containing network interfaces that have been assigned a
|
|
153
|
+
* network address.
|
|
154
|
+
*
|
|
155
|
+
* Each key on the returned object identifies a network interface. The associated
|
|
156
|
+
* value is an array of objects that each describe an assigned network address.
|
|
157
|
+
*
|
|
158
|
+
* The properties available on the assigned network address object include:
|
|
159
|
+
*
|
|
160
|
+
* ```js
|
|
161
|
+
* {
|
|
162
|
+
* lo: [
|
|
163
|
+
* {
|
|
164
|
+
* address: '127.0.0.1',
|
|
165
|
+
* netmask: '255.0.0.0',
|
|
166
|
+
* family: 'IPv4',
|
|
167
|
+
* mac: '00:00:00:00:00:00',
|
|
168
|
+
* internal: true,
|
|
169
|
+
* cidr: '127.0.0.1/8'
|
|
170
|
+
* },
|
|
171
|
+
* {
|
|
172
|
+
* address: '::1',
|
|
173
|
+
* netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
|
|
174
|
+
* family: 'IPv6',
|
|
175
|
+
* mac: '00:00:00:00:00:00',
|
|
176
|
+
* scopeid: 0,
|
|
177
|
+
* internal: true,
|
|
178
|
+
* cidr: '::1/128'
|
|
179
|
+
* }
|
|
180
|
+
* ],
|
|
181
|
+
* eth0: [
|
|
182
|
+
* {
|
|
183
|
+
* address: '192.168.1.108',
|
|
184
|
+
* netmask: '255.255.255.0',
|
|
185
|
+
* family: 'IPv4',
|
|
186
|
+
* mac: '01:02:03:0a:0b:0c',
|
|
187
|
+
* internal: false,
|
|
188
|
+
* cidr: '192.168.1.108/24'
|
|
189
|
+
* },
|
|
190
|
+
* {
|
|
191
|
+
* address: 'fe80::a00:27ff:fe4e:66a1',
|
|
192
|
+
* netmask: 'ffff:ffff:ffff:ffff::',
|
|
193
|
+
* family: 'IPv6',
|
|
194
|
+
* mac: '01:02:03:0a:0b:0c',
|
|
195
|
+
* scopeid: 1,
|
|
196
|
+
* internal: false,
|
|
197
|
+
* cidr: 'fe80::a00:27ff:fe4e:66a1/64'
|
|
198
|
+
* }
|
|
199
|
+
* ]
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
* @since v0.6.0
|
|
203
|
+
*/
|
|
49
204
|
function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Returns the string path of the current user's home directory.
|
|
207
|
+
*
|
|
208
|
+
* On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
|
|
209
|
+
* uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory.
|
|
210
|
+
*
|
|
211
|
+
* On Windows, it uses the `USERPROFILE` environment variable if defined.
|
|
212
|
+
* Otherwise it uses the path to the profile directory of the current user.
|
|
213
|
+
* @since v2.3.0
|
|
214
|
+
*/
|
|
50
215
|
function homedir(): string;
|
|
216
|
+
/**
|
|
217
|
+
* Returns information about the currently effective user. On POSIX platforms,
|
|
218
|
+
* this is typically a subset of the password file. The returned object includes
|
|
219
|
+
* the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`.
|
|
220
|
+
*
|
|
221
|
+
* The value of `homedir` returned by `os.userInfo()` is provided by the operating
|
|
222
|
+
* system. This differs from the result of `os.homedir()`, which queries
|
|
223
|
+
* environment variables for the home directory before falling back to the
|
|
224
|
+
* operating system response.
|
|
225
|
+
*
|
|
226
|
+
* Throws a `SystemError` if a user has no `username` or `homedir`.
|
|
227
|
+
* @since v6.0.0
|
|
228
|
+
*/
|
|
51
229
|
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
|
|
52
230
|
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
|
|
53
|
-
|
|
54
231
|
type SignalConstants = {
|
|
55
232
|
[key in NodeJS.Signals]: number;
|
|
56
233
|
};
|
|
57
|
-
|
|
58
234
|
namespace constants {
|
|
59
235
|
const UV_UDP_REUSEADDR: number;
|
|
60
236
|
namespace signals {}
|
|
@@ -207,39 +383,73 @@ declare module 'os' {
|
|
|
207
383
|
const PRIORITY_HIGHEST: number;
|
|
208
384
|
}
|
|
209
385
|
}
|
|
210
|
-
|
|
211
386
|
const devNull: string;
|
|
212
387
|
const EOL: string;
|
|
213
|
-
|
|
388
|
+
/**
|
|
389
|
+
* Returns the operating system CPU architecture for which the Node.js binary was
|
|
390
|
+
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
|
|
391
|
+
*
|
|
392
|
+
* The return value is equivalent to `process.arch`.
|
|
393
|
+
* @since v0.5.0
|
|
394
|
+
*/
|
|
214
395
|
function arch(): string;
|
|
215
396
|
/**
|
|
216
397
|
* Returns a string identifying the kernel version.
|
|
217
|
-
*
|
|
218
|
-
* uname(3). On Windows, `
|
|
219
|
-
* `GetVersionExW()` will be used. See
|
|
220
|
-
*
|
|
398
|
+
*
|
|
399
|
+
* 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, and if it is not
|
|
400
|
+
* available, `GetVersionExW()` will be used. See[https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
401
|
+
* @since v13.11.0, v12.17.0
|
|
221
402
|
*/
|
|
222
403
|
function version(): string;
|
|
404
|
+
/**
|
|
405
|
+
* Returns a string identifying the operating system platform. The value is set
|
|
406
|
+
* at compile time. Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`.
|
|
407
|
+
*
|
|
408
|
+
* The return value is equivalent to `process.platform`.
|
|
409
|
+
*
|
|
410
|
+
* The value `'android'` may also be returned if Node.js is built on the Android
|
|
411
|
+
* operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
|
|
412
|
+
* @since v0.5.0
|
|
413
|
+
*/
|
|
223
414
|
function platform(): NodeJS.Platform;
|
|
415
|
+
/**
|
|
416
|
+
* Returns the operating system's default directory for temporary files as a
|
|
417
|
+
* string.
|
|
418
|
+
* @since v0.9.9
|
|
419
|
+
*/
|
|
224
420
|
function tmpdir(): string;
|
|
225
|
-
function endianness(): "BE" | "LE";
|
|
226
421
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
422
|
+
* Returns a string identifying the endianness of the CPU for which the Node.js
|
|
423
|
+
* binary was compiled.
|
|
424
|
+
*
|
|
425
|
+
* Possible values are `'BE'` for big endian and `'LE'` for little endian.
|
|
426
|
+
* @since v0.9.4
|
|
229
427
|
*/
|
|
230
|
-
function
|
|
428
|
+
function endianness(): 'BE' | 'LE';
|
|
231
429
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
430
|
+
* Returns the scheduling priority for the process specified by `pid`. If `pid` is
|
|
431
|
+
* not provided or is `0`, the priority of the current process is returned.
|
|
432
|
+
* @since v10.10.0
|
|
433
|
+
* @param pid The process ID to retrieve scheduling priority for.
|
|
234
434
|
*/
|
|
235
|
-
function
|
|
435
|
+
function getPriority(pid?: number): number;
|
|
236
436
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
437
|
+
* 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.
|
|
438
|
+
*
|
|
439
|
+
* The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows
|
|
440
|
+
* priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range
|
|
441
|
+
* mapping may cause the return value to be slightly different on Windows. To avoid
|
|
442
|
+
* confusion, set `priority` to one of the priority constants.
|
|
443
|
+
*
|
|
444
|
+
* On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user
|
|
445
|
+
* privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`.
|
|
446
|
+
* @since v10.10.0
|
|
447
|
+
* @param pid The process ID to set scheduling priority for.
|
|
448
|
+
* @param priority The scheduling priority to assign to the process.
|
|
239
449
|
*/
|
|
450
|
+
function setPriority(priority: number): void;
|
|
240
451
|
function setPriority(pid: number, priority: number): void;
|
|
241
452
|
}
|
|
242
|
-
|
|
243
453
|
declare module 'node:os' {
|
|
244
454
|
export * from 'os';
|
|
245
455
|
}
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.4.
|
|
3
|
+
"version": "16.4.6",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -209,6 +209,11 @@
|
|
|
209
209
|
"name": "Yongsheng Zhang",
|
|
210
210
|
"url": "https://github.com/ZYSzys",
|
|
211
211
|
"githubUsername": "ZYSzys"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "NodeJS Contributors",
|
|
215
|
+
"url": "https://github.com/NodeJS",
|
|
216
|
+
"githubUsername": "NodeJS"
|
|
212
217
|
}
|
|
213
218
|
],
|
|
214
219
|
"main": "",
|
|
@@ -227,6 +232,6 @@
|
|
|
227
232
|
},
|
|
228
233
|
"scripts": {},
|
|
229
234
|
"dependencies": {},
|
|
230
|
-
"typesPublisherContentHash": "
|
|
235
|
+
"typesPublisherContentHash": "409fea0ec0757dc100114c6d35fe3b616cdf1e1095e08f5e2f83bd9336035435",
|
|
231
236
|
"typeScriptVersion": "3.6"
|
|
232
237
|
}
|
node/path.d.ts
CHANGED
|
@@ -2,12 +2,19 @@ declare module 'path/posix' {
|
|
|
2
2
|
import path = require('path');
|
|
3
3
|
export = path;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
declare module 'path/win32' {
|
|
7
6
|
import path = require('path');
|
|
8
7
|
export = path;
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The `path` module provides utilities for working with file and directory paths.
|
|
11
|
+
* It can be accessed using:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* const path = require('path');
|
|
15
|
+
* ```
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/path.js)
|
|
17
|
+
*/
|
|
11
18
|
declare module 'path' {
|
|
12
19
|
namespace path {
|
|
13
20
|
/**
|
|
@@ -35,7 +42,6 @@ declare module 'path' {
|
|
|
35
42
|
*/
|
|
36
43
|
name: string;
|
|
37
44
|
}
|
|
38
|
-
|
|
39
45
|
interface FormatInputPathObject {
|
|
40
46
|
/**
|
|
41
47
|
* The root of the path such as '/' or 'c:\'
|
|
@@ -58,7 +64,6 @@ declare module 'path' {
|
|
|
58
64
|
*/
|
|
59
65
|
name?: string | undefined;
|
|
60
66
|
}
|
|
61
|
-
|
|
62
67
|
interface PlatformPath {
|
|
63
68
|
/**
|
|
64
69
|
* Normalize a string path, reducing '..' and '.' parts.
|
|
@@ -161,7 +166,6 @@ declare module 'path' {
|
|
|
161
166
|
const path: path.PlatformPath;
|
|
162
167
|
export = path;
|
|
163
168
|
}
|
|
164
|
-
|
|
165
169
|
declare module 'node:path' {
|
|
166
170
|
import path = require('path');
|
|
167
171
|
export = path;
|