@types/node 18.11.5 → 20.2.5

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 (97) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +86 -75
  3. node/async_hooks.d.ts +66 -37
  4. node/buffer.d.ts +193 -100
  5. node/child_process.d.ts +82 -56
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +233 -235
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +59 -21
  11. node/dns/promises.d.ts +50 -6
  12. node/dns.d.ts +26 -17
  13. node/domain.d.ts +4 -4
  14. node/events.d.ts +111 -65
  15. node/fs/promises.d.ts +99 -47
  16. node/fs.d.ts +244 -73
  17. node/globals.d.ts +6 -3
  18. node/http.d.ts +265 -148
  19. node/http2.d.ts +42 -47
  20. node/https.d.ts +53 -153
  21. node/index.d.ts +2 -1
  22. node/inspector.d.ts +10 -3
  23. node/module.d.ts +6 -4
  24. node/net.d.ts +32 -15
  25. node/os.d.ts +27 -16
  26. node/package.json +9 -4
  27. node/path.d.ts +4 -4
  28. node/perf_hooks.d.ts +28 -15
  29. node/process.d.ts +49 -46
  30. node/punycode.d.ts +1 -1
  31. node/querystring.d.ts +5 -5
  32. node/readline/promises.d.ts +65 -63
  33. node/readline.d.ts +32 -159
  34. node/repl.d.ts +20 -20
  35. node/stream/consumers.d.ts +1 -1
  36. node/stream.d.ts +950 -869
  37. node/string_decoder.d.ts +6 -6
  38. node/test.d.ts +877 -139
  39. node/timers/promises.d.ts +26 -1
  40. node/timers.d.ts +125 -4
  41. node/tls.d.ts +120 -29
  42. node/trace_events.d.ts +20 -9
  43. node/ts4.8/assert.d.ts +86 -75
  44. node/ts4.8/async_hooks.d.ts +66 -37
  45. node/ts4.8/buffer.d.ts +193 -101
  46. node/ts4.8/child_process.d.ts +82 -56
  47. node/ts4.8/cluster.d.ts +12 -12
  48. node/ts4.8/console.d.ts +5 -5
  49. node/ts4.8/crypto.d.ts +230 -233
  50. node/ts4.8/dgram.d.ts +15 -15
  51. node/ts4.8/diagnostics_channel.d.ts +59 -21
  52. node/ts4.8/dns/promises.d.ts +50 -6
  53. node/ts4.8/dns.d.ts +26 -17
  54. node/ts4.8/domain.d.ts +4 -4
  55. node/ts4.8/events.d.ts +111 -65
  56. node/ts4.8/fs/promises.d.ts +97 -46
  57. node/ts4.8/fs.d.ts +244 -73
  58. node/ts4.8/globals.d.ts +21 -12
  59. node/ts4.8/http.d.ts +265 -148
  60. node/ts4.8/http2.d.ts +42 -47
  61. node/ts4.8/https.d.ts +53 -153
  62. node/ts4.8/inspector.d.ts +10 -3
  63. node/ts4.8/module.d.ts +6 -4
  64. node/ts4.8/net.d.ts +33 -16
  65. node/ts4.8/os.d.ts +27 -16
  66. node/ts4.8/path.d.ts +4 -4
  67. node/ts4.8/perf_hooks.d.ts +28 -15
  68. node/ts4.8/process.d.ts +49 -46
  69. node/ts4.8/punycode.d.ts +1 -1
  70. node/ts4.8/querystring.d.ts +5 -5
  71. node/ts4.8/readline/promises.d.ts +65 -63
  72. node/ts4.8/readline.d.ts +32 -159
  73. node/ts4.8/repl.d.ts +20 -20
  74. node/ts4.8/stream/consumers.d.ts +1 -1
  75. node/ts4.8/stream.d.ts +192 -140
  76. node/ts4.8/string_decoder.d.ts +6 -6
  77. node/ts4.8/test.d.ts +877 -139
  78. node/ts4.8/timers/promises.d.ts +26 -1
  79. node/ts4.8/timers.d.ts +125 -4
  80. node/ts4.8/tls.d.ts +120 -29
  81. node/ts4.8/trace_events.d.ts +20 -9
  82. node/ts4.8/tty.d.ts +4 -5
  83. node/ts4.8/url.d.ts +46 -42
  84. node/ts4.8/util.d.ts +325 -123
  85. node/ts4.8/v8.d.ts +253 -14
  86. node/ts4.8/vm.d.ts +417 -32
  87. node/ts4.8/wasi.d.ts +13 -19
  88. node/ts4.8/worker_threads.d.ts +38 -34
  89. node/ts4.8/zlib.d.ts +11 -11
  90. node/tty.d.ts +4 -5
  91. node/url.d.ts +46 -42
  92. node/util.d.ts +325 -123
  93. node/v8.d.ts +253 -14
  94. node/vm.d.ts +417 -32
  95. node/wasi.d.ts +13 -19
  96. node/worker_threads.d.ts +38 -34
  97. node/zlib.d.ts +11 -11
@@ -14,6 +14,7 @@ declare module 'fs/promises' {
14
14
  import { ReadableStream } from 'node:stream/web';
15
15
  import {
16
16
  BigIntStats,
17
+ BigIntStatsFs,
17
18
  BufferEncodingOption,
18
19
  constants as fsConstants,
19
20
  CopyOptions,
@@ -30,7 +31,9 @@ declare module 'fs/promises' {
30
31
  RmDirOptions,
31
32
  RmOptions,
32
33
  StatOptions,
34
+ StatFsOptions,
33
35
  Stats,
36
+ StatsFs,
34
37
  TimeLike,
35
38
  WatchEventType,
36
39
  WatchOptions,
@@ -38,10 +41,9 @@ declare module 'fs/promises' {
38
41
  WriteVResult,
39
42
  } from 'node:fs';
40
43
  import { Interface as ReadlineInterface } from 'node:readline';
41
-
42
44
  interface FileChangeInfo<T extends string | Buffer> {
43
45
  eventType: WatchEventType;
44
- filename: T;
46
+ filename: T | null;
45
47
  }
46
48
  interface FlagAndOpenMode {
47
49
  mode?: Mode | undefined;
@@ -112,8 +114,8 @@ declare module 'fs/promises' {
112
114
  */
113
115
  chmod(mode: Mode): Promise<void>;
114
116
  /**
115
- * Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
116
- * returned by this method has a default `highWaterMark` of 64 kb.
117
+ * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream
118
+ * returned by this method has a default `highWaterMark` of 64 KiB.
117
119
  *
118
120
  * `options` can include `start` and `end` values to read a range of bytes from
119
121
  * the file instead of the entire file. Both `start` and `end` are inclusive and
@@ -131,7 +133,7 @@ declare module 'fs/promises' {
131
133
  * destroyed. Set the `emitClose` option to `false` to change this behavior.
132
134
  *
133
135
  * ```js
134
- * import { open } from 'fs/promises';
136
+ * import { open } from 'node:fs/promises';
135
137
  *
136
138
  * const fd = await open('/dev/input/event0');
137
139
  * // Create a stream from some character device.
@@ -157,7 +159,7 @@ declare module 'fs/promises' {
157
159
  * An example to read the last 10 bytes of a file which is 100 bytes long:
158
160
  *
159
161
  * ```js
160
- * import { open } from 'fs/promises';
162
+ * import { open } from 'node:fs/promises';
161
163
  *
162
164
  * const fd = await open('sample.txt');
163
165
  * fd.createReadStream({ start: 90, end: 99 });
@@ -196,7 +198,7 @@ declare module 'fs/promises' {
196
198
  * device. The specific implementation is operating system and device specific.
197
199
  * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail.
198
200
  * @since v10.0.0
199
- * @return Fufills with `undefined` upon success.
201
+ * @return Fulfills with `undefined` upon success.
200
202
  */
201
203
  sync(): Promise<void>;
202
204
  /**
@@ -217,11 +219,13 @@ declare module 'fs/promises' {
217
219
  /**
218
220
  * Returns a `ReadableStream` that may be used to read the files data.
219
221
  *
220
- * An error will be thrown if this method is called more than once or is called after the `FileHandle` is closed
221
- * or closing.
222
+ * An error will be thrown if this method is called more than once or is called
223
+ * after the `FileHandle` is closed or closing.
222
224
  *
223
225
  * ```js
224
- * import { open } from 'node:fs/promises';
226
+ * import {
227
+ * open,
228
+ * } from 'node:fs/promises';
225
229
  *
226
230
  * const file = await open('./some/file/to/read');
227
231
  *
@@ -231,8 +235,8 @@ declare module 'fs/promises' {
231
235
  * await file.close();
232
236
  * ```
233
237
  *
234
- * While the `ReadableStream` will read the file to completion, it will not close the `FileHandle` automatically. User code must still call the `fileHandle.close()` method.
235
- *
238
+ * While the `ReadableStream` will read the file to completion, it will not
239
+ * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
236
240
  * @since v17.0.0
237
241
  * @experimental
238
242
  */
@@ -286,7 +290,8 @@ declare module 'fs/promises' {
286
290
  | null
287
291
  ): Promise<string | Buffer>;
288
292
  /**
289
- * Convenience method to create a `readline` interface and stream over the file. For example:
293
+ * Convenience method to create a `readline` interface and stream over the file.
294
+ * See `filehandle.createReadStream()` for the options.
290
295
  *
291
296
  * ```js
292
297
  * import { open } from 'node:fs/promises';
@@ -297,9 +302,7 @@ declare module 'fs/promises' {
297
302
  * console.log(line);
298
303
  * }
299
304
  * ```
300
- *
301
305
  * @since v18.11.0
302
- * @param options See `filehandle.createReadStream()` for the options.
303
306
  */
304
307
  readLines(options?: CreateReadStreamOptions): ReadlineInterface;
305
308
  /**
@@ -326,7 +329,7 @@ declare module 'fs/promises' {
326
329
  * The following example retains only the first four bytes of the file:
327
330
  *
328
331
  * ```js
329
- * import { open } from 'fs/promises';
332
+ * import { open } from 'node:fs/promises';
330
333
  *
331
334
  * let filehandle = null;
332
335
  * try {
@@ -353,7 +356,7 @@ declare module 'fs/promises' {
353
356
  utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
354
357
  /**
355
358
  * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
356
- * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
359
+ * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
357
360
  * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
358
361
  * The promise is resolved with no arguments upon success.
359
362
  *
@@ -383,10 +386,10 @@ declare module 'fs/promises' {
383
386
  * The kernel ignores the position argument and always appends the data to
384
387
  * the end of the file.
385
388
  * @since v10.0.0
386
- * @param [offset=0] The start position from within `buffer` where the data to write begins.
389
+ * @param offset The start position from within `buffer` where the data to write begins.
387
390
  * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write.
388
- * @param position The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position.
389
- * See the POSIX pwrite(2) documentation for more detail.
391
+ * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
392
+ * position. See the POSIX pwrite(2) documentation for more detail.
390
393
  */
391
394
  write<TBuffer extends Uint8Array>(
392
395
  buffer: TBuffer,
@@ -417,14 +420,14 @@ declare module 'fs/promises' {
417
420
  * The kernel ignores the position argument and always appends the data to
418
421
  * the end of the file.
419
422
  * @since v12.9.0
420
- * @param position The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
423
+ * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
421
424
  * position.
422
425
  */
423
426
  writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
424
427
  /**
425
428
  * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
426
429
  * @since v13.13.0, v12.17.0
427
- * @param position The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
430
+ * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
428
431
  * @return Fulfills upon success an object containing two properties:
429
432
  */
430
433
  readv(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
@@ -433,7 +436,7 @@ declare module 'fs/promises' {
433
436
  * complete.
434
437
  *
435
438
  * ```js
436
- * import { open } from 'fs/promises';
439
+ * import { open } from 'node:fs/promises';
437
440
  *
438
441
  * let filehandle;
439
442
  * try {
@@ -447,9 +450,7 @@ declare module 'fs/promises' {
447
450
  */
448
451
  close(): Promise<void>;
449
452
  }
450
-
451
453
  const constants: typeof fsConstants;
452
-
453
454
  /**
454
455
  * Tests a user's permissions for the file or directory specified by `path`.
455
456
  * The `mode` argument is an optional integer that specifies the accessibility
@@ -463,8 +464,7 @@ declare module 'fs/promises' {
463
464
  * written by the current process.
464
465
  *
465
466
  * ```js
466
- * import { access } from 'fs/promises';
467
- * import { constants } from 'fs';
467
+ * import { access, constants } from 'node:fs/promises';
468
468
  *
469
469
  * try {
470
470
  * await access('/etc/passwd', constants.R_OK | constants.W_OK);
@@ -493,14 +493,13 @@ declare module 'fs/promises' {
493
493
  * will be made to remove the destination.
494
494
  *
495
495
  * ```js
496
- * import { constants } from 'fs';
497
- * import { copyFile } from 'fs/promises';
496
+ * import { copyFile, constants } from 'node:fs/promises';
498
497
  *
499
498
  * try {
500
499
  * await copyFile('source.txt', 'destination.txt');
501
500
  * console.log('source.txt was copied to destination.txt');
502
501
  * } catch {
503
- * console.log('The file could not be copied');
502
+ * console.error('The file could not be copied');
504
503
  * }
505
504
  *
506
505
  * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
@@ -508,7 +507,7 @@ declare module 'fs/promises' {
508
507
  * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL);
509
508
  * console.log('source.txt was copied to destination.txt');
510
509
  * } catch {
511
- * console.log('The file could not be copied');
510
+ * console.error('The file could not be copied');
512
511
  * }
513
512
  * ```
514
513
  * @since v10.0.0
@@ -570,6 +569,19 @@ declare module 'fs/promises' {
570
569
  * 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
571
570
  * that exists results in a
572
571
  * rejection only when `recursive` is false.
572
+ *
573
+ * ```js
574
+ * import { mkdir } from 'node:fs/promises';
575
+ *
576
+ * try {
577
+ * const projectFolder = new URL('./test/project/', import.meta.url);
578
+ * const createDir = await mkdir(projectFolder, { recursive: true });
579
+ *
580
+ * console.log(`created ${createDir}`);
581
+ * } catch (err) {
582
+ * console.error(err.message);
583
+ * }
584
+ * ```
573
585
  * @since v10.0.0
574
586
  * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`.
575
587
  */
@@ -612,7 +624,7 @@ declare module 'fs/promises' {
612
624
  * If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
613
625
  *
614
626
  * ```js
615
- * import { readdir } from 'fs/promises';
627
+ * import { readdir } from 'node:fs/promises';
616
628
  *
617
629
  * try {
618
630
  * const files = await readdir(path);
@@ -630,6 +642,7 @@ declare module 'fs/promises' {
630
642
  options?:
631
643
  | (ObjectEncodingOptions & {
632
644
  withFileTypes?: false | undefined;
645
+ recursive?: boolean | undefined;
633
646
  })
634
647
  | BufferEncoding
635
648
  | null
@@ -645,6 +658,7 @@ declare module 'fs/promises' {
645
658
  | {
646
659
  encoding: 'buffer';
647
660
  withFileTypes?: false | undefined;
661
+ recursive?: boolean | undefined;
648
662
  }
649
663
  | 'buffer'
650
664
  ): Promise<Buffer[]>;
@@ -658,6 +672,7 @@ declare module 'fs/promises' {
658
672
  options?:
659
673
  | (ObjectEncodingOptions & {
660
674
  withFileTypes?: false | undefined;
675
+ recursive?: boolean | undefined;
661
676
  })
662
677
  | BufferEncoding
663
678
  | null
@@ -671,6 +686,7 @@ declare module 'fs/promises' {
671
686
  path: PathLike,
672
687
  options: ObjectEncodingOptions & {
673
688
  withFileTypes: true;
689
+ recursive?: boolean | undefined;
674
690
  }
675
691
  ): Promise<Dirent[]>;
676
692
  /**
@@ -700,11 +716,13 @@ declare module 'fs/promises' {
700
716
  /**
701
717
  * Creates a symbolic link.
702
718
  *
703
- * The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. Windows junction points require the destination path
704
- * to be absolute. When using `'junction'`, the `target` argument will
719
+ * 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
720
+ * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
721
+ * exist, `'file'` will be used. Windows junction points require the destination
722
+ * path to be absolute. When using `'junction'`, the `target` argument will
705
723
  * automatically be normalized to absolute path.
706
724
  * @since v10.0.0
707
- * @param [type='file']
725
+ * @param [type='null']
708
726
  * @return Fulfills with `undefined` upon success.
709
727
  */
710
728
  function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
@@ -745,6 +763,23 @@ declare module 'fs/promises' {
745
763
  }
746
764
  ): Promise<BigIntStats>;
747
765
  function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
766
+ /**
767
+ * @since v19.6.0, v18.15.0
768
+ * @return Fulfills with the {fs.StatFs} object for the given `path`.
769
+ */
770
+ function statfs(
771
+ path: PathLike,
772
+ opts?: StatFsOptions & {
773
+ bigint?: false | undefined;
774
+ }
775
+ ): Promise<StatsFs>;
776
+ function statfs(
777
+ path: PathLike,
778
+ opts: StatFsOptions & {
779
+ bigint: true;
780
+ }
781
+ ): Promise<BigIntStatsFs>;
782
+ function statfs(path: PathLike, opts?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
748
783
  /**
749
784
  * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
750
785
  * @since v10.0.0
@@ -800,7 +835,7 @@ declare module 'fs/promises' {
800
835
  *
801
836
  * * Values can be either numbers representing Unix epoch time, `Date`s, or a
802
837
  * numeric string like `'123456789.0'`.
803
- * * If the value can not be converted to a number, or is `NaN`, `Infinity` or`-Infinity`, an `Error` will be thrown.
838
+ * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
804
839
  * @since v10.0.0
805
840
  * @return Fulfills with `undefined` upon success.
806
841
  */
@@ -845,10 +880,12 @@ declare module 'fs/promises' {
845
880
  * object with an `encoding` property specifying the character encoding to use.
846
881
  *
847
882
  * ```js
848
- * import { mkdtemp } from 'fs/promises';
883
+ * import { mkdtemp } from 'node:fs/promises';
884
+ * import { join } from 'node:path';
885
+ * import { tmpdir } from 'node:os';
849
886
  *
850
887
  * try {
851
- * await mkdtemp(path.join(os.tmpdir(), 'foo-'));
888
+ * await mkdtemp(join(tmpdir(), 'foo-'));
852
889
  * } catch (err) {
853
890
  * console.error(err);
854
891
  * }
@@ -857,9 +894,9 @@ declare module 'fs/promises' {
857
894
  * The `fsPromises.mkdtemp()` method will append the six randomly selected
858
895
  * 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
859
896
  * platform-specific path separator
860
- * (`require('path').sep`).
897
+ * (`require('node:path').sep`).
861
898
  * @since v10.0.0
862
- * @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
899
+ * @return Fulfills with a string containing the file system path of the newly created temporary directory.
863
900
  */
864
901
  function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
865
902
  /**
@@ -876,7 +913,7 @@ declare module 'fs/promises' {
876
913
  function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
877
914
  /**
878
915
  * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
879
- * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
916
+ * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
880
917
  * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
881
918
  *
882
919
  * The `encoding` option is ignored if `data` is a buffer.
@@ -899,8 +936,8 @@ declare module 'fs/promises' {
899
936
  * to be written.
900
937
  *
901
938
  * ```js
902
- * import { writeFile } from 'fs/promises';
903
- * import { Buffer } from 'buffer';
939
+ * import { writeFile } from 'node:fs/promises';
940
+ * import { Buffer } from 'node:buffer';
904
941
  *
905
942
  * try {
906
943
  * const controller = new AbortController();
@@ -963,11 +1000,25 @@ declare module 'fs/promises' {
963
1000
  * with an error. On FreeBSD, a representation of the directory's contents will be
964
1001
  * returned.
965
1002
  *
1003
+ * An example of reading a `package.json` file located in the same directory of the
1004
+ * running code:
1005
+ *
1006
+ * ```js
1007
+ * import { readFile } from 'node:fs/promises';
1008
+ * try {
1009
+ * const filePath = new URL('./package.json', import.meta.url);
1010
+ * const contents = await readFile(filePath, { encoding: 'utf8' });
1011
+ * console.log(contents);
1012
+ * } catch (err) {
1013
+ * console.error(err.message);
1014
+ * }
1015
+ * ```
1016
+ *
966
1017
  * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a
967
1018
  * request is aborted the promise returned is rejected with an `AbortError`:
968
1019
  *
969
1020
  * ```js
970
- * import { readFile } from 'fs/promises';
1021
+ * import { readFile } from 'node:fs/promises';
971
1022
  *
972
1023
  * try {
973
1024
  * const controller = new AbortController();
@@ -1046,7 +1097,7 @@ declare module 'fs/promises' {
1046
1097
  * Example using async iteration:
1047
1098
  *
1048
1099
  * ```js
1049
- * import { opendir } from 'fs/promises';
1100
+ * import { opendir } from 'node:fs/promises';
1050
1101
  *
1051
1102
  * try {
1052
1103
  * const dir = await opendir('./');
@@ -1067,7 +1118,7 @@ declare module 'fs/promises' {
1067
1118
  * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
1068
1119
  *
1069
1120
  * ```js
1070
- * const { watch } = require('fs/promises');
1121
+ * const { watch } = require('node:fs/promises');
1071
1122
  *
1072
1123
  * const ac = new AbortController();
1073
1124
  * const { signal } = ac;