@types/node 20.12.6 → 20.12.8
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 +88 -44
- node/async_hooks.d.ts +17 -15
- node/buffer.d.ts +7 -7
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +38 -3
- node/dgram.d.ts +13 -13
- node/diagnostics_channel.d.ts +3 -3
- node/dns.d.ts +1 -1
- node/domain.d.ts +4 -4
- node/events.d.ts +25 -23
- node/fs/promises.d.ts +12 -12
- node/fs.d.ts +37 -37
- node/http.d.ts +4 -4
- node/http2.d.ts +77 -47
- node/https.d.ts +1 -1
- node/inspector.d.ts +4 -4
- node/net.d.ts +50 -8
- node/os.d.ts +28 -11
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +214 -43
- node/punycode.d.ts +4 -4
- node/querystring.d.ts +18 -6
- node/readline/promises.d.ts +9 -9
- node/readline.d.ts +21 -20
- node/repl.d.ts +7 -7
- node/stream/web.d.ts +2 -2
- node/stream.d.ts +8 -6
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +25 -23
- node/timers/promises.d.ts +10 -6
- node/timers.d.ts +5 -5
- node/tls.d.ts +39 -32
- node/trace_events.d.ts +40 -25
- node/tty.d.ts +8 -8
- node/url.d.ts +5 -5
- node/util.d.ts +115 -22
- node/v8.d.ts +6 -6
- node/vm.d.ts +35 -17
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +16 -16
- node/zlib.d.ts +16 -3
node/dgram.d.ts
CHANGED
|
@@ -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/v20.2
|
|
26
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/dgram.js)
|
|
27
27
|
*/
|
|
28
28
|
declare module "dgram" {
|
|
29
29
|
import { AddressInfo } from "node:net";
|
|
@@ -66,7 +66,7 @@ declare module "dgram" {
|
|
|
66
66
|
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
|
|
67
67
|
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
|
|
68
68
|
*
|
|
69
|
-
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
|
|
69
|
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
|
|
70
70
|
*
|
|
71
71
|
* ```js
|
|
72
72
|
* const controller = new AbortController();
|
|
@@ -93,7 +93,7 @@ declare module "dgram" {
|
|
|
93
93
|
*/
|
|
94
94
|
class Socket extends EventEmitter {
|
|
95
95
|
/**
|
|
96
|
-
* Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
|
|
96
|
+
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
|
97
97
|
* specified, the operating system will choose
|
|
98
98
|
* one interface and will add membership to it. To add membership to every
|
|
99
99
|
* available interface, call `addMembership` multiple times, once per interface.
|
|
@@ -122,7 +122,7 @@ declare module "dgram" {
|
|
|
122
122
|
addMembership(multicastAddress: string, multicastInterface?: string): void;
|
|
123
123
|
/**
|
|
124
124
|
* Returns an object containing the address information for a socket.
|
|
125
|
-
* For UDP sockets, this object will contain `address`, `family`, and `port`properties.
|
|
125
|
+
* For UDP sockets, this object will contain `address`, `family`, and `port` properties.
|
|
126
126
|
*
|
|
127
127
|
* This method throws `EBADF` if called on an unbound socket.
|
|
128
128
|
* @since v0.1.99
|
|
@@ -133,10 +133,10 @@ declare module "dgram" {
|
|
|
133
133
|
* messages on a named `port` and optional `address`. If `port` is not
|
|
134
134
|
* specified or is `0`, the operating system will attempt to bind to a
|
|
135
135
|
* random port. If `address` is not specified, the operating system will
|
|
136
|
-
* attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
|
|
136
|
+
* attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
|
|
137
137
|
* called.
|
|
138
138
|
*
|
|
139
|
-
* Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
|
|
139
|
+
* Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
|
|
140
140
|
* useful.
|
|
141
141
|
*
|
|
142
142
|
* A bound datagram socket keeps the Node.js process running to receive
|
|
@@ -206,7 +206,7 @@ declare module "dgram" {
|
|
|
206
206
|
*/
|
|
207
207
|
disconnect(): void;
|
|
208
208
|
/**
|
|
209
|
-
* Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
|
209
|
+
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
|
210
210
|
* kernel when the socket is closed or the process terminates, so most apps will
|
|
211
211
|
* never have reason to call this.
|
|
212
212
|
*
|
|
@@ -269,7 +269,7 @@ declare module "dgram" {
|
|
|
269
269
|
* any `TypedArray` or a `DataView`,
|
|
270
270
|
* the `offset` and `length` specify the offset within the `Buffer` where the
|
|
271
271
|
* message begins and the number of bytes in the message, respectively.
|
|
272
|
-
* If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
|
|
272
|
+
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
|
|
273
273
|
* contain multi-byte characters, `offset` and `length` will be calculated with
|
|
274
274
|
* respect to `byte length` and not the character position.
|
|
275
275
|
* If `msg` is an array, `offset` and `length` must not be specified.
|
|
@@ -287,7 +287,7 @@ declare module "dgram" {
|
|
|
287
287
|
* DNS lookups delay the time to send for at least one tick of the
|
|
288
288
|
* Node.js event loop.
|
|
289
289
|
*
|
|
290
|
-
* The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
|
|
290
|
+
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
|
|
291
291
|
* passed as the first argument to the `callback`. If a `callback` is not given,
|
|
292
292
|
* the error is emitted as an `'error'` event on the `socket` object.
|
|
293
293
|
*
|
|
@@ -329,7 +329,7 @@ declare module "dgram" {
|
|
|
329
329
|
* determine the optimal strategy on a case-by-case basis. Generally speaking,
|
|
330
330
|
* however, sending multiple buffers is faster.
|
|
331
331
|
*
|
|
332
|
-
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
|
|
332
|
+
* Example of sending a UDP packet using a socket connected to a port on `localhost`:
|
|
333
333
|
*
|
|
334
334
|
* ```js
|
|
335
335
|
* import dgram from 'node:dgram';
|
|
@@ -519,10 +519,10 @@ declare module "dgram" {
|
|
|
519
519
|
*/
|
|
520
520
|
unref(): this;
|
|
521
521
|
/**
|
|
522
|
-
* Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
|
|
522
|
+
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
|
|
523
523
|
* option. If the `multicastInterface` argument
|
|
524
524
|
* is not specified, the operating system will choose one interface and will add
|
|
525
|
-
* membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
|
|
525
|
+
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
|
|
526
526
|
*
|
|
527
527
|
* When called on an unbound socket, this method will implicitly bind to a random
|
|
528
528
|
* port, listening on all interfaces.
|
|
@@ -530,7 +530,7 @@ declare module "dgram" {
|
|
|
530
530
|
*/
|
|
531
531
|
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
|
532
532
|
/**
|
|
533
|
-
* Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
|
|
533
|
+
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
|
|
534
534
|
* automatically called by the kernel when the
|
|
535
535
|
* socket is closed or the process terminates, so most apps will never have
|
|
536
536
|
* reason to call this.
|
node/diagnostics_channel.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* should generally include the module name to avoid collisions with data from
|
|
21
21
|
* other modules.
|
|
22
22
|
* @since v15.1.0, v14.17.0
|
|
23
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
|
23
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/diagnostics_channel.js)
|
|
24
24
|
*/
|
|
25
25
|
declare module "diagnostics_channel" {
|
|
26
26
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -98,7 +98,7 @@ declare module "diagnostics_channel" {
|
|
|
98
98
|
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
|
|
99
99
|
/**
|
|
100
100
|
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
|
|
101
|
-
* channels will be created in the form of `tracing:${name}:${eventType}` where`eventType` corresponds to the types of `TracingChannel Channels`.
|
|
101
|
+
* channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
|
|
102
102
|
*
|
|
103
103
|
* ```js
|
|
104
104
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
@@ -335,7 +335,7 @@ declare module "diagnostics_channel" {
|
|
|
335
335
|
/**
|
|
336
336
|
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
|
|
337
337
|
* together express a single traceable action. It is used to formalize and
|
|
338
|
-
* simplify the process of producing events for tracing application flow.{@link tracingChannel} is used to construct a`TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
|
338
|
+
* simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
|
339
339
|
* single `TracingChannel` at the top-level of the file rather than creating them
|
|
340
340
|
* dynamically.
|
|
341
341
|
* @since v19.9.0
|
node/dns.d.ts
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
|
|
45
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/dns.js)
|
|
46
46
|
*/
|
|
47
47
|
declare module "dns" {
|
|
48
48
|
import * as dnsPromises from "node:dns/promises";
|
node/domain.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* Domains provide a way to handle multiple different IO operations as a
|
|
10
10
|
* single group. If any of the event emitters or callbacks registered to a
|
|
11
11
|
* domain emit an `'error'` event, or throw an error, then the domain object
|
|
12
|
-
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
|
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/v20.2
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/domain.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module "domain" {
|
|
18
18
|
import EventEmitter = require("node:events");
|
|
@@ -29,7 +29,7 @@ declare module "domain" {
|
|
|
29
29
|
*/
|
|
30
30
|
members: Array<EventEmitter | NodeJS.Timer>;
|
|
31
31
|
/**
|
|
32
|
-
* The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
|
|
32
|
+
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
|
|
33
33
|
* pushes the domain onto the domain
|
|
34
34
|
* stack managed by the domain module (see {@link exit} for details on the
|
|
35
35
|
* domain stack). The call to `enter()` delimits the beginning of a chain of
|
|
@@ -47,7 +47,7 @@ declare module "domain" {
|
|
|
47
47
|
* The call to `exit()` delimits either the end of or an interruption to the chain
|
|
48
48
|
* of asynchronous calls and I/O operations bound to a domain.
|
|
49
49
|
*
|
|
50
|
-
* If there are multiple, nested domains bound to the current execution context
|
|
50
|
+
* If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain.
|
|
51
51
|
*
|
|
52
52
|
* Calling `exit()` changes only the active domain, and does not alter the domain
|
|
53
53
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
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/v20.2
|
|
35
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/events.js)
|
|
36
36
|
*/
|
|
37
37
|
declare module "events" {
|
|
38
38
|
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
|
|
@@ -158,7 +158,7 @@ declare module "events" {
|
|
|
158
158
|
* }
|
|
159
159
|
* ```
|
|
160
160
|
*
|
|
161
|
-
* 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
|
|
161
|
+
* 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
|
|
162
162
|
* '`error'` event itself, then it is treated as any other kind of event without
|
|
163
163
|
* special handling:
|
|
164
164
|
*
|
|
@@ -266,7 +266,7 @@ declare module "events" {
|
|
|
266
266
|
* ```
|
|
267
267
|
* @since v13.6.0, v12.16.0
|
|
268
268
|
* @param eventName The name of the event being listened for
|
|
269
|
-
* @return that iterates `eventName` events emitted by the `emitter`
|
|
269
|
+
* @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
|
|
270
270
|
*/
|
|
271
271
|
static on(
|
|
272
272
|
emitter: NodeJS.EventEmitter,
|
|
@@ -274,7 +274,7 @@ declare module "events" {
|
|
|
274
274
|
options?: StaticEventEmitterOptions,
|
|
275
275
|
): AsyncIterableIterator<any>;
|
|
276
276
|
/**
|
|
277
|
-
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
|
277
|
+
* A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
|
|
278
278
|
*
|
|
279
279
|
* ```js
|
|
280
280
|
* import { EventEmitter, listenerCount } from 'node:events';
|
|
@@ -399,9 +399,9 @@ declare module "events" {
|
|
|
399
399
|
*/
|
|
400
400
|
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
|
401
401
|
/**
|
|
402
|
-
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
|
|
402
|
+
* This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called.
|
|
403
403
|
*
|
|
404
|
-
* Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no
|
|
404
|
+
* Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no
|
|
405
405
|
* regular `'error'` listener is installed.
|
|
406
406
|
* @since v13.6.0, v12.17.0
|
|
407
407
|
*/
|
|
@@ -424,16 +424,18 @@ declare module "events" {
|
|
|
424
424
|
* By default, a maximum of `10` listeners can be registered for any single
|
|
425
425
|
* event. This limit can be changed for individual `EventEmitter` instances
|
|
426
426
|
* using the `emitter.setMaxListeners(n)` method. To change the default
|
|
427
|
-
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property
|
|
427
|
+
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property
|
|
428
|
+
* can be used. If this value is not a positive number, a `RangeError` is thrown.
|
|
428
429
|
*
|
|
429
430
|
* Take caution when setting the `events.defaultMaxListeners` because the
|
|
430
|
-
* change affects _all_`EventEmitter` instances, including those created before
|
|
431
|
+
* change affects _all_ `EventEmitter` instances, including those created before
|
|
431
432
|
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
|
|
432
433
|
* precedence over `events.defaultMaxListeners`.
|
|
433
434
|
*
|
|
434
435
|
* This is not a hard limit. The `EventEmitter` instance will allow
|
|
435
436
|
* more listeners to be added but will output a trace warning to stderr indicating
|
|
436
|
-
* that a "possible EventEmitter memory leak" has been detected. For any single
|
|
437
|
+
* that a "possible EventEmitter memory leak" has been detected. For any single
|
|
438
|
+
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to
|
|
437
439
|
* temporarily avoid this warning:
|
|
438
440
|
*
|
|
439
441
|
* ```js
|
|
@@ -557,10 +559,10 @@ declare module "events" {
|
|
|
557
559
|
*/
|
|
558
560
|
addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
559
561
|
/**
|
|
560
|
-
* Adds the `listener` function to the end of the listeners array for the
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
* times.
|
|
562
|
+
* Adds the `listener` function to the end of the listeners array for the event
|
|
563
|
+
* named `eventName`. No checks are made to see if the `listener` has already
|
|
564
|
+
* been added. Multiple calls passing the same combination of `eventName` and
|
|
565
|
+
* `listener` will result in the `listener` being added, and called, multiple times.
|
|
564
566
|
*
|
|
565
567
|
* ```js
|
|
566
568
|
* server.on('connection', (stream) => {
|
|
@@ -570,7 +572,7 @@ declare module "events" {
|
|
|
570
572
|
*
|
|
571
573
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
572
574
|
*
|
|
573
|
-
* By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
|
|
575
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
|
|
574
576
|
* event listener to the beginning of the listeners array.
|
|
575
577
|
*
|
|
576
578
|
* ```js
|
|
@@ -589,7 +591,7 @@ declare module "events" {
|
|
|
589
591
|
*/
|
|
590
592
|
on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
591
593
|
/**
|
|
592
|
-
* Adds a **one-time
|
|
594
|
+
* Adds a **one-time** `listener` function for the event named `eventName`. The
|
|
593
595
|
* next time `eventName` is triggered, this listener is removed and then invoked.
|
|
594
596
|
*
|
|
595
597
|
* ```js
|
|
@@ -600,7 +602,7 @@ declare module "events" {
|
|
|
600
602
|
*
|
|
601
603
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
602
604
|
*
|
|
603
|
-
* By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
|
|
605
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
|
|
604
606
|
* event listener to the beginning of the listeners array.
|
|
605
607
|
*
|
|
606
608
|
* ```js
|
|
@@ -619,7 +621,7 @@ declare module "events" {
|
|
|
619
621
|
*/
|
|
620
622
|
once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
621
623
|
/**
|
|
622
|
-
* Removes the specified `listener` from the listener array for the event named`eventName`.
|
|
624
|
+
* Removes the specified `listener` from the listener array for the event named `eventName`.
|
|
623
625
|
*
|
|
624
626
|
* ```js
|
|
625
627
|
* const callback = (stream) => {
|
|
@@ -636,7 +638,7 @@ declare module "events" {
|
|
|
636
638
|
* called multiple times to remove each instance.
|
|
637
639
|
*
|
|
638
640
|
* Once an event is emitted, all listeners attached to it at the
|
|
639
|
-
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
|
641
|
+
* time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
|
640
642
|
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
|
|
641
643
|
*
|
|
642
644
|
* ```js
|
|
@@ -679,7 +681,7 @@ declare module "events" {
|
|
|
679
681
|
*
|
|
680
682
|
* When a single function has been added as a handler multiple times for a single
|
|
681
683
|
* event (as in the example below), `removeListener()` will remove the most
|
|
682
|
-
* recently added instance. In the example the `once('ping')`listener is removed:
|
|
684
|
+
* recently added instance. In the example the `once('ping')` listener is removed:
|
|
683
685
|
*
|
|
684
686
|
* ```js
|
|
685
687
|
* import { EventEmitter } from 'node:events';
|
|
@@ -721,7 +723,7 @@ declare module "events" {
|
|
|
721
723
|
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
|
722
724
|
* added for a particular event. This is a useful default that helps finding
|
|
723
725
|
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
|
724
|
-
* modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
726
|
+
* modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
725
727
|
*
|
|
726
728
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
727
729
|
* @since v0.3.5
|
|
@@ -778,7 +780,7 @@ declare module "events" {
|
|
|
778
780
|
*/
|
|
779
781
|
rawListeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
|
780
782
|
/**
|
|
781
|
-
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
|
|
783
|
+
* Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
|
|
782
784
|
* to each.
|
|
783
785
|
*
|
|
784
786
|
* Returns `true` if the event had listeners, `false` otherwise.
|
|
@@ -830,8 +832,8 @@ declare module "events" {
|
|
|
830
832
|
/**
|
|
831
833
|
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
|
832
834
|
* event named `eventName`. No checks are made to see if the `listener` has
|
|
833
|
-
* already been added. Multiple calls passing the same combination of `eventName`
|
|
834
|
-
* times.
|
|
835
|
+
* already been added. Multiple calls passing the same combination of `eventName`
|
|
836
|
+
* and `listener` will result in the `listener` being added, and called, multiple times.
|
|
835
837
|
*
|
|
836
838
|
* ```js
|
|
837
839
|
* server.prependListener('connection', (stream) => {
|
node/fs/promises.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ declare module "fs/promises" {
|
|
|
189
189
|
* replacing it may require the `flags` `open` option to be set to `r+` rather than
|
|
190
190
|
* the default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
|
191
191
|
*
|
|
192
|
-
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
192
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false,
|
|
193
193
|
* then the file descriptor won't be closed, even if there's an error.
|
|
194
194
|
* It is the application's responsibility to close it and make sure there's no
|
|
195
195
|
* file descriptor leak.
|
|
@@ -268,7 +268,7 @@ declare module "fs/promises" {
|
|
|
268
268
|
*
|
|
269
269
|
* The `FileHandle` has to support reading.
|
|
270
270
|
*
|
|
271
|
-
* 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
|
|
271
|
+
* 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
|
|
272
272
|
* position till the end of the file. It doesn't always read from the beginning
|
|
273
273
|
* of the file.
|
|
274
274
|
* @since v10.0.0
|
|
@@ -375,7 +375,7 @@ declare module "fs/promises" {
|
|
|
375
375
|
*/
|
|
376
376
|
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
377
377
|
/**
|
|
378
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
378
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
379
379
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
380
380
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
381
381
|
* The promise is fulfilled with no arguments upon success.
|
|
@@ -485,7 +485,7 @@ declare module "fs/promises" {
|
|
|
485
485
|
/**
|
|
486
486
|
* Tests a user's permissions for the file or directory specified by `path`.
|
|
487
487
|
* The `mode` argument is an optional integer that specifies the accessibility
|
|
488
|
-
* checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK
|
|
488
|
+
* checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK`
|
|
489
489
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
|
490
490
|
* possible values of `mode`.
|
|
491
491
|
*
|
|
@@ -570,7 +570,7 @@ declare module "fs/promises" {
|
|
|
570
570
|
*/
|
|
571
571
|
function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
572
572
|
/**
|
|
573
|
-
* Truncates (shortens or extends the length) of the content at `path` to `len`bytes.
|
|
573
|
+
* Truncates (shortens or extends the length) of the content at `path` to `len` bytes.
|
|
574
574
|
* @since v10.0.0
|
|
575
575
|
* @param [len=0]
|
|
576
576
|
* @return Fulfills with `undefined` upon success.
|
|
@@ -580,7 +580,7 @@ declare module "fs/promises" {
|
|
|
580
580
|
* Removes the directory identified by `path`.
|
|
581
581
|
*
|
|
582
582
|
* Using `fsPromises.rmdir()` on a file (not a directory) results in the
|
|
583
|
-
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX.
|
|
583
|
+
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX.
|
|
584
584
|
*
|
|
585
585
|
* To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`.
|
|
586
586
|
* @since v10.0.0
|
|
@@ -597,7 +597,7 @@ declare module "fs/promises" {
|
|
|
597
597
|
* Asynchronously creates a directory.
|
|
598
598
|
*
|
|
599
599
|
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
600
|
-
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory
|
|
600
|
+
* and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fsPromises.mkdir()` when `path` is a directory
|
|
601
601
|
* that exists results in a
|
|
602
602
|
* rejection only when `recursive` is false.
|
|
603
603
|
*
|
|
@@ -747,7 +747,7 @@ declare module "fs/promises" {
|
|
|
747
747
|
/**
|
|
748
748
|
* Creates a symbolic link.
|
|
749
749
|
*
|
|
750
|
-
* The `type` argument is only used on Windows platforms and can be one of `'dir'
|
|
750
|
+
* The `type` argument is only used on Windows platforms and can be one of `'dir'`, `'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will
|
|
751
751
|
* autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
|
|
752
752
|
* exist, `'file'` will be used. Windows junction points require the destination
|
|
753
753
|
* path to be absolute. When using `'junction'`, the `target` argument will
|
|
@@ -867,13 +867,13 @@ declare module "fs/promises" {
|
|
|
867
867
|
*
|
|
868
868
|
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
|
|
869
869
|
* numeric string like `'123456789.0'`.
|
|
870
|
-
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
|
|
870
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
|
|
871
871
|
* @since v10.0.0
|
|
872
872
|
* @return Fulfills with `undefined` upon success.
|
|
873
873
|
*/
|
|
874
874
|
function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
875
875
|
/**
|
|
876
|
-
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
|
|
876
|
+
* Determines the actual location of `path` using the same semantics as the `fs.realpath.native()` function.
|
|
877
877
|
*
|
|
878
878
|
* Only paths that can be converted to UTF8 strings are supported.
|
|
879
879
|
*
|
|
@@ -927,7 +927,7 @@ declare module "fs/promises" {
|
|
|
927
927
|
* ```
|
|
928
928
|
*
|
|
929
929
|
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
|
930
|
-
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
|
|
930
|
+
* characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing
|
|
931
931
|
* platform-specific path separator
|
|
932
932
|
* (`require('node:path').sep`).
|
|
933
933
|
* @since v10.0.0
|
|
@@ -947,7 +947,7 @@ declare module "fs/promises" {
|
|
|
947
947
|
*/
|
|
948
948
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
|
949
949
|
/**
|
|
950
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
950
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
951
951
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
952
952
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
953
953
|
*
|