@types/node 18.16.2 → 20.0.0
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 +1 -1
- node/assert.d.ts +68 -73
- node/async_hooks.d.ts +62 -42
- node/buffer.d.ts +123 -95
- node/child_process.d.ts +50 -54
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +209 -220
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +25 -26
- node/dns/promises.d.ts +6 -6
- node/dns.d.ts +16 -16
- node/domain.d.ts +3 -3
- node/events.d.ts +60 -60
- node/fs/promises.d.ts +74 -48
- node/fs.d.ts +91 -81
- node/http.d.ts +147 -144
- node/http2.d.ts +42 -46
- node/https.d.ts +52 -153
- node/index.d.ts +1 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +5 -4
- node/net.d.ts +21 -18
- node/os.d.ts +22 -18
- node/package.json +2 -2
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +43 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +6 -4
- node/readline.d.ts +15 -15
- node/repl.d.ts +9 -9
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +74 -136
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +0 -76
- node/timers/promises.d.ts +3 -3
- node/timers.d.ts +2 -2
- node/tls.d.ts +29 -15
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +68 -73
- node/ts4.8/async_hooks.d.ts +59 -31
- node/ts4.8/buffer.d.ts +123 -95
- node/ts4.8/child_process.d.ts +50 -54
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +209 -220
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +25 -26
- node/ts4.8/dns/promises.d.ts +6 -6
- node/ts4.8/dns.d.ts +16 -16
- node/ts4.8/domain.d.ts +3 -3
- node/ts4.8/events.d.ts +60 -60
- node/ts4.8/fs/promises.d.ts +72 -45
- node/ts4.8/fs.d.ts +81 -67
- node/ts4.8/http.d.ts +133 -126
- node/ts4.8/http2.d.ts +42 -46
- node/ts4.8/https.d.ts +52 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +5 -4
- node/ts4.8/net.d.ts +21 -18
- node/ts4.8/os.d.ts +22 -18
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +43 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +6 -4
- node/ts4.8/readline.d.ts +15 -15
- node/ts4.8/repl.d.ts +9 -9
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +77 -139
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +0 -75
- node/ts4.8/timers/promises.d.ts +3 -3
- node/ts4.8/timers.d.ts +2 -2
- node/ts4.8/tls.d.ts +29 -15
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +26 -36
- node/ts4.8/util.d.ts +143 -116
- node/ts4.8/v8.d.ts +107 -16
- node/ts4.8/vm.d.ts +292 -42
- node/ts4.8/wasi.d.ts +8 -14
- node/ts4.8/worker_threads.d.ts +32 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +26 -36
- node/util.d.ts +146 -111
- node/v8.d.ts +110 -16
- node/vm.d.ts +292 -42
- node/wasi.d.ts +8 -14
- node/worker_threads.d.ts +32 -34
- node/zlib.d.ts +11 -11
node/ts4.8/dgram.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `dgram` module provides an implementation of UDP datagram sockets.
|
|
2
|
+
* The `node:dgram` module provides an implementation of UDP datagram sockets.
|
|
3
3
|
*
|
|
4
4
|
* ```js
|
|
5
|
-
* import dgram from 'dgram';
|
|
5
|
+
* import dgram from 'node:dgram';
|
|
6
6
|
*
|
|
7
7
|
* const server = dgram.createSocket('udp4');
|
|
8
8
|
*
|
|
9
9
|
* server.on('error', (err) => {
|
|
10
|
-
* console.
|
|
10
|
+
* console.error(`server error:\n${err.stack}`);
|
|
11
11
|
* server.close();
|
|
12
12
|
* });
|
|
13
13
|
*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* server.bind(41234);
|
|
24
24
|
* // Prints: server listening 0.0.0.0:41234
|
|
25
25
|
* ```
|
|
26
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
26
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/dgram.js)
|
|
27
27
|
*/
|
|
28
28
|
declare module 'dgram' {
|
|
29
29
|
import { AddressInfo } from 'node:net';
|
|
@@ -98,8 +98,8 @@ declare module 'dgram' {
|
|
|
98
98
|
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
|
|
99
99
|
*
|
|
100
100
|
* ```js
|
|
101
|
-
* import cluster from 'cluster';
|
|
102
|
-
* import dgram from 'dgram';
|
|
101
|
+
* import cluster from 'node:cluster';
|
|
102
|
+
* import dgram from 'node:dgram';
|
|
103
103
|
*
|
|
104
104
|
* if (cluster.isPrimary) {
|
|
105
105
|
* cluster.fork(); // Works ok.
|
|
@@ -116,7 +116,7 @@ declare module 'dgram' {
|
|
|
116
116
|
addMembership(multicastAddress: string, multicastInterface?: string): void;
|
|
117
117
|
/**
|
|
118
118
|
* Returns an object containing the address information for a socket.
|
|
119
|
-
* For UDP sockets, this object will contain `address`, `family
|
|
119
|
+
* For UDP sockets, this object will contain `address`, `family`, and `port`properties.
|
|
120
120
|
*
|
|
121
121
|
* This method throws `EBADF` if called on an unbound socket.
|
|
122
122
|
* @since v0.1.99
|
|
@@ -142,12 +142,12 @@ declare module 'dgram' {
|
|
|
142
142
|
* Example of a UDP server listening on port 41234:
|
|
143
143
|
*
|
|
144
144
|
* ```js
|
|
145
|
-
* import dgram from 'dgram';
|
|
145
|
+
* import dgram from 'node:dgram';
|
|
146
146
|
*
|
|
147
147
|
* const server = dgram.createSocket('udp4');
|
|
148
148
|
*
|
|
149
149
|
* server.on('error', (err) => {
|
|
150
|
-
* console.
|
|
150
|
+
* console.error(`server error:\n${err.stack}`);
|
|
151
151
|
* server.close();
|
|
152
152
|
* });
|
|
153
153
|
*
|
|
@@ -284,8 +284,8 @@ declare module 'dgram' {
|
|
|
284
284
|
* Example of sending a UDP packet to a port on `localhost`;
|
|
285
285
|
*
|
|
286
286
|
* ```js
|
|
287
|
-
* import dgram from 'dgram';
|
|
288
|
-
* import { Buffer } from 'buffer';
|
|
287
|
+
* import dgram from 'node:dgram';
|
|
288
|
+
* import { Buffer } from 'node:buffer';
|
|
289
289
|
*
|
|
290
290
|
* const message = Buffer.from('Some bytes');
|
|
291
291
|
* const client = dgram.createSocket('udp4');
|
|
@@ -297,8 +297,8 @@ declare module 'dgram' {
|
|
|
297
297
|
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
|
|
298
298
|
*
|
|
299
299
|
* ```js
|
|
300
|
-
* import dgram from 'dgram';
|
|
301
|
-
* import { Buffer } from 'buffer';
|
|
300
|
+
* import dgram from 'node:dgram';
|
|
301
|
+
* import { Buffer } from 'node:buffer';
|
|
302
302
|
*
|
|
303
303
|
* const buf1 = Buffer.from('Some ');
|
|
304
304
|
* const buf2 = Buffer.from('bytes');
|
|
@@ -316,8 +316,8 @@ declare module 'dgram' {
|
|
|
316
316
|
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
|
|
317
317
|
*
|
|
318
318
|
* ```js
|
|
319
|
-
* import dgram from 'dgram';
|
|
320
|
-
* import { Buffer } from 'buffer';
|
|
319
|
+
* import dgram from 'node:dgram';
|
|
320
|
+
* import { Buffer } from 'node:buffer';
|
|
321
321
|
*
|
|
322
322
|
* const message = Buffer.from('Some bytes');
|
|
323
323
|
* const client = dgram.createSocket('udp4');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `diagnostics_channel` module provides an API to create named channels
|
|
2
|
+
* The `node:diagnostics_channel` module provides an API to create named channels
|
|
3
3
|
* to report arbitrary message data for diagnostics purposes.
|
|
4
4
|
*
|
|
5
5
|
* It can be accessed using:
|
|
6
6
|
*
|
|
7
7
|
* ```js
|
|
8
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
8
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
11
|
* It is intended that a module writer wanting to report diagnostics messages
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* channels are used along with the shape of the message data. Channel names
|
|
20
20
|
* should generally include the module name to avoid collisions with data from
|
|
21
21
|
* other modules.
|
|
22
|
-
* @
|
|
23
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
22
|
+
* @since v15.1.0, v14.17.0
|
|
23
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/diagnostics_channel.js)
|
|
24
24
|
*/
|
|
25
25
|
declare module 'diagnostics_channel' {
|
|
26
26
|
/**
|
|
@@ -31,7 +31,7 @@ declare module 'diagnostics_channel' {
|
|
|
31
31
|
* performance-sensitive code.
|
|
32
32
|
*
|
|
33
33
|
* ```js
|
|
34
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
34
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
35
35
|
*
|
|
36
36
|
* if (diagnostics_channel.hasSubscribers('my-channel')) {
|
|
37
37
|
* // There are subscribers, prepare and publish message
|
|
@@ -43,12 +43,12 @@ declare module 'diagnostics_channel' {
|
|
|
43
43
|
*/
|
|
44
44
|
function hasSubscribers(name: string | symbol): boolean;
|
|
45
45
|
/**
|
|
46
|
-
* This is the primary entry-point for anyone wanting to
|
|
46
|
+
* This is the primary entry-point for anyone wanting to publish to a named
|
|
47
47
|
* channel. It produces a channel object which is optimized to reduce overhead at
|
|
48
48
|
* publish time as much as possible.
|
|
49
49
|
*
|
|
50
50
|
* ```js
|
|
51
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
51
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
52
52
|
*
|
|
53
53
|
* const channel = diagnostics_channel.channel('my-channel');
|
|
54
54
|
* ```
|
|
@@ -59,47 +59,45 @@ declare module 'diagnostics_channel' {
|
|
|
59
59
|
function channel(name: string | symbol): Channel;
|
|
60
60
|
type ChannelListener = (message: unknown, name: string | symbol) => void;
|
|
61
61
|
/**
|
|
62
|
-
* Register a message handler to subscribe to this channel. This message handler
|
|
63
|
-
* whenever a message is published to the channel. Any
|
|
64
|
-
* trigger an 'uncaughtException'
|
|
62
|
+
* Register a message handler to subscribe to this channel. This message handler
|
|
63
|
+
* will be run synchronously whenever a message is published to the channel. Any
|
|
64
|
+
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
|
65
65
|
*
|
|
66
66
|
* ```js
|
|
67
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
67
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
68
68
|
*
|
|
69
69
|
* diagnostics_channel.subscribe('my-channel', (message, name) => {
|
|
70
70
|
* // Received data
|
|
71
71
|
* });
|
|
72
72
|
* ```
|
|
73
|
-
*
|
|
74
73
|
* @since v18.7.0, v16.17.0
|
|
75
74
|
* @param name The channel name
|
|
76
75
|
* @param onMessage The handler to receive channel messages
|
|
77
76
|
*/
|
|
78
77
|
function subscribe(name: string | symbol, onMessage: ChannelListener): void;
|
|
79
78
|
/**
|
|
80
|
-
* Remove a message handler previously registered to this channel with
|
|
79
|
+
* Remove a message handler previously registered to this channel with {@link subscribe}.
|
|
81
80
|
*
|
|
82
81
|
* ```js
|
|
83
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
82
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
84
83
|
*
|
|
85
84
|
* function onMessage(message, name) {
|
|
86
|
-
*
|
|
85
|
+
* // Received data
|
|
87
86
|
* }
|
|
88
87
|
*
|
|
89
88
|
* diagnostics_channel.subscribe('my-channel', onMessage);
|
|
90
89
|
*
|
|
91
90
|
* diagnostics_channel.unsubscribe('my-channel', onMessage);
|
|
92
91
|
* ```
|
|
93
|
-
*
|
|
94
92
|
* @since v18.7.0, v16.17.0
|
|
95
93
|
* @param name The channel name
|
|
96
94
|
* @param onMessage The previous subscribed handler to remove
|
|
97
|
-
* @
|
|
95
|
+
* @return `true` if the handler was found, `false` otherwise.
|
|
98
96
|
*/
|
|
99
97
|
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
|
|
100
98
|
/**
|
|
101
99
|
* The class `Channel` represents an individual named channel within the data
|
|
102
|
-
* pipeline. It is
|
|
100
|
+
* pipeline. It is used to track subscribers and to publish messages when there
|
|
103
101
|
* are subscribers present. It exists as a separate object to avoid channel
|
|
104
102
|
* lookups at publish time, enabling very fast publish speeds and allowing
|
|
105
103
|
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
|
|
@@ -116,7 +114,7 @@ declare module 'diagnostics_channel' {
|
|
|
116
114
|
* performance-sensitive code.
|
|
117
115
|
*
|
|
118
116
|
* ```js
|
|
119
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
117
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
120
118
|
*
|
|
121
119
|
* const channel = diagnostics_channel.channel('my-channel');
|
|
122
120
|
*
|
|
@@ -129,17 +127,16 @@ declare module 'diagnostics_channel' {
|
|
|
129
127
|
readonly hasSubscribers: boolean;
|
|
130
128
|
private constructor(name: string | symbol);
|
|
131
129
|
/**
|
|
132
|
-
* Publish a message to any subscribers to the channel. This will
|
|
133
|
-
*
|
|
134
|
-
* the same context.
|
|
130
|
+
* Publish a message to any subscribers to the channel. This will trigger
|
|
131
|
+
* message handlers synchronously so they will execute within the same context.
|
|
135
132
|
*
|
|
136
133
|
* ```js
|
|
137
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
134
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
138
135
|
*
|
|
139
136
|
* const channel = diagnostics_channel.channel('my-channel');
|
|
140
137
|
*
|
|
141
138
|
* channel.publish({
|
|
142
|
-
* some: 'message'
|
|
139
|
+
* some: 'message',
|
|
143
140
|
* });
|
|
144
141
|
* ```
|
|
145
142
|
* @since v15.1.0, v14.17.0
|
|
@@ -152,7 +149,7 @@ declare module 'diagnostics_channel' {
|
|
|
152
149
|
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
|
153
150
|
*
|
|
154
151
|
* ```js
|
|
155
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
152
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
156
153
|
*
|
|
157
154
|
* const channel = diagnostics_channel.channel('my-channel');
|
|
158
155
|
*
|
|
@@ -161,6 +158,7 @@ declare module 'diagnostics_channel' {
|
|
|
161
158
|
* });
|
|
162
159
|
* ```
|
|
163
160
|
* @since v15.1.0, v14.17.0
|
|
161
|
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
|
|
164
162
|
* @param onMessage The handler to receive channel messages
|
|
165
163
|
*/
|
|
166
164
|
subscribe(onMessage: ChannelListener): void;
|
|
@@ -168,7 +166,7 @@ declare module 'diagnostics_channel' {
|
|
|
168
166
|
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
|
|
169
167
|
*
|
|
170
168
|
* ```js
|
|
171
|
-
* import diagnostics_channel from 'diagnostics_channel';
|
|
169
|
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
172
170
|
*
|
|
173
171
|
* const channel = diagnostics_channel.channel('my-channel');
|
|
174
172
|
*
|
|
@@ -181,6 +179,7 @@ declare module 'diagnostics_channel' {
|
|
|
181
179
|
* channel.unsubscribe(onMessage);
|
|
182
180
|
* ```
|
|
183
181
|
* @since v15.1.0, v14.17.0
|
|
182
|
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
|
|
184
183
|
* @param onMessage The previous subscribed handler to remove
|
|
185
184
|
* @return `true` if the handler was found, `false` otherwise.
|
|
186
185
|
*/
|
node/ts4.8/dns/promises.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
|
3
3
|
* that return `Promise` objects rather than using callbacks. The API is accessible
|
|
4
|
-
* via `require('dns').promises` or `require('dns/promises')`.
|
|
4
|
+
* via `require('node:dns').promises` or `require('node:dns/promises')`.
|
|
5
5
|
* @since v10.6.0
|
|
6
6
|
*/
|
|
7
7
|
declare module 'dns/promises' {
|
|
@@ -52,7 +52,7 @@ declare module 'dns/promises' {
|
|
|
52
52
|
*
|
|
53
53
|
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
|
|
54
54
|
* protocol. The implementation uses an operating system facility that can
|
|
55
|
-
* associate names with addresses
|
|
55
|
+
* associate names with addresses and vice versa. This implementation can have
|
|
56
56
|
* subtle but important consequences on the behavior of any Node.js program. Please
|
|
57
57
|
* take some time to consult the `Implementation considerations section` before
|
|
58
58
|
* using `dnsPromises.lookup()`.
|
|
@@ -60,7 +60,7 @@ declare module 'dns/promises' {
|
|
|
60
60
|
* Example usage:
|
|
61
61
|
*
|
|
62
62
|
* ```js
|
|
63
|
-
* const dns = require('dns');
|
|
63
|
+
* const dns = require('node:dns');
|
|
64
64
|
* const dnsPromises = dns.promises;
|
|
65
65
|
* const options = {
|
|
66
66
|
* family: 6,
|
|
@@ -96,7 +96,7 @@ declare module 'dns/promises' {
|
|
|
96
96
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
|
|
97
97
|
*
|
|
98
98
|
* ```js
|
|
99
|
-
* const dnsPromises = require('dns').promises;
|
|
99
|
+
* const dnsPromises = require('node:dns').promises;
|
|
100
100
|
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
|
|
101
101
|
* console.log(result.hostname, result.service);
|
|
102
102
|
* // Prints: localhost ssh
|
|
@@ -206,7 +206,7 @@ declare module 'dns/promises' {
|
|
|
206
206
|
*/
|
|
207
207
|
function resolveMx(hostname: string): Promise<MxRecord[]>;
|
|
208
208
|
/**
|
|
209
|
-
* Uses the DNS protocol to resolve regular expression
|
|
209
|
+
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
|
|
210
210
|
* of objects with the following properties:
|
|
211
211
|
*
|
|
212
212
|
* * `flags`
|
|
@@ -337,7 +337,7 @@ declare module 'dns/promises' {
|
|
|
337
337
|
* * `ipv4first`: sets default `verbatim` `false`.
|
|
338
338
|
* * `verbatim`: sets default `verbatim` `true`.
|
|
339
339
|
*
|
|
340
|
-
* The default is `
|
|
340
|
+
* The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have
|
|
341
341
|
* higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
|
|
342
342
|
* default dns orders in workers.
|
|
343
343
|
* @since v16.4.0, v14.18.0
|
node/ts4.8/dns.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `dns` module enables name resolution. For example, use it to look up IP
|
|
2
|
+
* The `node:dns` module enables name resolution. For example, use it to look up IP
|
|
3
3
|
* addresses of host names.
|
|
4
4
|
*
|
|
5
5
|
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* system do, use {@link lookup}.
|
|
10
10
|
*
|
|
11
11
|
* ```js
|
|
12
|
-
* const dns = require('dns');
|
|
12
|
+
* const dns = require('node:dns');
|
|
13
13
|
*
|
|
14
14
|
* dns.lookup('example.org', (err, address, family) => {
|
|
15
15
|
* console.log('address: %j family: IPv%s', address, family);
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
* // address: "93.184.216.34" family: IPv4
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* All other functions in the `dns` module connect to an actual DNS server to
|
|
20
|
+
* All other functions in the `node:dns` module connect to an actual DNS server to
|
|
21
21
|
* perform name resolution. They will always use the network to perform DNS
|
|
22
22
|
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
|
|
23
23
|
* DNS queries, bypassing other name-resolution facilities.
|
|
24
24
|
*
|
|
25
25
|
* ```js
|
|
26
|
-
* const dns = require('dns');
|
|
26
|
+
* const dns = require('node:dns');
|
|
27
27
|
*
|
|
28
28
|
* dns.resolve4('archive.org', (err, addresses) => {
|
|
29
29
|
* if (err) throw err;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
* See the `Implementation considerations section` for more information.
|
|
45
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/dns.js)
|
|
46
46
|
*/
|
|
47
47
|
declare module 'dns' {
|
|
48
48
|
import * as dnsPromises from 'node:dns/promises';
|
|
@@ -76,8 +76,8 @@ declare module 'dns' {
|
|
|
76
76
|
/**
|
|
77
77
|
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
|
78
78
|
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
|
79
|
-
* integer, then it must be `4` or `6` – if `options` is not provided, then
|
|
80
|
-
* and IPv6 addresses are both returned if found.
|
|
79
|
+
* integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
|
|
80
|
+
* IPv4 and IPv6 addresses are both returned if found.
|
|
81
81
|
*
|
|
82
82
|
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
|
|
83
83
|
* properties `address` and `family`.
|
|
@@ -89,14 +89,14 @@ declare module 'dns' {
|
|
|
89
89
|
*
|
|
90
90
|
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
|
|
91
91
|
* The implementation uses an operating system facility that can associate names
|
|
92
|
-
* with addresses
|
|
92
|
+
* with addresses and vice versa. This implementation can have subtle but
|
|
93
93
|
* important consequences on the behavior of any Node.js program. Please take some
|
|
94
94
|
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
|
|
95
95
|
*
|
|
96
96
|
* Example usage:
|
|
97
97
|
*
|
|
98
98
|
* ```js
|
|
99
|
-
* const dns = require('dns');
|
|
99
|
+
* const dns = require('node:dns');
|
|
100
100
|
* const options = {
|
|
101
101
|
* family: 6,
|
|
102
102
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
|
@@ -135,7 +135,7 @@ declare module 'dns' {
|
|
|
135
135
|
* On an error, `err` is an `Error` object, where `err.code` is the error code.
|
|
136
136
|
*
|
|
137
137
|
* ```js
|
|
138
|
-
* const dns = require('dns');
|
|
138
|
+
* const dns = require('node:dns');
|
|
139
139
|
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
|
140
140
|
* console.log(hostname, service);
|
|
141
141
|
* // Prints: localhost ssh
|
|
@@ -291,7 +291,7 @@ declare module 'dns' {
|
|
|
291
291
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
|
-
* Uses the DNS protocol to resolve
|
|
294
|
+
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
|
|
295
295
|
* will contain an array of IPv6 addresses.
|
|
296
296
|
* @since v0.1.16
|
|
297
297
|
* @param hostname Host name to resolve.
|
|
@@ -333,7 +333,7 @@ declare module 'dns' {
|
|
|
333
333
|
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
|
-
* Uses the DNS protocol to resolve regular expression
|
|
336
|
+
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
|
|
337
337
|
* objects with the following properties:
|
|
338
338
|
*
|
|
339
339
|
* * `flags`
|
|
@@ -535,7 +535,7 @@ declare module 'dns' {
|
|
|
535
535
|
* * `ipv4first`: sets default `verbatim` `false`.
|
|
536
536
|
* * `verbatim`: sets default `verbatim` `true`.
|
|
537
537
|
*
|
|
538
|
-
* The default is `
|
|
538
|
+
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
|
539
539
|
* priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
|
|
540
540
|
* dns orders in workers.
|
|
541
541
|
* @since v16.4.0, v14.18.0
|
|
@@ -582,7 +582,7 @@ declare module 'dns' {
|
|
|
582
582
|
* other resolvers:
|
|
583
583
|
*
|
|
584
584
|
* ```js
|
|
585
|
-
* const { Resolver } = require('dns');
|
|
585
|
+
* const { Resolver } = require('node:dns');
|
|
586
586
|
* const resolver = new Resolver();
|
|
587
587
|
* resolver.setServers(['4.4.4.4']);
|
|
588
588
|
*
|
|
@@ -592,7 +592,7 @@ declare module 'dns' {
|
|
|
592
592
|
* });
|
|
593
593
|
* ```
|
|
594
594
|
*
|
|
595
|
-
* The following methods from the `dns` module are available:
|
|
595
|
+
* The following methods from the `node:dns` module are available:
|
|
596
596
|
*
|
|
597
597
|
* * `resolver.getServers()`
|
|
598
598
|
* * `resolver.resolve()`
|
|
@@ -639,7 +639,7 @@ declare module 'dns' {
|
|
|
639
639
|
* This allows programs to specify outbound interfaces when used on multi-homed
|
|
640
640
|
* systems.
|
|
641
641
|
*
|
|
642
|
-
* If a v4 or v6 address is not specified, it is set to the default
|
|
642
|
+
* If a v4 or v6 address is not specified, it is set to the default and the
|
|
643
643
|
* operating system will choose a local address automatically.
|
|
644
644
|
*
|
|
645
645
|
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
node/ts4.8/domain.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
|
13
13
|
* exit immediately with an error code.
|
|
14
14
|
* @deprecated Since v1.4.2 - Deprecated
|
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/domain.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module 'domain' {
|
|
18
18
|
import EventEmitter = require('node:events');
|
|
@@ -63,8 +63,8 @@ declare module 'domain' {
|
|
|
63
63
|
* This is the most basic way to use a domain.
|
|
64
64
|
*
|
|
65
65
|
* ```js
|
|
66
|
-
* const domain = require('domain');
|
|
67
|
-
* const fs = require('fs');
|
|
66
|
+
* const domain = require('node:domain');
|
|
67
|
+
* const fs = require('node:fs');
|
|
68
68
|
* const d = domain.create();
|
|
69
69
|
* d.on('error', (er) => {
|
|
70
70
|
* console.error('Caught error!', er);
|