@types/node 20.19.25 → 24.10.4

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.
Files changed (79) hide show
  1. {node v20.19 → node v24.10}/README.md +3 -3
  2. node v24.10/assert/strict.d.ts +111 -0
  3. {node v20.19 → node v24.10}/assert.d.ts +150 -97
  4. {node v20.19 → node v24.10}/async_hooks.d.ts +27 -9
  5. {node v20.19 → node v24.10}/buffer.buffer.d.ts +2 -1
  6. {node v20.19 → node v24.10}/buffer.d.ts +6 -8
  7. {node v20.19 → node v24.10}/child_process.d.ts +11 -10
  8. {node v20.19 → node v24.10}/cluster.d.ts +16 -15
  9. {node v20.19 → node v24.10}/console.d.ts +19 -18
  10. {node v20.19 → node v24.10}/crypto.d.ts +1120 -293
  11. {node v20.19 → node v24.10}/dgram.d.ts +5 -2
  12. {node v20.19 → node v24.10}/diagnostics_channel.d.ts +1 -3
  13. {node v20.19 → node v24.10}/dns/promises.d.ts +30 -6
  14. {node v20.19 → node v24.10}/dns.d.ts +69 -17
  15. {node v20.19 → node v24.10}/domain.d.ts +1 -1
  16. {node v20.19 → node v24.10}/events.d.ts +1 -2
  17. {node v20.19 → node v24.10}/fs/promises.d.ts +85 -38
  18. {node v20.19 → node v24.10}/fs.d.ts +387 -48
  19. {node v20.19 → node v24.10}/globals.d.ts +2 -4
  20. {node v20.19 → node v24.10}/globals.typedarray.d.ts +3 -0
  21. {node v20.19 → node v24.10}/http.d.ts +90 -5
  22. {node v20.19 → node v24.10}/http2.d.ts +166 -41
  23. {node v20.19 → node v24.10}/https.d.ts +4 -3
  24. {node v20.19 → node v24.10}/index.d.ts +13 -5
  25. node v24.10/inspector.d.ts +277 -0
  26. {node v20.19 → node v24.10}/inspector.generated.d.ts +1096 -829
  27. {node v20.19 → node v24.10}/module.d.ts +403 -48
  28. {node v20.19 → node v24.10}/net.d.ts +62 -20
  29. {node v20.19 → node v24.10}/os.d.ts +8 -7
  30. {node v20.19 → node v24.10}/package.json +18 -3
  31. {node v20.19 → node v24.10}/path.d.ts +3 -3
  32. {node v20.19 → node v24.10}/perf_hooks.d.ts +37 -16
  33. {node v20.19 → node v24.10}/process.d.ts +138 -16
  34. {node v20.19 → node v24.10}/punycode.d.ts +1 -1
  35. {node v20.19 → node v24.10}/querystring.d.ts +1 -1
  36. {node v20.19 → node v24.10}/readline/promises.d.ts +0 -1
  37. {node v20.19 → node v24.10}/readline.d.ts +19 -14
  38. {node v20.19 → node v24.10}/repl.d.ts +25 -17
  39. {node v20.19 → node v24.10}/sea.d.ts +11 -2
  40. node v24.10/sqlite.d.ts +937 -0
  41. {node v20.19 → node v24.10}/stream/web.d.ts +85 -45
  42. {node v20.19 → node v24.10}/stream.d.ts +36 -28
  43. {node v20.19 → node v24.10}/string_decoder.d.ts +1 -1
  44. {node v20.19 → node v24.10}/test.d.ts +587 -35
  45. {node v20.19 → node v24.10}/timers/promises.d.ts +1 -1
  46. {node v20.19 → node v24.10}/timers.d.ts +4 -5
  47. {node v20.19 → node v24.10}/tls.d.ts +62 -48
  48. {node v20.19 → node v24.10}/trace_events.d.ts +6 -6
  49. node v24.10/ts5.6/compatibility/float16array.d.ts +71 -0
  50. {node v20.19 → node v24.10}/ts5.6/globals.typedarray.d.ts +2 -0
  51. {node v20.19 → node v24.10}/ts5.6/index.d.ts +15 -5
  52. node v24.10/ts5.7/compatibility/float16array.d.ts +72 -0
  53. node v24.10/ts5.7/index.d.ts +103 -0
  54. {node v20.19 → node v24.10}/tty.d.ts +1 -1
  55. {node v20.19 → node v24.10}/url.d.ts +128 -35
  56. {node v20.19 → node v24.10}/util.d.ts +384 -390
  57. {node v20.19 → node v24.10}/v8.d.ts +175 -32
  58. {node v20.19 → node v24.10}/vm.d.ts +246 -67
  59. {node v20.19 → node v24.10}/wasi.d.ts +23 -2
  60. node v24.10/web-globals/crypto.d.ts +32 -0
  61. {node v20.19 → node v24.10}/web-globals/fetch.d.ts +4 -0
  62. node v24.10/web-globals/navigator.d.ts +25 -0
  63. node v24.10/web-globals/storage.d.ts +24 -0
  64. node v24.10/web-globals/streams.d.ts +22 -0
  65. {node v20.19 → node v24.10}/worker_threads.d.ts +205 -24
  66. {node v20.19 → node v24.10}/zlib.d.ts +185 -44
  67. node v20.19/assert/strict.d.ts +0 -8
  68. node v20.19/compatibility/disposable.d.ts +0 -16
  69. node v20.19/compatibility/index.d.ts +0 -9
  70. node v20.19/compatibility/indexable.d.ts +0 -20
  71. {node v20.19 → node v24.10}/LICENSE +0 -0
  72. {node v20.19 → node v24.10}/compatibility/iterators.d.ts +0 -0
  73. {node v20.19 → node v24.10}/constants.d.ts +0 -0
  74. {node v20.19 → node v24.10}/stream/consumers.d.ts +0 -0
  75. {node v20.19 → node v24.10}/stream/promises.d.ts +0 -0
  76. {node v20.19 → node v24.10}/ts5.6/buffer.buffer.d.ts +0 -0
  77. {node v20.19 → node v24.10}/web-globals/abortcontroller.d.ts +0 -0
  78. {node v20.19 → node v24.10}/web-globals/domexception.d.ts +0 -0
  79. {node v20.19 → node v24.10}/web-globals/events.d.ts +0 -0
@@ -23,11 +23,11 @@
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.13.1/lib/dgram.js)
26
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js)
27
27
  */
28
28
  declare module "dgram" {
29
29
  import { NonSharedBuffer } from "node:buffer";
30
- import { AddressInfo } from "node:net";
30
+ import { AddressInfo, BlockList } from "node:net";
31
31
  import * as dns from "node:dns";
32
32
  import { Abortable, EventEmitter } from "node:events";
33
33
  interface RemoteInfo {
@@ -46,6 +46,7 @@ declare module "dgram" {
46
46
  interface SocketOptions extends Abortable {
47
47
  type: SocketType;
48
48
  reuseAddr?: boolean | undefined;
49
+ reusePort?: boolean | undefined;
49
50
  /**
50
51
  * @default false
51
52
  */
@@ -59,6 +60,8 @@ declare module "dgram" {
59
60
  callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
60
61
  ) => void)
61
62
  | undefined;
63
+ receiveBlockList?: BlockList | undefined;
64
+ sendBlockList?: BlockList | undefined;
62
65
  }
63
66
  /**
64
67
  * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
@@ -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.13.1/lib/diagnostics_channel.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/diagnostics_channel.js)
24
24
  */
25
25
  declare module "diagnostics_channel" {
26
26
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -189,7 +189,6 @@ declare module "diagnostics_channel" {
189
189
  * });
190
190
  * ```
191
191
  * @since v15.1.0, v14.17.0
192
- * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
193
192
  * @param onMessage The handler to receive channel messages
194
193
  */
195
194
  subscribe(onMessage: ChannelListener): void;
@@ -210,7 +209,6 @@ declare module "diagnostics_channel" {
210
209
  * channel.unsubscribe(onMessage);
211
210
  * ```
212
211
  * @since v15.1.0, v14.17.0
213
- * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
214
212
  * @param onMessage The previous subscribed handler to remove
215
213
  * @return `true` if the handler was found, `false` otherwise.
216
214
  */
@@ -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 `import { promises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
4
+ * via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
5
5
  * @since v10.6.0
6
6
  */
7
7
  declare module "dns/promises" {
@@ -20,6 +20,7 @@ declare module "dns/promises" {
20
20
  ResolveWithTtlOptions,
21
21
  SoaRecord,
22
22
  SrvRecord,
23
+ TlsaRecord,
23
24
  } from "node:dns";
24
25
  /**
25
26
  * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
@@ -96,8 +97,8 @@ declare module "dns/promises" {
96
97
  * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
97
98
  *
98
99
  * ```js
99
- * import dns from 'node:dns';
100
- * dns.promises.lookupService('127.0.0.1', 22).then((result) => {
100
+ * import dnsPromises from 'node:dns';
101
+ * dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
101
102
  * console.log(result.hostname, result.service);
102
103
  * // Prints: localhost ssh
103
104
  * });
@@ -133,6 +134,7 @@ declare module "dns/promises" {
133
134
  function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
134
135
  function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
135
136
  function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
137
+ function resolve(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
136
138
  function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
137
139
  function resolve(hostname: string, rrtype: string): Promise<
138
140
  | string[]
@@ -141,6 +143,7 @@ declare module "dns/promises" {
141
143
  | NaptrRecord[]
142
144
  | SoaRecord
143
145
  | SrvRecord[]
146
+ | TlsaRecord[]
144
147
  | string[][]
145
148
  | AnyRecord[]
146
149
  >;
@@ -294,6 +297,27 @@ declare module "dns/promises" {
294
297
  * @since v10.6.0
295
298
  */
296
299
  function resolveSrv(hostname: string): Promise<SrvRecord[]>;
300
+ /**
301
+ * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
302
+ * the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions
303
+ * with these properties:
304
+ *
305
+ * * `certUsage`
306
+ * * `selector`
307
+ * * `match`
308
+ * * `data`
309
+ *
310
+ * ```js
311
+ * {
312
+ * certUsage: 3,
313
+ * selector: 1,
314
+ * match: 1,
315
+ * data: [ArrayBuffer]
316
+ * }
317
+ * ```
318
+ * @since v23.9.0, v22.15.0
319
+ */
320
+ function resolveTlsa(hostname: string): Promise<TlsaRecord[]>;
297
321
  /**
298
322
  * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
299
323
  * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
@@ -396,9 +420,8 @@ declare module "dns/promises" {
396
420
  * other resolvers:
397
421
  *
398
422
  * ```js
399
- * import dns from 'node:dns';
400
- * const { Resolver } = dns.promises;
401
- * const resolver = new Resolver();
423
+ * import { promises } from 'node:dns';
424
+ * const resolver = new promises.Resolver();
402
425
  * resolver.setServers(['4.4.4.4']);
403
426
  *
404
427
  * // This request will use the server at 4.4.4.4, independent of global settings.
@@ -453,6 +476,7 @@ declare module "dns/promises" {
453
476
  resolvePtr: typeof resolvePtr;
454
477
  resolveSoa: typeof resolveSoa;
455
478
  resolveSrv: typeof resolveSrv;
479
+ resolveTlsa: typeof resolveTlsa;
456
480
  resolveTxt: typeof resolveTxt;
457
481
  reverse: typeof reverse;
458
482
  /**
@@ -41,8 +41,8 @@
41
41
  * });
42
42
  * ```
43
43
  *
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.13.1/lib/dns.js)
44
+ * See the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations) for more information.
45
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dns.js)
46
46
  */
47
47
  declare module "dns" {
48
48
  import * as dnsPromises from "node:dns/promises";
@@ -71,7 +71,7 @@ declare module "dns" {
71
71
  */
72
72
  family?: number | "IPv4" | "IPv6" | undefined;
73
73
  /**
74
- * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v20.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
74
+ * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v24.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
75
75
  * passed by bitwise `OR`ing their values.
76
76
  */
77
77
  hints?: number | undefined;
@@ -84,16 +84,17 @@ declare module "dns" {
84
84
  * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
85
85
  * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
86
86
  * addresses before IPv4 addresses. Default value is configurable using
87
- * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
87
+ * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder).
88
88
  * @default `verbatim` (addresses are not reordered)
89
+ * @since v22.1.0
89
90
  */
90
91
  order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
91
92
  /**
92
93
  * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
93
94
  * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
94
95
  * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
95
- * or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
96
96
  * @default true (addresses are not reordered)
97
+ * @deprecated Please use `order` option
97
98
  */
98
99
  verbatim?: boolean | undefined;
99
100
  }
@@ -132,7 +133,7 @@ declare module "dns" {
132
133
  * The implementation uses an operating system facility that can associate names
133
134
  * with addresses and vice versa. This implementation can have subtle but
134
135
  * important consequences on the behavior of any Node.js program. Please take some
135
- * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations)
136
+ * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations)
136
137
  * before using `dns.lookup()`.
137
138
  *
138
139
  * Example usage:
@@ -154,7 +155,7 @@ declare module "dns" {
154
155
  * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
155
156
  * ```
156
157
  *
157
- * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
158
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed
158
159
  * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
159
160
  * @since v0.1.90
160
161
  */
@@ -194,7 +195,7 @@ declare module "dns" {
194
195
  * If `address` is not a valid IP address, a `TypeError` will be thrown.
195
196
  * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
196
197
  *
197
- * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
198
+ * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object,
198
199
  * where `err.code` is the error code.
199
200
  *
200
201
  * ```js
@@ -205,7 +206,7 @@ declare module "dns" {
205
206
  * });
206
207
  * ```
207
208
  *
208
- * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
209
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed
209
210
  * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
210
211
  * @since v0.11.14
211
212
  */
@@ -291,6 +292,15 @@ declare module "dns" {
291
292
  export interface AnySrvRecord extends SrvRecord {
292
293
  type: "SRV";
293
294
  }
295
+ export interface TlsaRecord {
296
+ certUsage: number;
297
+ selector: number;
298
+ match: number;
299
+ data: ArrayBuffer;
300
+ }
301
+ export interface AnyTlsaRecord extends TlsaRecord {
302
+ type: "TLSA";
303
+ }
294
304
  export interface AnyTxtRecord {
295
305
  type: "TXT";
296
306
  entries: string[];
@@ -318,6 +328,7 @@ declare module "dns" {
318
328
  | AnyPtrRecord
319
329
  | AnySoaRecord
320
330
  | AnySrvRecord
331
+ | AnyTlsaRecord
321
332
  | AnyTxtRecord;
322
333
  /**
323
334
  * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
@@ -326,7 +337,7 @@ declare module "dns" {
326
337
  *
327
338
  * <omitted>
328
339
  *
329
- * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
340
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object,
330
341
  * where `err.code` is one of the `DNS error codes`.
331
342
  * @since v0.1.27
332
343
  * @param hostname Host name to resolve.
@@ -371,6 +382,11 @@ declare module "dns" {
371
382
  rrtype: "SRV",
372
383
  callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
373
384
  ): void;
385
+ export function resolve(
386
+ hostname: string,
387
+ rrtype: "TLSA",
388
+ callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
389
+ ): void;
374
390
  export function resolve(
375
391
  hostname: string,
376
392
  rrtype: "TXT",
@@ -388,6 +404,7 @@ declare module "dns" {
388
404
  | NaptrRecord[]
389
405
  | SoaRecord
390
406
  | SrvRecord[]
407
+ | TlsaRecord[]
391
408
  | string[][]
392
409
  | AnyRecord[],
393
410
  ) => void,
@@ -400,6 +417,7 @@ declare module "dns" {
400
417
  function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
401
418
  function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
402
419
  function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
420
+ function __promisify__(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
403
421
  function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
404
422
  function __promisify__(
405
423
  hostname: string,
@@ -411,6 +429,7 @@ declare module "dns" {
411
429
  | NaptrRecord[]
412
430
  | SoaRecord
413
431
  | SrvRecord[]
432
+ | TlsaRecord[]
414
433
  | string[][]
415
434
  | AnyRecord[]
416
435
  >;
@@ -615,6 +634,33 @@ declare module "dns" {
615
634
  export namespace resolveSrv {
616
635
  function __promisify__(hostname: string): Promise<SrvRecord[]>;
617
636
  }
637
+ /**
638
+ * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
639
+ * the `hostname`. The `records` argument passed to the `callback` function is an
640
+ * array of objects with these properties:
641
+ *
642
+ * * `certUsage`
643
+ * * `selector`
644
+ * * `match`
645
+ * * `data`
646
+ *
647
+ * ```js
648
+ * {
649
+ * certUsage: 3,
650
+ * selector: 1,
651
+ * match: 1,
652
+ * data: [ArrayBuffer]
653
+ * }
654
+ * ```
655
+ * @since v23.9.0, v22.15.0
656
+ */
657
+ export function resolveTlsa(
658
+ hostname: string,
659
+ callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
660
+ ): void;
661
+ export namespace resolveTlsa {
662
+ function __promisify__(hostname: string): Promise<TlsaRecord[]>;
663
+ }
618
664
  /**
619
665
  * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
620
666
  * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
@@ -670,8 +716,8 @@ declare module "dns" {
670
716
  * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
671
717
  * array of host names.
672
718
  *
673
- * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is
674
- * one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
719
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object, where `err.code` is
720
+ * one of the [DNS error codes](https://nodejs.org/docs/latest-v24.x/api/dns.html#error-codes).
675
721
  * @since v0.1.16
676
722
  */
677
723
  export function reverse(
@@ -679,7 +725,7 @@ declare module "dns" {
679
725
  callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
680
726
  ): void;
681
727
  /**
682
- * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
728
+ * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options).
683
729
  * The value could be:
684
730
  *
685
731
  * * `ipv4first`: for `order` defaulting to `ipv4first`.
@@ -734,7 +780,7 @@ declare module "dns" {
734
780
  */
735
781
  export function getServers(): string[];
736
782
  /**
737
- * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
783
+ * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options).
738
784
  * The value could be:
739
785
  *
740
786
  * * `ipv4first`: sets default `order` to `ipv4first`.
@@ -742,8 +788,8 @@ declare module "dns" {
742
788
  * * `verbatim`: sets default `order` to `verbatim`.
743
789
  *
744
790
  * The default is `verbatim` and {@link setDefaultResultOrder} have higher
745
- * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). When using
746
- * [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
791
+ * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder). When using
792
+ * [worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
747
793
  * thread won't affect the default dns orders in workers.
748
794
  * @since v16.4.0, v14.18.0
749
795
  * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
@@ -784,12 +830,17 @@ declare module "dns" {
784
830
  * @default 4
785
831
  */
786
832
  tries?: number | undefined;
833
+ /**
834
+ * The max retry timeout, in milliseconds.
835
+ * @default 0
836
+ */
837
+ maxTimeout?: number | undefined;
787
838
  }
788
839
  /**
789
840
  * An independent resolver for DNS requests.
790
841
  *
791
842
  * Creating a new resolver uses the default server settings. Setting
792
- * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnssetserversservers) does not affect
843
+ * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnssetserversservers) does not affect
793
844
  * other resolvers:
794
845
  *
795
846
  * ```js
@@ -844,6 +895,7 @@ declare module "dns" {
844
895
  resolvePtr: typeof resolvePtr;
845
896
  resolveSoa: typeof resolveSoa;
846
897
  resolveSrv: typeof resolveSrv;
898
+ resolveTlsa: typeof resolveTlsa;
847
899
  resolveTxt: typeof resolveTxt;
848
900
  reverse: typeof reverse;
849
901
  /**
@@ -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/v20.13.1/lib/domain.js)
15
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/domain.js)
16
16
  */
17
17
  declare module "domain" {
18
18
  import EventEmitter = require("node:events");
@@ -32,7 +32,7 @@
32
32
  * });
33
33
  * myEmitter.emit('event');
34
34
  * ```
35
- * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/events.js)
35
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/events.js)
36
36
  */
37
37
  declare module "events" {
38
38
  import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
@@ -398,7 +398,6 @@ declare module "events" {
398
398
  * }
399
399
  * ```
400
400
  * @since v20.5.0
401
- * @experimental
402
401
  * @return Disposable that removes the `abort` listener.
403
402
  */
404
403
  static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
@@ -21,6 +21,11 @@ declare module "fs/promises" {
21
21
  CopyOptions,
22
22
  Dir,
23
23
  Dirent,
24
+ DisposableTempDir,
25
+ EncodingOption,
26
+ GlobOptions,
27
+ GlobOptionsWithFileTypes,
28
+ GlobOptionsWithoutFileTypes,
24
29
  MakeDirectoryOptions,
25
30
  Mode,
26
31
  ObjectEncodingOptions,
@@ -29,6 +34,7 @@ declare module "fs/promises" {
29
34
  PathLike,
30
35
  ReadOptions,
31
36
  ReadOptionsWithBuffer,
37
+ ReadPosition,
32
38
  ReadStream,
33
39
  ReadVResult,
34
40
  RmDirOptions,
@@ -39,7 +45,7 @@ declare module "fs/promises" {
39
45
  StatsFs,
40
46
  TimeLike,
41
47
  WatchEventType,
42
- WatchOptions,
48
+ WatchOptions as _WatchOptions,
43
49
  WriteStream,
44
50
  WriteVResult,
45
51
  } from "node:fs";
@@ -70,7 +76,7 @@ declare module "fs/promises" {
70
76
  * @default `buffer.byteLength`
71
77
  */
72
78
  length?: number | null;
73
- position?: number | null;
79
+ position?: ReadPosition | null;
74
80
  }
75
81
  interface CreateReadStreamOptions extends Abortable {
76
82
  encoding?: BufferEncoding | null | undefined;
@@ -89,11 +95,7 @@ declare module "fs/promises" {
89
95
  flush?: boolean | undefined;
90
96
  }
91
97
  interface ReadableWebStreamOptions {
92
- /**
93
- * Whether to open a normal or a `'bytes'` stream.
94
- * @since v20.0.0
95
- */
96
- type?: "bytes" | undefined;
98
+ autoClose?: boolean | undefined;
97
99
  }
98
100
  // TODO: Add `EventEmitter` close
99
101
  interface FileHandle {
@@ -237,7 +239,7 @@ declare module "fs/promises" {
237
239
  buffer: T,
238
240
  offset?: number | null,
239
241
  length?: number | null,
240
- position?: number | null,
242
+ position?: ReadPosition | null,
241
243
  ): Promise<FileReadResult<T>>;
242
244
  read<T extends NodeJS.ArrayBufferView>(
243
245
  buffer: T,
@@ -247,7 +249,8 @@ declare module "fs/promises" {
247
249
  options?: ReadOptionsWithBuffer<T>,
248
250
  ): Promise<FileReadResult<T>>;
249
251
  /**
250
- * Returns a `ReadableStream` that may be used to read the files data.
252
+ * Returns a byte-oriented `ReadableStream` that may be used to read the file's
253
+ * contents.
251
254
  *
252
255
  * An error will be thrown if this method is called more than once or is called
253
256
  * after the `FileHandle` is closed or closing.
@@ -268,7 +271,6 @@ declare module "fs/promises" {
268
271
  * While the `ReadableStream` will read the file to completion, it will not
269
272
  * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
270
273
  * @since v17.0.0
271
- * @experimental
272
274
  */
273
275
  readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
274
276
  /**
@@ -426,6 +428,13 @@ declare module "fs/promises" {
426
428
  bytesWritten: number;
427
429
  buffer: TBuffer;
428
430
  }>;
431
+ write<TBuffer extends Uint8Array>(
432
+ buffer: TBuffer,
433
+ options?: { offset?: number; length?: number; position?: number },
434
+ ): Promise<{
435
+ bytesWritten: number;
436
+ buffer: TBuffer;
437
+ }>;
429
438
  write(
430
439
  data: string,
431
440
  position?: number | null,
@@ -482,8 +491,9 @@ declare module "fs/promises" {
482
491
  */
483
492
  close(): Promise<void>;
484
493
  /**
485
- * An alias for {@link FileHandle.close()}.
486
- * @since v20.4.0
494
+ * Calls `filehandle.close()` and returns a promise that fulfills when the
495
+ * filehandle is closed.
496
+ * @since v20.4.0, v18.8.0
487
497
  */
488
498
  [Symbol.asyncDispose](): Promise<void>;
489
499
  }
@@ -951,7 +961,7 @@ declare module "fs/promises" {
951
961
  * The `fsPromises.mkdtemp()` method will append the six randomly selected
952
962
  * 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
953
963
  * platform-specific path separator
954
- * (`import { sep } from 'node:node:path'`).
964
+ * (`import { sep } from 'node:path'`).
955
965
  * @since v10.0.0
956
966
  * @return Fulfills with a string containing the file system path of the newly created temporary directory.
957
967
  */
@@ -971,6 +981,26 @@ declare module "fs/promises" {
971
981
  prefix: string,
972
982
  options?: ObjectEncodingOptions | BufferEncoding | null,
973
983
  ): Promise<string | NonSharedBuffer>;
984
+ /**
985
+ * The resulting Promise holds an async-disposable object whose `path` property
986
+ * holds the created directory path. When the object is disposed, the directory
987
+ * and its contents will be removed asynchronously if it still exists. If the
988
+ * directory cannot be deleted, disposal will throw an error. The object has an
989
+ * async `remove()` method which will perform the same task.
990
+ *
991
+ * Both this function and the disposal function on the resulting object are
992
+ * async, so it should be used with `await` + `await using` as in
993
+ * `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
994
+ *
995
+ * <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
996
+ *
997
+ * For detailed information, see the documentation of `fsPromises.mkdtemp()`.
998
+ *
999
+ * The optional `options` argument can be a string specifying an encoding, or an
1000
+ * object with an `encoding` property specifying the character encoding to use.
1001
+ * @since v24.4.0
1002
+ */
1003
+ function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
974
1004
  /**
975
1005
  * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
976
1006
  * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
@@ -1192,6 +1222,16 @@ declare module "fs/promises" {
1192
1222
  * @return Fulfills with an {fs.Dir}.
1193
1223
  */
1194
1224
  function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
1225
+ interface WatchOptions extends _WatchOptions {
1226
+ maxQueue?: number | undefined;
1227
+ overflow?: "ignore" | "throw" | undefined;
1228
+ }
1229
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
1230
+ encoding: "buffer";
1231
+ }
1232
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
1233
+ encoding?: BufferEncoding | undefined;
1234
+ }
1195
1235
  /**
1196
1236
  * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
1197
1237
  *
@@ -1224,33 +1264,16 @@ declare module "fs/promises" {
1224
1264
  */
1225
1265
  function watch(
1226
1266
  filename: PathLike,
1227
- options:
1228
- | (WatchOptions & {
1229
- encoding: "buffer";
1230
- })
1231
- | "buffer",
1232
- ): AsyncIterable<FileChangeInfo<NonSharedBuffer>>;
1233
- /**
1234
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1235
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1236
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1237
- * If `encoding` is not supplied, the default of `'utf8'` is used.
1238
- * If `persistent` is not supplied, the default of `true` is used.
1239
- * If `recursive` is not supplied, the default of `false` is used.
1240
- */
1241
- function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
1242
- /**
1243
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1244
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1245
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1246
- * If `encoding` is not supplied, the default of `'utf8'` is used.
1247
- * If `persistent` is not supplied, the default of `true` is used.
1248
- * If `recursive` is not supplied, the default of `false` is used.
1249
- */
1267
+ options?: WatchOptionsWithStringEncoding | BufferEncoding,
1268
+ ): NodeJS.AsyncIterator<FileChangeInfo<string>>;
1269
+ function watch(
1270
+ filename: PathLike,
1271
+ options: WatchOptionsWithBufferEncoding | "buffer",
1272
+ ): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
1250
1273
  function watch(
1251
1274
  filename: PathLike,
1252
- options: WatchOptions | string,
1253
- ): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<NonSharedBuffer>>;
1275
+ options: WatchOptions | BufferEncoding | "buffer",
1276
+ ): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
1254
1277
  /**
1255
1278
  * Asynchronously copies the entire directory structure from `src` to `dest`,
1256
1279
  * including subdirectories and files.
@@ -1264,6 +1287,30 @@ declare module "fs/promises" {
1264
1287
  * @return Fulfills with `undefined` upon success.
1265
1288
  */
1266
1289
  function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
1290
+ /**
1291
+ * ```js
1292
+ * import { glob } from 'node:fs/promises';
1293
+ *
1294
+ * for await (const entry of glob('*.js'))
1295
+ * console.log(entry);
1296
+ * ```
1297
+ * @since v22.0.0
1298
+ * @returns An AsyncIterator that yields the paths of files
1299
+ * that match the pattern.
1300
+ */
1301
+ function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
1302
+ function glob(
1303
+ pattern: string | readonly string[],
1304
+ options: GlobOptionsWithFileTypes,
1305
+ ): NodeJS.AsyncIterator<Dirent>;
1306
+ function glob(
1307
+ pattern: string | readonly string[],
1308
+ options: GlobOptionsWithoutFileTypes,
1309
+ ): NodeJS.AsyncIterator<string>;
1310
+ function glob(
1311
+ pattern: string | readonly string[],
1312
+ options: GlobOptions,
1313
+ ): NodeJS.AsyncIterator<Dirent | string>;
1267
1314
  }
1268
1315
  declare module "node:fs/promises" {
1269
1316
  export * from "fs/promises";