@types/node 16.4.14 → 16.7.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/dgram.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * The `dgram` module provides an implementation of UDP datagram sockets.
3
3
  *
4
4
  * ```js
5
- * const dgram = require('dgram');
5
+ * import dgram from 'dgram';
6
+ *
6
7
  * const server = dgram.createSocket('udp4');
7
8
  *
8
9
  * server.on('error', (err) => {
@@ -22,7 +23,7 @@
22
23
  * server.bind(41234);
23
24
  * // Prints: server listening 0.0.0.0:41234
24
25
  * ```
25
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/dgram.js)
26
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dgram.js)
26
27
  */
27
28
  declare module 'dgram' {
28
29
  import { AddressInfo } from 'node:net';
@@ -97,8 +98,9 @@ declare module 'dgram' {
97
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:
98
99
  *
99
100
  * ```js
100
- * const cluster = require('cluster');
101
- * const dgram = require('dgram');
101
+ * import cluster from 'cluster';
102
+ * import dgram from 'dgram';
103
+ *
102
104
  * if (cluster.isPrimary) {
103
105
  * cluster.fork(); // Works ok.
104
106
  * cluster.fork(); // Fails with EADDRINUSE.
@@ -140,7 +142,8 @@ declare module 'dgram' {
140
142
  * Example of a UDP server listening on port 41234:
141
143
  *
142
144
  * ```js
143
- * const dgram = require('dgram');
145
+ * import dgram from 'dgram';
146
+ *
144
147
  * const server = dgram.createSocket('udp4');
145
148
  *
146
149
  * server.on('error', (err) => {
@@ -281,7 +284,9 @@ declare module 'dgram' {
281
284
  * Example of sending a UDP packet to a port on `localhost`;
282
285
  *
283
286
  * ```js
284
- * const dgram = require('dgram');
287
+ * import dgram from 'dgram';
288
+ * import { Buffer } from 'buffer';
289
+ *
285
290
  * const message = Buffer.from('Some bytes');
286
291
  * const client = dgram.createSocket('udp4');
287
292
  * client.send(message, 41234, 'localhost', (err) => {
@@ -292,7 +297,9 @@ declare module 'dgram' {
292
297
  * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
293
298
  *
294
299
  * ```js
295
- * const dgram = require('dgram');
300
+ * import dgram from 'dgram';
301
+ * import { Buffer } from 'buffer';
302
+ *
296
303
  * const buf1 = Buffer.from('Some ');
297
304
  * const buf2 = Buffer.from('bytes');
298
305
  * const client = dgram.createSocket('udp4');
@@ -309,7 +316,9 @@ declare module 'dgram' {
309
316
  * Example of sending a UDP packet using a socket connected to a port on`localhost`:
310
317
  *
311
318
  * ```js
312
- * const dgram = require('dgram');
319
+ * import dgram from 'dgram';
320
+ * import { Buffer } from 'buffer';
321
+ *
313
322
  * const message = Buffer.from('Some bytes');
314
323
  * const client = dgram.createSocket('udp4');
315
324
  * client.connect(41234, 'localhost', (err) => {
@@ -5,7 +5,7 @@
5
5
  * It can be accessed using:
6
6
  *
7
7
  * ```js
8
- * const diagnostics_channel = require('diagnostics_channel');
8
+ * import diagnostics_channel from 'diagnostics_channel';
9
9
  * ```
10
10
  *
11
11
  * It is intended that a module writer wanting to report diagnostics messages
@@ -20,7 +20,7 @@
20
20
  * should generally include the module name to avoid collisions with data from
21
21
  * other modules.
22
22
  * @experimental
23
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/diagnostics_channel.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.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
- * const diagnostics_channel = require('diagnostics_channel');
34
+ * import diagnostics_channel from 'diagnostics_channel';
35
35
  *
36
36
  * if (diagnostics_channel.hasSubscribers('my-channel')) {
37
37
  * // There are subscribers, prepare and publish message
@@ -47,7 +47,7 @@ declare module 'diagnostics_channel' {
47
47
  * publish time as much as possible.
48
48
  *
49
49
  * ```js
50
- * const diagnostics_channel = require('diagnostics_channel');
50
+ * import diagnostics_channel from 'diagnostics_channel';
51
51
  *
52
52
  * const channel = diagnostics_channel.channel('my-channel');
53
53
  * ```
@@ -66,7 +66,24 @@ declare module 'diagnostics_channel' {
66
66
  */
67
67
  class Channel {
68
68
  readonly name: string;
69
- readonly hashSubscribers: boolean;
69
+ /**
70
+ * Check if there are active subscribers to this channel. This is helpful if
71
+ * the message you want to send might be expensive to prepare.
72
+ *
73
+ * This API is optional but helpful when trying to publish messages from very
74
+ * performance-sensitive code.
75
+ *
76
+ * ```js
77
+ * import diagnostics_channel from 'diagnostics_channel';
78
+ *
79
+ * const channel = diagnostics_channel.channel('my-channel');
80
+ *
81
+ * if (channel.hasSubscribers) {
82
+ * // There are subscribers, prepare and publish message
83
+ * }
84
+ * ```
85
+ */
86
+ readonly hasSubscribers: boolean;
70
87
  private constructor(name: string);
71
88
  /**
72
89
  * Register a message handler to subscribe to this channel. This message handler
@@ -74,7 +91,7 @@ declare module 'diagnostics_channel' {
74
91
  * errors thrown in the message handler will trigger an `'uncaughtException'`.
75
92
  *
76
93
  * ```js
77
- * const diagnostics_channel = require('diagnostics_channel');
94
+ * import diagnostics_channel from 'diagnostics_channel';
78
95
  *
79
96
  * const channel = diagnostics_channel.channel('my-channel');
80
97
  *
@@ -89,7 +106,7 @@ declare module 'diagnostics_channel' {
89
106
  * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
90
107
  *
91
108
  * ```js
92
- * const diagnostics_channel = require('diagnostics_channel');
109
+ * import diagnostics_channel from 'diagnostics_channel';
93
110
  *
94
111
  * const channel = diagnostics_channel.channel('my-channel');
95
112
  *
node/dns.d.ts CHANGED
@@ -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/v16.4.2/lib/dns.js)
45
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dns.js)
46
46
  */
47
47
  declare module 'dns' {
48
48
  import * as dnsPromises from 'node:dns/promises';
@@ -553,6 +553,10 @@ declare module 'dns' {
553
553
  export const CANCELLED: string;
554
554
  export interface ResolverOptions {
555
555
  timeout?: number | undefined;
556
+ /**
557
+ * @default 4
558
+ */
559
+ tries?: number;
556
560
  }
557
561
  /**
558
562
  * An independent resolver for DNS requests.
node/domain.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **This module is pending deprecation**. Once a replacement API has been
2
+ * **This module is pending deprecation.** Once a replacement API has been
3
3
  * finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
4
4
  * the functionality that domains provide may rely on it for the time being
5
5
  * but should expect to have to migrate to a different solution
@@ -11,7 +11,7 @@
11
11
  * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
12
12
  * exit immediately with an error code.
13
13
  * @deprecated Since v1.4.2 - Deprecated
14
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/domain.js)
14
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/domain.js)
15
15
  */
16
16
  declare module 'domain' {
17
17
  import EventEmitter = require('node:events');
node/events.d.ts CHANGED
@@ -32,7 +32,7 @@
32
32
  * });
33
33
  * myEmitter.emit('event');
34
34
  * ```
35
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/events.js)
35
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/events.js)
36
36
  */
37
37
  declare module 'events' {
38
38
  interface EventEmitterOptions {
@@ -72,15 +72,194 @@ declare module 'events' {
72
72
  */
73
73
  class EventEmitter {
74
74
  constructor(options?: EventEmitterOptions);
75
+ /**
76
+ * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
77
+ * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
78
+ * The `Promise` will resolve with an array of all the arguments emitted to the
79
+ * given event.
80
+ *
81
+ * This method is intentionally generic and works with the web platform[EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
82
+ * semantics and does not listen to the `'error'` event.
83
+ *
84
+ * ```js
85
+ * const { once, EventEmitter } = require('events');
86
+ *
87
+ * async function run() {
88
+ * const ee = new EventEmitter();
89
+ *
90
+ * process.nextTick(() => {
91
+ * ee.emit('myevent', 42);
92
+ * });
93
+ *
94
+ * const [value] = await once(ee, 'myevent');
95
+ * console.log(value);
96
+ *
97
+ * const err = new Error('kaboom');
98
+ * process.nextTick(() => {
99
+ * ee.emit('error', err);
100
+ * });
101
+ *
102
+ * try {
103
+ * await once(ee, 'myevent');
104
+ * } catch (err) {
105
+ * console.log('error happened', err);
106
+ * }
107
+ * }
108
+ *
109
+ * run();
110
+ * ```
111
+ *
112
+ * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
113
+ * '`error'` event itself, then it is treated as any other kind of event without
114
+ * special handling:
115
+ *
116
+ * ```js
117
+ * const { EventEmitter, once } = require('events');
118
+ *
119
+ * const ee = new EventEmitter();
120
+ *
121
+ * once(ee, 'error')
122
+ * .then(([err]) => console.log('ok', err.message))
123
+ * .catch((err) => console.log('error', err.message));
124
+ *
125
+ * ee.emit('error', new Error('boom'));
126
+ *
127
+ * // Prints: ok boom
128
+ * ```
129
+ *
130
+ * An `AbortSignal` can be used to cancel waiting for the event:
131
+ *
132
+ * ```js
133
+ * const { EventEmitter, once } = require('events');
134
+ *
135
+ * const ee = new EventEmitter();
136
+ * const ac = new AbortController();
137
+ *
138
+ * async function foo(emitter, event, signal) {
139
+ * try {
140
+ * await once(emitter, event, { signal });
141
+ * console.log('event emitted!');
142
+ * } catch (error) {
143
+ * if (error.name === 'AbortError') {
144
+ * console.error('Waiting for the event was canceled!');
145
+ * } else {
146
+ * console.error('There was an error', error.message);
147
+ * }
148
+ * }
149
+ * }
150
+ *
151
+ * foo(ee, 'foo', ac.signal);
152
+ * ac.abort(); // Abort waiting for the event
153
+ * ee.emit('foo'); // Prints: Waiting for the event was canceled!
154
+ * ```
155
+ * @since v11.13.0, v10.16.0
156
+ */
75
157
  static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
76
158
  static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
159
+ /**
160
+ * ```js
161
+ * const { on, EventEmitter } = require('events');
162
+ *
163
+ * (async () => {
164
+ * const ee = new EventEmitter();
165
+ *
166
+ * // Emit later on
167
+ * process.nextTick(() => {
168
+ * ee.emit('foo', 'bar');
169
+ * ee.emit('foo', 42);
170
+ * });
171
+ *
172
+ * for await (const event of on(ee, 'foo')) {
173
+ * // The execution of this inner block is synchronous and it
174
+ * // processes one event at a time (even with await). Do not use
175
+ * // if concurrent execution is required.
176
+ * console.log(event); // prints ['bar'] [42]
177
+ * }
178
+ * // Unreachable here
179
+ * })();
180
+ * ```
181
+ *
182
+ * Returns an `AsyncIterator` that iterates `eventName` events. It will throw
183
+ * if the `EventEmitter` emits `'error'`. It removes all listeners when
184
+ * exiting the loop. The `value` returned by each iteration is an array
185
+ * composed of the emitted event arguments.
186
+ *
187
+ * An `AbortSignal` can be used to cancel waiting on events:
188
+ *
189
+ * ```js
190
+ * const { on, EventEmitter } = require('events');
191
+ * const ac = new AbortController();
192
+ *
193
+ * (async () => {
194
+ * const ee = new EventEmitter();
195
+ *
196
+ * // Emit later on
197
+ * process.nextTick(() => {
198
+ * ee.emit('foo', 'bar');
199
+ * ee.emit('foo', 42);
200
+ * });
201
+ *
202
+ * for await (const event of on(ee, 'foo', { signal: ac.signal })) {
203
+ * // The execution of this inner block is synchronous and it
204
+ * // processes one event at a time (even with await). Do not use
205
+ * // if concurrent execution is required.
206
+ * console.log(event); // prints ['bar'] [42]
207
+ * }
208
+ * // Unreachable here
209
+ * })();
210
+ *
211
+ * process.nextTick(() => ac.abort());
212
+ * ```
213
+ * @since v13.6.0, v12.16.0
214
+ * @param eventName The name of the event being listened for
215
+ * @return that iterates `eventName` events emitted by the `emitter`
216
+ */
77
217
  static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
78
- /** @deprecated since v4.0.0 */
218
+ /**
219
+ * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
220
+ *
221
+ * ```js
222
+ * const { EventEmitter, listenerCount } = require('events');
223
+ * const myEmitter = new EventEmitter();
224
+ * myEmitter.on('event', () => {});
225
+ * myEmitter.on('event', () => {});
226
+ * console.log(listenerCount(myEmitter, 'event'));
227
+ * // Prints: 2
228
+ * ```
229
+ * @since v0.9.12
230
+ * @deprecated Since v3.2.0 - Use `listenerCount` instead.
231
+ * @param emitter The emitter to query
232
+ * @param eventName The event name
233
+ */
79
234
  static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
80
235
  /**
81
- * Returns a list listener for a specific emitter event name.
236
+ * Returns a copy of the array of listeners for the event named `eventName`.
237
+ *
238
+ * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
239
+ * the emitter.
240
+ *
241
+ * For `EventTarget`s this is the only way to get the event listeners for the
242
+ * event target. This is useful for debugging and diagnostic purposes.
243
+ *
244
+ * ```js
245
+ * const { getEventListeners, EventEmitter } = require('events');
246
+ *
247
+ * {
248
+ * const ee = new EventEmitter();
249
+ * const listener = () => console.log('Events are fun');
250
+ * ee.on('foo', listener);
251
+ * getEventListeners(ee, 'foo'); // [listener]
252
+ * }
253
+ * {
254
+ * const et = new EventTarget();
255
+ * const listener = () => console.log('Events are fun');
256
+ * et.addEventListener('foo', listener);
257
+ * getEventListeners(et, 'foo'); // [listener]
258
+ * }
259
+ * ```
260
+ * @since v15.2.0
82
261
  */
83
- static getEventListener(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
262
+ static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
84
263
  /**
85
264
  * This symbol shall be used to install a listener for only monitoring `'error'`
86
265
  * events. Listeners installed using this symbol are called before the regular
node/fs/promises.d.ts CHANGED
@@ -30,8 +30,9 @@ declare module 'fs/promises' {
30
30
  Mode,
31
31
  WatchOptions,
32
32
  WatchEventType,
33
+ CopyOptions,
33
34
  } from 'node:fs';
34
- interface FileChangeInfo<T extends (string | Buffer)> {
35
+ interface FileChangeInfo<T extends string | Buffer> {
35
36
  eventType: WatchEventType;
36
37
  filename: T;
37
38
  }
@@ -126,7 +127,7 @@ declare module 'fs/promises' {
126
127
  *
127
128
  * If `options` is a string, then it specifies the `encoding`.
128
129
  *
129
- * The `<FileHandle>` has to support reading.
130
+ * The `FileHandle` has to support reading.
130
131
  *
131
132
  * If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current
132
133
  * position till the end of the file. It doesn't always read from the beginning
@@ -214,7 +215,7 @@ declare module 'fs/promises' {
214
215
  */
215
216
  truncate(len?: number): Promise<void>;
216
217
  /**
217
- * Change the file system timestamps of the object referenced by the `<FileHandle>` then resolves the promise with no arguments upon success.
218
+ * Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success.
218
219
  * @since v10.0.0
219
220
  */
220
221
  utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
@@ -224,7 +225,7 @@ declare module 'fs/promises' {
224
225
  *
225
226
  * If `options` is a string, then it specifies the `encoding`.
226
227
  *
227
- * The `<FileHandle>` has to support writing.
228
+ * The `FileHandle` has to support writing.
228
229
  *
229
230
  * It is unsafe to use `filehandle.writeFile()` multiple times on the same file
230
231
  * without waiting for the promise to be resolved (or rejected).
@@ -238,6 +239,8 @@ declare module 'fs/promises' {
238
239
  /**
239
240
  * Write `buffer` to the file.
240
241
  *
242
+ * If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
243
+ *
241
244
  * The promise is resolved with an object containing two properties:
242
245
  *
243
246
  * It is unsafe to use `filehandle.write()` multiple times on the same file
@@ -382,7 +385,7 @@ declare module 'fs/promises' {
382
385
  */
383
386
  function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise<void>;
384
387
  /**
385
- * Opens a `<FileHandle>`.
388
+ * Opens a `FileHandle`.
386
389
  *
387
390
  * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail.
388
391
  *
@@ -469,9 +472,9 @@ declare module 'fs/promises' {
469
472
  * The optional `options` argument can be a string specifying an encoding, or an
470
473
  * object with an `encoding` property specifying the character encoding to use for
471
474
  * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
472
- * will be passed as `<Buffer>` objects.
475
+ * will be passed as `Buffer` objects.
473
476
  *
474
- * If `options.withFileTypes` is set to `true`, the resolved array will contain `<fs.Dirent>` objects.
477
+ * If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
475
478
  *
476
479
  * ```js
477
480
  * import { readdir } from 'fs/promises';
@@ -542,7 +545,7 @@ declare module 'fs/promises' {
542
545
  * The optional `options` argument can be a string specifying an encoding, or an
543
546
  * object with an `encoding` property specifying the character encoding to use for
544
547
  * the link path returned. If the `encoding` is set to `'buffer'`, the link path
545
- * returned will be passed as a `<Buffer>` object.
548
+ * returned will be passed as a `Buffer` object.
546
549
  * @since v10.0.0
547
550
  * @return Fulfills with the `linkString` upon success.
548
551
  */
@@ -675,7 +678,7 @@ declare module 'fs/promises' {
675
678
  * The optional `options` argument can be a string specifying an encoding, or an
676
679
  * object with an `encoding` property specifying the character encoding to use for
677
680
  * the path. If the `encoding` is set to `'buffer'`, the path returned will be
678
- * passed as a `<Buffer>` object.
681
+ * passed as a `Buffer` object.
679
682
  *
680
683
  * On Linux, when Node.js is linked against musl libc, the procfs file system must
681
684
  * be mounted on `/proc` in order for this function to work. Glibc does not have
@@ -737,14 +740,13 @@ declare module 'fs/promises' {
737
740
  */
738
741
  function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
739
742
  /**
740
- * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `<Buffer>`, or an object with an own `toString` function
741
- * property.
743
+ * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `Buffer`, or, an object with an own (not inherited)`toString` function property.
742
744
  *
743
745
  * The `encoding` option is ignored if `data` is a buffer.
744
746
  *
745
747
  * If `options` is a string, then it specifies the encoding.
746
748
  *
747
- * Any specified `<FileHandle>` has to support writing.
749
+ * Any specified `FileHandle` has to support writing.
748
750
  *
749
751
  * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file
750
752
  * without waiting for the promise to be settled.
@@ -753,12 +755,13 @@ declare module 'fs/promises' {
753
755
  * method that performs multiple `write` calls internally to write the buffer
754
756
  * passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
755
757
  *
756
- * It is possible to use an `<AbortSignal>` to cancel an `fsPromises.writeFile()`.
758
+ * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
757
759
  * Cancelation is "best effort", and some amount of data is likely still
758
760
  * to be written.
759
761
  *
760
762
  * ```js
761
763
  * import { writeFile } from 'fs/promises';
764
+ * import { Buffer } from 'buffer';
762
765
  *
763
766
  * try {
764
767
  * const controller = new AbortController();
@@ -795,11 +798,11 @@ declare module 'fs/promises' {
795
798
  ): Promise<void>;
796
799
  /**
797
800
  * Asynchronously append data to a file, creating the file if it does not yet
798
- * exist. `data` can be a string or a `<Buffer>`.
801
+ * exist. `data` can be a string or a `Buffer`.
799
802
  *
800
803
  * If `options` is a string, then it specifies the `encoding`.
801
804
  *
802
- * The `path` may be specified as a `<FileHandle>` that has been opened
805
+ * The `path` may be specified as a `FileHandle` that has been opened
803
806
  * for appending (using `fsPromises.open()`).
804
807
  * @since v10.0.0
805
808
  * @param path filename or {FileHandle}
@@ -810,7 +813,7 @@ declare module 'fs/promises' {
810
813
  * Asynchronously reads the entire contents of a file.
811
814
  *
812
815
  * If no encoding is specified (using `options.encoding`), the data is returned
813
- * as a `<Buffer>` object. Otherwise, the data will be a string.
816
+ * as a `Buffer` object. Otherwise, the data will be a string.
814
817
  *
815
818
  * If `options` is a string, then it specifies the encoding.
816
819
  *
@@ -819,7 +822,7 @@ declare module 'fs/promises' {
819
822
  * with an error. On FreeBSD, a representation of the directory's contents will be
820
823
  * returned.
821
824
  *
822
- * It is possible to abort an ongoing `readFile` using an `<AbortSignal>`. If a
825
+ * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a
823
826
  * request is aborted the promise returned is rejected with an `AbortError`:
824
827
  *
825
828
  * ```js
@@ -843,7 +846,7 @@ declare module 'fs/promises' {
843
846
  * Aborting an ongoing request does not abort individual operating
844
847
  * system requests but rather the internal buffering `fs.readFile` performs.
845
848
  *
846
- * Any specified `<FileHandle>` has to support reading.
849
+ * Any specified `FileHandle` has to support reading.
847
850
  * @since v10.0.0
848
851
  * @param path filename or `FileHandle`
849
852
  * @return Fulfills with the contents of the file.
@@ -893,7 +896,7 @@ declare module 'fs/promises' {
893
896
  /**
894
897
  * Asynchronously open a directory for iterative scanning. See the POSIX[`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
895
898
  *
896
- * Creates an `<fs.Dir>`, which contains all further functions for reading from
899
+ * Creates an `fs.Dir`, which contains all further functions for reading from
897
900
  * and cleaning up the directory.
898
901
  *
899
902
  * The `encoding` option sets the encoding for the `path` while opening the
@@ -913,7 +916,7 @@ declare module 'fs/promises' {
913
916
  * }
914
917
  * ```
915
918
  *
916
- * When using the async iterator, the `<fs.Dir>` object will be automatically
919
+ * When using the async iterator, the `fs.Dir` object will be automatically
917
920
  * closed after the iterator exits.
918
921
  * @since v12.12.0
919
922
  * @return Fulfills with an {fs.Dir}.
@@ -975,6 +978,19 @@ declare module 'fs/promises' {
975
978
  * If `recursive` is not supplied, the default of `false` is used.
976
979
  */
977
980
  function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
981
+ /**
982
+ * Asynchronously copies the entire directory structure from `src` to `dest`,
983
+ * including subdirectories and files.
984
+ *
985
+ * When copying a directory to another directory, globs are not supported and
986
+ * behavior is similar to `cp dir1/ dir2/`.
987
+ * @since v16.7.0
988
+ * @experimental
989
+ * @param src source path to copy.
990
+ * @param dest destination path to copy to.
991
+ * @return Fulfills with `undefined` upon success.
992
+ */
993
+ function cp(source: string, destination: string, opts?: CopyOptions): Promise<void>;
978
994
  }
979
995
  declare module 'node:fs/promises' {
980
996
  export * from 'fs/promises';