@idlebox/stripe-node-types 24.0.14 → 24.0.15

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 (85) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +98 -1
  3. package/assert.d.ts +147 -248
  4. package/async_hooks.d.ts +5 -5
  5. package/buffer.buffer.d.ts +9 -6
  6. package/buffer.d.ts +49 -169
  7. package/child_process.d.ts +102 -223
  8. package/cluster.d.ts +236 -329
  9. package/console.d.ts +45 -346
  10. package/constants.d.ts +0 -1
  11. package/crypto.d.ts +698 -1149
  12. package/dgram.d.ts +15 -50
  13. package/diagnostics_channel.d.ts +1 -3
  14. package/dns.d.ts +135 -131
  15. package/domain.d.ts +10 -14
  16. package/events.d.ts +846 -722
  17. package/fs/promises.d.ts +102 -53
  18. package/fs.d.ts +714 -484
  19. package/globals.d.ts +130 -347
  20. package/globals.typedarray.d.ts +79 -0
  21. package/http.d.ts +343 -246
  22. package/http2.d.ts +563 -711
  23. package/https.d.ts +70 -216
  24. package/index.d.ts +24 -3
  25. package/inspector/promises.d.ts +54 -0
  26. package/inspector.d.ts +167 -3938
  27. package/inspector.generated.d.ts +4242 -0
  28. package/module.d.ts +45 -95
  29. package/net.d.ts +87 -186
  30. package/os.d.ts +17 -6
  31. package/package.json +3 -8
  32. package/path/posix.d.ts +20 -0
  33. package/path/win32.d.ts +20 -0
  34. package/path.d.ts +117 -122
  35. package/perf_hooks.d.ts +295 -644
  36. package/process.d.ts +177 -138
  37. package/punycode.d.ts +2 -2
  38. package/querystring.d.ts +1 -1
  39. package/quic.d.ts +926 -0
  40. package/readline/promises.d.ts +1 -1
  41. package/readline.d.ts +65 -118
  42. package/repl.d.ts +83 -96
  43. package/sea.d.ts +10 -1
  44. package/sqlite.d.ts +262 -13
  45. package/stream/consumers.d.ts +7 -7
  46. package/stream/promises.d.ts +133 -12
  47. package/stream/web.d.ts +173 -495
  48. package/stream.d.ts +593 -490
  49. package/string_decoder.d.ts +3 -3
  50. package/test/reporters.d.ts +112 -0
  51. package/test.d.ts +223 -199
  52. package/timers/promises.d.ts +1 -1
  53. package/timers.d.ts +1 -129
  54. package/tls.d.ts +148 -163
  55. package/trace_events.d.ts +6 -6
  56. package/ts5.6/buffer.buffer.d.ts +10 -8
  57. package/ts5.6/globals.typedarray.d.ts +16 -0
  58. package/ts5.6/index.d.ts +24 -3
  59. package/ts5.7/index.d.ts +24 -3
  60. package/tty.d.ts +55 -13
  61. package/url.d.ts +92 -587
  62. package/util/types.d.ts +571 -0
  63. package/util.d.ts +143 -792
  64. package/v8.d.ts +67 -7
  65. package/vm.d.ts +252 -108
  66. package/wasi.d.ts +23 -2
  67. package/web-globals/abortcontroller.d.ts +75 -0
  68. package/web-globals/blob.d.ts +39 -0
  69. package/{ts5.1/compatibility/disposable.d.ts → web-globals/console.d.ts} +6 -9
  70. package/web-globals/crypto.d.ts +55 -0
  71. package/web-globals/domexception.d.ts +84 -0
  72. package/web-globals/encoding.d.ts +27 -0
  73. package/{dom-events.d.ts → web-globals/events.d.ts} +57 -50
  74. package/web-globals/fetch.d.ts +70 -0
  75. package/web-globals/importmeta.d.ts +29 -0
  76. package/web-globals/messaging.d.ts +39 -0
  77. package/web-globals/navigator.d.ts +41 -0
  78. package/web-globals/performance.d.ts +61 -0
  79. package/web-globals/storage.d.ts +40 -0
  80. package/web-globals/streams.d.ts +131 -0
  81. package/web-globals/timers.d.ts +60 -0
  82. package/web-globals/url.d.ts +40 -0
  83. package/worker_threads.d.ts +291 -349
  84. package/zlib.d.ts +44 -94
  85. package/ts5.1/index.d.ts +0 -115
package/fs.d.ts CHANGED
@@ -31,34 +31,34 @@
31
31
  *
32
32
  * All file system operations have synchronous, callback, and promise-based
33
33
  * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
34
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/fs.js)
34
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/fs.js)
35
35
  */
36
36
 
37
37
  declare module "_not-use-node-type_fs" {
38
+ import { NonSharedBuffer } from 'node:buffer';
39
+ import { Abortable, EventEmitter, InternalEventEmitter } from 'node:events';
40
+ import { FileHandle } from 'node:fs/promises';
38
41
  import * as stream from 'node:stream';
39
- import { Abortable, EventEmitter } from 'node:events';
40
42
  import { URL } from 'node:url';
41
- import * as promises from 'node:fs/promises';
42
- export { promises };
43
43
  /**
44
44
  * Valid types for path values in "fs".
45
45
  */
46
- export type PathLike = string | Buffer | URL;
47
- export type PathOrFileDescriptor = PathLike | number;
48
- export type TimeLike = string | number | Date;
49
- export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
50
- export type BufferEncodingOption =
46
+ type PathLike = string | Buffer | URL;
47
+ type PathOrFileDescriptor = PathLike | number;
48
+ type TimeLike = string | number | Date;
49
+ type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
50
+ type BufferEncodingOption =
51
51
  | "buffer"
52
52
  | {
53
53
  encoding: "buffer";
54
54
  };
55
- export interface ObjectEncodingOptions {
55
+ interface ObjectEncodingOptions {
56
56
  encoding?: BufferEncoding | null | undefined;
57
57
  }
58
- export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
59
- export type OpenMode = number | string;
60
- export type Mode = number | string;
61
- export interface StatsBase<T> {
58
+ type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
59
+ type OpenMode = number | string;
60
+ type Mode = number | string;
61
+ interface StatsBase<T> {
62
62
  isFile(): boolean;
63
63
  isDirectory(): boolean;
64
64
  isBlockDevice(): boolean;
@@ -85,7 +85,7 @@ declare module "_not-use-node-type_fs" {
85
85
  ctime: Date;
86
86
  birthtime: Date;
87
87
  }
88
- export interface Stats extends StatsBase<number> {}
88
+ interface Stats extends StatsBase<number> {}
89
89
  /**
90
90
  * A `fs.Stats` object provides information about a file.
91
91
  *
@@ -146,10 +146,10 @@ declare module "_not-use-node-type_fs" {
146
146
  * ```
147
147
  * @since v0.1.21
148
148
  */
149
- export class Stats {
149
+ class Stats {
150
150
  private constructor();
151
151
  }
152
- export interface StatsFsBase<T> {
152
+ interface StatsFsBase<T> {
153
153
  /** Type of file system. */
154
154
  type: T;
155
155
  /** Optimal transfer block size. */
@@ -165,7 +165,7 @@ declare module "_not-use-node-type_fs" {
165
165
  /** Free file nodes in file system. */
166
166
  ffree: T;
167
167
  }
168
- export interface StatsFs extends StatsFsBase<number> {}
168
+ interface StatsFs extends StatsFsBase<number> {}
169
169
  /**
170
170
  * Provides information about a mounted file system.
171
171
  *
@@ -200,9 +200,9 @@ declare module "_not-use-node-type_fs" {
200
200
  * ```
201
201
  * @since v19.6.0, v18.15.0
202
202
  */
203
- export class StatsFs {}
204
- export interface BigIntStatsFs extends StatsFsBase<bigint> {}
205
- export interface StatFsOptions {
203
+ class StatsFs {}
204
+ interface BigIntStatsFs extends StatsFsBase<bigint> {}
205
+ interface StatFsOptions {
206
206
  bigint?: boolean | undefined;
207
207
  }
208
208
  /**
@@ -214,7 +214,7 @@ declare module "_not-use-node-type_fs" {
214
214
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
215
215
  * @since v10.10.0
216
216
  */
217
- export class Dirent<Name extends string | Buffer = string> {
217
+ class Dirent<Name extends string | Buffer = string> {
218
218
  /**
219
219
  * Returns `true` if the `fs.Dirent` object describes a regular file.
220
220
  * @since v10.10.0
@@ -285,7 +285,7 @@ declare module "_not-use-node-type_fs" {
285
285
  * closed after the iterator exits.
286
286
  * @since v12.12.0
287
287
  */
288
- export class Dir implements AsyncIterable<Dirent> {
288
+ class Dir implements AsyncIterable<Dirent> {
289
289
  /**
290
290
  * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
291
291
  * @since v12.12.0
@@ -338,6 +338,18 @@ declare module "_not-use-node-type_fs" {
338
338
  * @since v12.12.0
339
339
  */
340
340
  readSync(): Dirent | null;
341
+ /**
342
+ * Calls `dir.close()` if the directory handle is open, and returns a promise that
343
+ * fulfills when disposal is complete.
344
+ * @since v24.1.0
345
+ */
346
+ [Symbol.asyncDispose](): Promise<void>;
347
+ /**
348
+ * Calls `dir.closeSync()` if the directory handle is open, and returns
349
+ * `undefined`.
350
+ * @since v24.1.0
351
+ */
352
+ [Symbol.dispose](): void;
341
353
  }
342
354
  /**
343
355
  * Class: fs.StatWatcher
@@ -345,7 +357,7 @@ declare module "_not-use-node-type_fs" {
345
357
  * Extends `EventEmitter`
346
358
  * A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
347
359
  */
348
- export interface StatWatcher extends EventEmitter {
360
+ interface StatWatcher extends EventEmitter {
349
361
  /**
350
362
  * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have
351
363
  * no effect.
@@ -366,7 +378,12 @@ declare module "_not-use-node-type_fs" {
366
378
  */
367
379
  unref(): this;
368
380
  }
369
- export interface FSWatcher extends EventEmitter {
381
+ interface FSWatcherEventMap {
382
+ "change": [eventType: string, filename: string | NonSharedBuffer];
383
+ "close": [];
384
+ "error": [error: Error];
385
+ }
386
+ interface FSWatcher extends InternalEventEmitter<FSWatcherEventMap> {
370
387
  /**
371
388
  * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
372
389
  * @since v0.5.8
@@ -391,38 +408,18 @@ declare module "_not-use-node-type_fs" {
391
408
  * @since v14.3.0, v12.20.0
392
409
  */
393
410
  unref(): this;
394
- /**
395
- * events.EventEmitter
396
- * 1. change
397
- * 2. close
398
- * 3. error
399
- */
400
- addListener(event: string, listener: (...args: any[]) => void): this;
401
- addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
402
- addListener(event: "close", listener: () => void): this;
403
- addListener(event: "error", listener: (error: Error) => void): this;
404
- on(event: string, listener: (...args: any[]) => void): this;
405
- on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
406
- on(event: "close", listener: () => void): this;
407
- on(event: "error", listener: (error: Error) => void): this;
408
- once(event: string, listener: (...args: any[]) => void): this;
409
- once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
410
- once(event: "close", listener: () => void): this;
411
- once(event: "error", listener: (error: Error) => void): this;
412
- prependListener(event: string, listener: (...args: any[]) => void): this;
413
- prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
414
- prependListener(event: "close", listener: () => void): this;
415
- prependListener(event: "error", listener: (error: Error) => void): this;
416
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
417
- prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
418
- prependOnceListener(event: "close", listener: () => void): this;
419
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
411
+ }
412
+ interface ReadStreamEventMap extends stream.ReadableEventMap {
413
+ "close": [];
414
+ "data": [chunk: string | NonSharedBuffer];
415
+ "open": [fd: number];
416
+ "ready": [];
420
417
  }
421
418
  /**
422
419
  * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
423
420
  * @since v0.1.93
424
421
  */
425
- export class ReadStream extends stream.Readable {
422
+ class ReadStream extends stream.Readable {
426
423
  close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
427
424
  /**
428
425
  * The number of bytes that have been read so far.
@@ -442,60 +439,250 @@ declare module "_not-use-node-type_fs" {
442
439
  * @since v11.2.0, v10.16.0
443
440
  */
444
441
  pending: boolean;
442
+ // #region InternalEventEmitter
443
+ addListener<E extends keyof ReadStreamEventMap>(
444
+ eventName: E,
445
+ listener: (...args: ReadStreamEventMap[E]) => void,
446
+ ): this;
447
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
448
+ emit<E extends keyof ReadStreamEventMap>(eventName: E, ...args: ReadStreamEventMap[E]): boolean;
449
+ emit(eventName: string | symbol, ...args: any[]): boolean;
450
+ listenerCount<E extends keyof ReadStreamEventMap>(
451
+ eventName: E,
452
+ listener?: (...args: ReadStreamEventMap[E]) => void,
453
+ ): number;
454
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
455
+ listeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
456
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
457
+ off<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
458
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
459
+ on<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
460
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
461
+ once<E extends keyof ReadStreamEventMap>(
462
+ eventName: E,
463
+ listener: (...args: ReadStreamEventMap[E]) => void,
464
+ ): this;
465
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
466
+ prependListener<E extends keyof ReadStreamEventMap>(
467
+ eventName: E,
468
+ listener: (...args: ReadStreamEventMap[E]) => void,
469
+ ): this;
470
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
471
+ prependOnceListener<E extends keyof ReadStreamEventMap>(
472
+ eventName: E,
473
+ listener: (...args: ReadStreamEventMap[E]) => void,
474
+ ): this;
475
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
476
+ rawListeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
477
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
478
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
479
+ removeAllListeners<E extends keyof ReadStreamEventMap>(eventName?: E): this;
480
+ removeAllListeners(eventName?: string | symbol): this;
481
+ removeListener<E extends keyof ReadStreamEventMap>(
482
+ eventName: E,
483
+ listener: (...args: ReadStreamEventMap[E]) => void,
484
+ ): this;
485
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
486
+ // #endregion
487
+ }
488
+ interface Utf8StreamOptions {
445
489
  /**
446
- * events.EventEmitter
447
- * 1. open
448
- * 2. close
449
- * 3. ready
490
+ * Appends writes to dest file instead of truncating it.
491
+ * @default true
450
492
  */
451
- addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
452
- on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
453
- once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
454
- prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
455
- prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
493
+ append?: boolean | undefined;
494
+ /**
495
+ * Which type of data you can send to the write
496
+ * function, supported values are `'utf8'` or `'buffer'`.
497
+ * @default 'utf8'
498
+ */
499
+ contentMode?: "utf8" | "buffer" | undefined;
500
+ /**
501
+ * A path to a file to be written to (mode controlled by the
502
+ * append option).
503
+ */
504
+ dest?: string | undefined;
505
+ /**
506
+ * A file descriptor, something that is returned by `fs.open()`
507
+ * or `fs.openSync()`.
508
+ */
509
+ fd?: number | undefined;
510
+ /**
511
+ * An object that has the same API as the `fs` module, useful
512
+ * for mocking, testing, or customizing the behavior of the stream.
513
+ */
514
+ fs?: object | undefined;
515
+ /**
516
+ * Perform a `fs.fsyncSync()` every time a write is
517
+ * completed.
518
+ */
519
+ fsync?: boolean | undefined;
520
+ /**
521
+ * The maximum length of the internal buffer. If a write
522
+ * operation would cause the buffer to exceed `maxLength`, the data written is
523
+ * dropped and a drop event is emitted with the dropped data
524
+ */
525
+ maxLength?: number | undefined;
526
+ /**
527
+ * The maximum number of bytes that can be written;
528
+ * @default 16384
529
+ */
530
+ maxWrite?: number | undefined;
531
+ /**
532
+ * The minimum length of the internal buffer that is
533
+ * required to be full before flushing.
534
+ */
535
+ minLength?: number | undefined;
536
+ /**
537
+ * Ensure directory for `dest` file exists when true.
538
+ * @default false
539
+ */
540
+ mkdir?: boolean | undefined;
541
+ /**
542
+ * Specify the creating file mode (see `fs.open()`).
543
+ */
544
+ mode?: number | string | undefined;
545
+ /**
546
+ * Calls flush every `periodicFlush` milliseconds.
547
+ */
548
+ periodicFlush?: number | undefined;
549
+ /**
550
+ * A function that will be called when `write()`,
551
+ * `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
552
+ * If the return value is `true` the operation will be retried, otherwise it
553
+ * will bubble the error. The `err` is the error that caused this function to
554
+ * be called, `writeBufferLen` is the length of the buffer that was written,
555
+ * and `remainingBufferLen` is the length of the remaining buffer that the
556
+ * stream did not try to write.
557
+ */
558
+ retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
559
+ /**
560
+ * Perform writes synchronously.
561
+ */
562
+ sync?: boolean | undefined;
563
+ }
564
+ interface Utf8StreamEventMap {
565
+ "close": [];
566
+ "drain": [];
567
+ "drop": [data: string | Buffer];
568
+ "error": [error: Error];
569
+ "finish": [];
570
+ "ready": [];
571
+ "write": [n: number];
456
572
  }
457
-
458
- /**
459
- * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
460
- */
461
- type ReadStreamEvents = {
462
- close: () => void;
463
- data: (chunk: Buffer | string) => void;
464
- end: () => void;
465
- error: (err: Error) => void;
466
- open: (fd: number) => void;
467
- pause: () => void;
468
- readable: () => void;
469
- ready: () => void;
470
- resume: () => void;
471
- } & CustomEvents;
472
-
473
- /**
474
- * string & {} allows to allow any kind of strings for the event
475
- * but still allows to have auto completion for the normal events.
476
- */
477
- type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
478
-
479
573
  /**
480
- * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
574
+ * An optimized UTF-8 stream writer that allows for flushing all the internal
575
+ * buffering on demand. It handles `EAGAIN` errors correctly, allowing for
576
+ * customization, for example, by dropping content if the disk is busy.
577
+ * @since v24.6.0
578
+ * @experimental
481
579
  */
482
- type WriteStreamEvents = {
483
- close: () => void;
484
- drain: () => void;
485
- error: (err: Error) => void;
486
- finish: () => void;
487
- open: (fd: number) => void;
488
- pipe: (src: stream.Readable) => void;
489
- ready: () => void;
490
- unpipe: (src: stream.Readable) => void;
491
- } & CustomEvents;
580
+ class Utf8Stream implements EventEmitter {
581
+ constructor(options: Utf8StreamOptions);
582
+ /**
583
+ * Whether the stream is appending to the file or truncating it.
584
+ */
585
+ readonly append: boolean;
586
+ /**
587
+ * The type of data that can be written to the stream. Supported
588
+ * values are `'utf8'` or `'buffer'`.
589
+ * @default 'utf8'
590
+ */
591
+ readonly contentMode: "utf8" | "buffer";
592
+ /**
593
+ * Close the stream immediately, without flushing the internal buffer.
594
+ */
595
+ destroy(): void;
596
+ /**
597
+ * Close the stream gracefully, flushing the internal buffer before closing.
598
+ */
599
+ end(): void;
600
+ /**
601
+ * The file descriptor that is being written to.
602
+ */
603
+ readonly fd: number;
604
+ /**
605
+ * The file that is being written to.
606
+ */
607
+ readonly file: string;
608
+ /**
609
+ * Writes the current buffer to the file if a write was not in progress. Do
610
+ * nothing if `minLength` is zero or if it is already writing.
611
+ */
612
+ flush(callback: (err: Error | null) => void): void;
613
+ /**
614
+ * Flushes the buffered data synchronously. This is a costly operation.
615
+ */
616
+ flushSync(): void;
617
+ /**
618
+ * Whether the stream is performing a `fs.fsyncSync()` after every
619
+ * write operation.
620
+ */
621
+ readonly fsync: boolean;
622
+ /**
623
+ * The maximum length of the internal buffer. If a write
624
+ * operation would cause the buffer to exceed `maxLength`, the data written is
625
+ * dropped and a drop event is emitted with the dropped data.
626
+ */
627
+ readonly maxLength: number;
628
+ /**
629
+ * The minimum length of the internal buffer that is required to be
630
+ * full before flushing.
631
+ */
632
+ readonly minLength: number;
633
+ /**
634
+ * Whether the stream should ensure that the directory for the
635
+ * `dest` file exists. If `true`, it will create the directory if it does not
636
+ * exist.
637
+ * @default false
638
+ */
639
+ readonly mkdir: boolean;
640
+ /**
641
+ * The mode of the file that is being written to.
642
+ */
643
+ readonly mode: number | string;
644
+ /**
645
+ * The number of milliseconds between flushes. If set to `0`, no
646
+ * periodic flushes will be performed.
647
+ */
648
+ readonly periodicFlush: number;
649
+ /**
650
+ * Reopen the file in place, useful for log rotation.
651
+ * @param file A path to a file to be written to (mode
652
+ * controlled by the append option).
653
+ */
654
+ reopen(file: PathLike): void;
655
+ /**
656
+ * Whether the stream is writing synchronously or asynchronously.
657
+ */
658
+ readonly sync: boolean;
659
+ /**
660
+ * When the `options.contentMode` is set to `'utf8'` when the stream is created,
661
+ * the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
662
+ * the `data` argument must be a `Buffer`.
663
+ * @param data The data to write.
664
+ */
665
+ write(data: string | Buffer): boolean;
666
+ /**
667
+ * Whether the stream is currently writing data to the file.
668
+ */
669
+ readonly writing: boolean;
670
+ /**
671
+ * Calls `utf8Stream.destroy()`.
672
+ */
673
+ [Symbol.dispose](): void;
674
+ }
675
+ interface Utf8Stream extends InternalEventEmitter<Utf8StreamEventMap> {}
676
+ interface WriteStreamEventMap extends stream.WritableEventMap {
677
+ "close": [];
678
+ "open": [fd: number];
679
+ "ready": [];
680
+ }
492
681
  /**
493
- * * Extends `stream.Writable`
494
- *
495
682
  * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
496
683
  * @since v0.1.93
497
684
  */
498
- export class WriteStream extends stream.Writable {
685
+ class WriteStream extends stream.Writable {
499
686
  /**
500
687
  * Closes `writeStream`. Optionally accepts a
501
688
  * callback that will be executed once the `writeStream`is closed.
@@ -521,17 +708,57 @@ declare module "_not-use-node-type_fs" {
521
708
  * @since v11.2.0
522
709
  */
523
710
  pending: boolean;
524
- /**
525
- * events.EventEmitter
526
- * 1. open
527
- * 2. close
528
- * 3. ready
529
- */
530
- addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
531
- on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
532
- once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
533
- prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
534
- prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
711
+ // #region InternalEventEmitter
712
+ addListener<E extends keyof WriteStreamEventMap>(
713
+ eventName: E,
714
+ listener: (...args: WriteStreamEventMap[E]) => void,
715
+ ): this;
716
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
717
+ emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
718
+ emit(eventName: string | symbol, ...args: any[]): boolean;
719
+ listenerCount<E extends keyof WriteStreamEventMap>(
720
+ eventName: E,
721
+ listener?: (...args: WriteStreamEventMap[E]) => void,
722
+ ): number;
723
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
724
+ listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
725
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
726
+ off<E extends keyof WriteStreamEventMap>(
727
+ eventName: E,
728
+ listener: (...args: WriteStreamEventMap[E]) => void,
729
+ ): this;
730
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
731
+ on<E extends keyof WriteStreamEventMap>(
732
+ eventName: E,
733
+ listener: (...args: WriteStreamEventMap[E]) => void,
734
+ ): this;
735
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
736
+ once<E extends keyof WriteStreamEventMap>(
737
+ eventName: E,
738
+ listener: (...args: WriteStreamEventMap[E]) => void,
739
+ ): this;
740
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
741
+ prependListener<E extends keyof WriteStreamEventMap>(
742
+ eventName: E,
743
+ listener: (...args: WriteStreamEventMap[E]) => void,
744
+ ): this;
745
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
746
+ prependOnceListener<E extends keyof WriteStreamEventMap>(
747
+ eventName: E,
748
+ listener: (...args: WriteStreamEventMap[E]) => void,
749
+ ): this;
750
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
751
+ rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
752
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
753
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
754
+ removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
755
+ removeAllListeners(eventName?: string | symbol): this;
756
+ removeListener<E extends keyof WriteStreamEventMap>(
757
+ eventName: E,
758
+ listener: (...args: WriteStreamEventMap[E]) => void,
759
+ ): this;
760
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
761
+ // #endregion
535
762
  }
536
763
  /**
537
764
  * Asynchronously rename file at `oldPath` to the pathname provided
@@ -552,8 +779,8 @@ declare module "_not-use-node-type_fs" {
552
779
  * ```
553
780
  * @since v0.0.2
554
781
  */
555
- export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
556
- export namespace rename {
782
+ function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
783
+ namespace rename {
557
784
  /**
558
785
  * Asynchronous rename(2) - Change the name or location of a file or directory.
559
786
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -569,7 +796,7 @@ declare module "_not-use-node-type_fs" {
569
796
  * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
570
797
  * @since v0.1.21
571
798
  */
572
- export function renameSync(oldPath: PathLike, newPath: PathLike): void;
799
+ function renameSync(oldPath: PathLike, newPath: PathLike): void;
573
800
  /**
574
801
  * Truncates the file. No arguments other than a possible exception are
575
802
  * given to the completion callback. A file descriptor can also be passed as the
@@ -591,13 +818,13 @@ declare module "_not-use-node-type_fs" {
591
818
  * @since v0.8.6
592
819
  * @param [len=0]
593
820
  */
594
- export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
821
+ function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
595
822
  /**
596
823
  * Asynchronous truncate(2) - Truncate a file to a specified length.
597
824
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
598
825
  */
599
- export function truncate(path: PathLike, callback: NoParamCallback): void;
600
- export namespace truncate {
826
+ function truncate(path: PathLike, callback: NoParamCallback): void;
827
+ namespace truncate {
601
828
  /**
602
829
  * Asynchronous truncate(2) - Truncate a file to a specified length.
603
830
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -614,7 +841,7 @@ declare module "_not-use-node-type_fs" {
614
841
  * @since v0.8.6
615
842
  * @param [len=0]
616
843
  */
617
- export function truncateSync(path: PathLike, len?: number): void;
844
+ function truncateSync(path: PathLike, len?: number): void;
618
845
  /**
619
846
  * Truncates the file descriptor. No arguments other than a possible exception are
620
847
  * given to the completion callback.
@@ -658,13 +885,13 @@ declare module "_not-use-node-type_fs" {
658
885
  * @since v0.8.6
659
886
  * @param [len=0]
660
887
  */
661
- export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
888
+ function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
662
889
  /**
663
890
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
664
891
  * @param fd A file descriptor.
665
892
  */
666
- export function ftruncate(fd: number, callback: NoParamCallback): void;
667
- export namespace ftruncate {
893
+ function ftruncate(fd: number, callback: NoParamCallback): void;
894
+ namespace ftruncate {
668
895
  /**
669
896
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
670
897
  * @param fd A file descriptor.
@@ -680,7 +907,7 @@ declare module "_not-use-node-type_fs" {
680
907
  * @since v0.8.6
681
908
  * @param [len=0]
682
909
  */
683
- export function ftruncateSync(fd: number, len?: number): void;
910
+ function ftruncateSync(fd: number, len?: number): void;
684
911
  /**
685
912
  * Asynchronously changes owner and group of a file. No arguments other than a
686
913
  * possible exception are given to the completion callback.
@@ -688,8 +915,8 @@ declare module "_not-use-node-type_fs" {
688
915
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
689
916
  * @since v0.1.97
690
917
  */
691
- export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
692
- export namespace chown {
918
+ function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
919
+ namespace chown {
693
920
  /**
694
921
  * Asynchronous chown(2) - Change ownership of a file.
695
922
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -703,7 +930,7 @@ declare module "_not-use-node-type_fs" {
703
930
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
704
931
  * @since v0.1.97
705
932
  */
706
- export function chownSync(path: PathLike, uid: number, gid: number): void;
933
+ function chownSync(path: PathLike, uid: number, gid: number): void;
707
934
  /**
708
935
  * Sets the owner of the file. No arguments other than a possible exception are
709
936
  * given to the completion callback.
@@ -711,8 +938,8 @@ declare module "_not-use-node-type_fs" {
711
938
  * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
712
939
  * @since v0.4.7
713
940
  */
714
- export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
715
- export namespace fchown {
941
+ function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
942
+ namespace fchown {
716
943
  /**
717
944
  * Asynchronous fchown(2) - Change ownership of a file.
718
945
  * @param fd A file descriptor.
@@ -727,15 +954,15 @@ declare module "_not-use-node-type_fs" {
727
954
  * @param uid The file's new owner's user id.
728
955
  * @param gid The file's new group's group id.
729
956
  */
730
- export function fchownSync(fd: number, uid: number, gid: number): void;
957
+ function fchownSync(fd: number, uid: number, gid: number): void;
731
958
  /**
732
959
  * Set the owner of the symbolic link. No arguments other than a possible
733
960
  * exception are given to the completion callback.
734
961
  *
735
962
  * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
736
963
  */
737
- export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
738
- export namespace lchown {
964
+ function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
965
+ namespace lchown {
739
966
  /**
740
967
  * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
741
968
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -749,7 +976,7 @@ declare module "_not-use-node-type_fs" {
749
976
  * @param uid The file's new owner's user id.
750
977
  * @param gid The file's new group's group id.
751
978
  */
752
- export function lchownSync(path: PathLike, uid: number, gid: number): void;
979
+ function lchownSync(path: PathLike, uid: number, gid: number): void;
753
980
  /**
754
981
  * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic
755
982
  * link, then the link is not dereferenced: instead, the timestamps of the
@@ -759,8 +986,8 @@ declare module "_not-use-node-type_fs" {
759
986
  * callback.
760
987
  * @since v14.5.0, v12.19.0
761
988
  */
762
- export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
763
- export namespace lutimes {
989
+ function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
990
+ namespace lutimes {
764
991
  /**
765
992
  * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
766
993
  * with the difference that if the path refers to a symbolic link, then the link is not
@@ -777,7 +1004,7 @@ declare module "_not-use-node-type_fs" {
777
1004
  * the operation fails. This is the synchronous version of {@link lutimes}.
778
1005
  * @since v14.5.0, v12.19.0
779
1006
  */
780
- export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
1007
+ function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
781
1008
  /**
782
1009
  * Asynchronously changes the permissions of a file. No arguments other than a
783
1010
  * possible exception are given to the completion callback.
@@ -794,8 +1021,8 @@ declare module "_not-use-node-type_fs" {
794
1021
  * ```
795
1022
  * @since v0.1.30
796
1023
  */
797
- export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
798
- export namespace chmod {
1024
+ function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1025
+ namespace chmod {
799
1026
  /**
800
1027
  * Asynchronous chmod(2) - Change permissions of a file.
801
1028
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -810,7 +1037,7 @@ declare module "_not-use-node-type_fs" {
810
1037
  * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
811
1038
  * @since v0.6.7
812
1039
  */
813
- export function chmodSync(path: PathLike, mode: Mode): void;
1040
+ function chmodSync(path: PathLike, mode: Mode): void;
814
1041
  /**
815
1042
  * Sets the permissions on the file. No arguments other than a possible exception
816
1043
  * are given to the completion callback.
@@ -818,8 +1045,8 @@ declare module "_not-use-node-type_fs" {
818
1045
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
819
1046
  * @since v0.4.7
820
1047
  */
821
- export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
822
- export namespace fchmod {
1048
+ function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
1049
+ namespace fchmod {
823
1050
  /**
824
1051
  * Asynchronous fchmod(2) - Change permissions of a file.
825
1052
  * @param fd A file descriptor.
@@ -833,7 +1060,7 @@ declare module "_not-use-node-type_fs" {
833
1060
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
834
1061
  * @since v0.4.7
835
1062
  */
836
- export function fchmodSync(fd: number, mode: Mode): void;
1063
+ function fchmodSync(fd: number, mode: Mode): void;
837
1064
  /**
838
1065
  * Changes the permissions on a symbolic link. No arguments other than a possible
839
1066
  * exception are given to the completion callback.
@@ -843,9 +1070,9 @@ declare module "_not-use-node-type_fs" {
843
1070
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
844
1071
  * @deprecated Since v0.4.7
845
1072
  */
846
- export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1073
+ function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
847
1074
  /** @deprecated */
848
- export namespace lchmod {
1075
+ namespace lchmod {
849
1076
  /**
850
1077
  * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
851
1078
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -861,7 +1088,7 @@ declare module "_not-use-node-type_fs" {
861
1088
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
862
1089
  * @deprecated Since v0.4.7
863
1090
  */
864
- export function lchmodSync(path: PathLike, mode: Mode): void;
1091
+ function lchmodSync(path: PathLike, mode: Mode): void;
865
1092
  /**
866
1093
  * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object.
867
1094
  *
@@ -947,8 +1174,8 @@ declare module "_not-use-node-type_fs" {
947
1174
  * ```
948
1175
  * @since v0.0.2
949
1176
  */
950
- export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
951
- export function stat(
1177
+ function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1178
+ function stat(
952
1179
  path: PathLike,
953
1180
  options:
954
1181
  | (StatOptions & {
@@ -957,19 +1184,19 @@ declare module "_not-use-node-type_fs" {
957
1184
  | undefined,
958
1185
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
959
1186
  ): void;
960
- export function stat(
1187
+ function stat(
961
1188
  path: PathLike,
962
1189
  options: StatOptions & {
963
1190
  bigint: true;
964
1191
  },
965
1192
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
966
1193
  ): void;
967
- export function stat(
1194
+ function stat(
968
1195
  path: PathLike,
969
1196
  options: StatOptions | undefined,
970
1197
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
971
1198
  ): void;
972
- export namespace stat {
1199
+ namespace stat {
973
1200
  /**
974
1201
  * Asynchronous stat(2) - Get file status.
975
1202
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -988,7 +1215,7 @@ declare module "_not-use-node-type_fs" {
988
1215
  ): Promise<BigIntStats>;
989
1216
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
990
1217
  }
991
- export interface StatSyncFn extends Function {
1218
+ interface StatSyncFn extends Function {
992
1219
  (path: PathLike, options?: undefined): Stats;
993
1220
  (
994
1221
  path: PathLike,
@@ -1029,15 +1256,15 @@ declare module "_not-use-node-type_fs" {
1029
1256
  * Synchronous stat(2) - Get file status.
1030
1257
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1031
1258
  */
1032
- export const statSync: StatSyncFn;
1259
+ const statSync: StatSyncFn;
1033
1260
  /**
1034
1261
  * Invokes the callback with the `fs.Stats` for the file descriptor.
1035
1262
  *
1036
1263
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1037
1264
  * @since v0.1.95
1038
1265
  */
1039
- export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1040
- export function fstat(
1266
+ function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1267
+ function fstat(
1041
1268
  fd: number,
1042
1269
  options:
1043
1270
  | (StatOptions & {
@@ -1046,19 +1273,19 @@ declare module "_not-use-node-type_fs" {
1046
1273
  | undefined,
1047
1274
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1048
1275
  ): void;
1049
- export function fstat(
1276
+ function fstat(
1050
1277
  fd: number,
1051
1278
  options: StatOptions & {
1052
1279
  bigint: true;
1053
1280
  },
1054
1281
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1055
1282
  ): void;
1056
- export function fstat(
1283
+ function fstat(
1057
1284
  fd: number,
1058
1285
  options: StatOptions | undefined,
1059
1286
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1060
1287
  ): void;
1061
- export namespace fstat {
1288
+ namespace fstat {
1062
1289
  /**
1063
1290
  * Asynchronous fstat(2) - Get file status.
1064
1291
  * @param fd A file descriptor.
@@ -1083,19 +1310,19 @@ declare module "_not-use-node-type_fs" {
1083
1310
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1084
1311
  * @since v0.1.95
1085
1312
  */
1086
- export function fstatSync(
1313
+ function fstatSync(
1087
1314
  fd: number,
1088
1315
  options?: StatOptions & {
1089
1316
  bigint?: false | undefined;
1090
1317
  },
1091
1318
  ): Stats;
1092
- export function fstatSync(
1319
+ function fstatSync(
1093
1320
  fd: number,
1094
1321
  options: StatOptions & {
1095
1322
  bigint: true;
1096
1323
  },
1097
1324
  ): BigIntStats;
1098
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1325
+ function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1099
1326
  /**
1100
1327
  * Retrieves the `fs.Stats` for the symbolic link referred to by the path.
1101
1328
  * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
@@ -1104,8 +1331,8 @@ declare module "_not-use-node-type_fs" {
1104
1331
  * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
1105
1332
  * @since v0.1.30
1106
1333
  */
1107
- export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1108
- export function lstat(
1334
+ function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1335
+ function lstat(
1109
1336
  path: PathLike,
1110
1337
  options:
1111
1338
  | (StatOptions & {
@@ -1114,19 +1341,19 @@ declare module "_not-use-node-type_fs" {
1114
1341
  | undefined,
1115
1342
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1116
1343
  ): void;
1117
- export function lstat(
1344
+ function lstat(
1118
1345
  path: PathLike,
1119
1346
  options: StatOptions & {
1120
1347
  bigint: true;
1121
1348
  },
1122
1349
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1123
1350
  ): void;
1124
- export function lstat(
1351
+ function lstat(
1125
1352
  path: PathLike,
1126
1353
  options: StatOptions | undefined,
1127
1354
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1128
1355
  ): void;
1129
- export namespace lstat {
1356
+ namespace lstat {
1130
1357
  /**
1131
1358
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
1132
1359
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1153,8 +1380,8 @@ declare module "_not-use-node-type_fs" {
1153
1380
  * @since v19.6.0, v18.15.0
1154
1381
  * @param path A path to an existing file or directory on the file system to be queried.
1155
1382
  */
1156
- export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1157
- export function statfs(
1383
+ function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1384
+ function statfs(
1158
1385
  path: PathLike,
1159
1386
  options:
1160
1387
  | (StatFsOptions & {
@@ -1163,19 +1390,19 @@ declare module "_not-use-node-type_fs" {
1163
1390
  | undefined,
1164
1391
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void,
1165
1392
  ): void;
1166
- export function statfs(
1393
+ function statfs(
1167
1394
  path: PathLike,
1168
1395
  options: StatFsOptions & {
1169
1396
  bigint: true;
1170
1397
  },
1171
1398
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void,
1172
1399
  ): void;
1173
- export function statfs(
1400
+ function statfs(
1174
1401
  path: PathLike,
1175
1402
  options: StatFsOptions | undefined,
1176
1403
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void,
1177
1404
  ): void;
1178
- export namespace statfs {
1405
+ namespace statfs {
1179
1406
  /**
1180
1407
  * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1181
1408
  * @param path A path to an existing file or directory on the file system to be queried.
@@ -1202,32 +1429,32 @@ declare module "_not-use-node-type_fs" {
1202
1429
  * @since v19.6.0, v18.15.0
1203
1430
  * @param path A path to an existing file or directory on the file system to be queried.
1204
1431
  */
1205
- export function statfsSync(
1432
+ function statfsSync(
1206
1433
  path: PathLike,
1207
1434
  options?: StatFsOptions & {
1208
1435
  bigint?: false | undefined;
1209
1436
  },
1210
1437
  ): StatsFs;
1211
- export function statfsSync(
1438
+ function statfsSync(
1212
1439
  path: PathLike,
1213
1440
  options: StatFsOptions & {
1214
1441
  bigint: true;
1215
1442
  },
1216
1443
  ): BigIntStatsFs;
1217
- export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1444
+ function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1218
1445
  /**
1219
1446
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1220
1447
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1221
1448
  */
1222
- export const lstatSync: StatSyncFn;
1449
+ const lstatSync: StatSyncFn;
1223
1450
  /**
1224
1451
  * 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. No arguments other than
1225
1452
  * a possible
1226
1453
  * exception are given to the completion callback.
1227
1454
  * @since v0.1.31
1228
1455
  */
1229
- export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1230
- export namespace link {
1456
+ function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1457
+ namespace link {
1231
1458
  /**
1232
1459
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
1233
1460
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1239,7 +1466,7 @@ declare module "_not-use-node-type_fs" {
1239
1466
  * 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. Returns `undefined`.
1240
1467
  * @since v0.1.31
1241
1468
  */
1242
- export function linkSync(existingPath: PathLike, newPath: PathLike): void;
1469
+ function linkSync(existingPath: PathLike, newPath: PathLike): void;
1243
1470
  /**
1244
1471
  * Creates the link called `path` pointing to `target`. No arguments other than a
1245
1472
  * possible exception are given to the completion callback.
@@ -1273,7 +1500,7 @@ declare module "_not-use-node-type_fs" {
1273
1500
  * @since v0.1.31
1274
1501
  * @param [type='null']
1275
1502
  */
1276
- export function symlink(
1503
+ function symlink(
1277
1504
  target: PathLike,
1278
1505
  path: PathLike,
1279
1506
  type: symlink.Type | undefined | null,
@@ -1284,8 +1511,8 @@ declare module "_not-use-node-type_fs" {
1284
1511
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
1285
1512
  * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
1286
1513
  */
1287
- export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1288
- export namespace symlink {
1514
+ function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1515
+ namespace symlink {
1289
1516
  /**
1290
1517
  * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
1291
1518
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
@@ -1304,7 +1531,7 @@ declare module "_not-use-node-type_fs" {
1304
1531
  * @since v0.1.31
1305
1532
  * @param [type='null']
1306
1533
  */
1307
- export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1534
+ function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1308
1535
  /**
1309
1536
  * Reads the contents of the symbolic link referred to by `path`. The callback gets
1310
1537
  * two arguments `(err, linkString)`.
@@ -1317,7 +1544,7 @@ declare module "_not-use-node-type_fs" {
1317
1544
  * the link path returned will be passed as a `Buffer` object.
1318
1545
  * @since v0.1.31
1319
1546
  */
1320
- export function readlink(
1547
+ function readlink(
1321
1548
  path: PathLike,
1322
1549
  options: EncodingOption,
1323
1550
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
@@ -1327,30 +1554,30 @@ declare module "_not-use-node-type_fs" {
1327
1554
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1328
1555
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1329
1556
  */
1330
- export function readlink(
1557
+ function readlink(
1331
1558
  path: PathLike,
1332
1559
  options: BufferEncodingOption,
1333
- callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void,
1560
+ callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
1334
1561
  ): void;
1335
1562
  /**
1336
1563
  * Asynchronous readlink(2) - read value of a symbolic link.
1337
1564
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1338
1565
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1339
1566
  */
1340
- export function readlink(
1567
+ function readlink(
1341
1568
  path: PathLike,
1342
1569
  options: EncodingOption,
1343
- callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void,
1570
+ callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
1344
1571
  ): void;
1345
1572
  /**
1346
1573
  * Asynchronous readlink(2) - read value of a symbolic link.
1347
1574
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1348
1575
  */
1349
- export function readlink(
1576
+ function readlink(
1350
1577
  path: PathLike,
1351
1578
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
1352
1579
  ): void;
1353
- export namespace readlink {
1580
+ namespace readlink {
1354
1581
  /**
1355
1582
  * Asynchronous readlink(2) - read value of a symbolic link.
1356
1583
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1362,13 +1589,13 @@ declare module "_not-use-node-type_fs" {
1362
1589
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1363
1590
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1364
1591
  */
1365
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1592
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1366
1593
  /**
1367
1594
  * Asynchronous readlink(2) - read value of a symbolic link.
1368
1595
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1369
1596
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1370
1597
  */
1371
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1598
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1372
1599
  }
1373
1600
  /**
1374
1601
  * Returns the symbolic link's string value.
@@ -1381,19 +1608,19 @@ declare module "_not-use-node-type_fs" {
1381
1608
  * the link path returned will be passed as a `Buffer` object.
1382
1609
  * @since v0.1.31
1383
1610
  */
1384
- export function readlinkSync(path: PathLike, options?: EncodingOption): string;
1611
+ function readlinkSync(path: PathLike, options?: EncodingOption): string;
1385
1612
  /**
1386
1613
  * Synchronous readlink(2) - read value of a symbolic link.
1387
1614
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1388
1615
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1389
1616
  */
1390
- export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
1617
+ function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1391
1618
  /**
1392
1619
  * Synchronous readlink(2) - read value of a symbolic link.
1393
1620
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1394
1621
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1395
1622
  */
1396
- export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer;
1623
+ function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1397
1624
  /**
1398
1625
  * Asynchronously computes the canonical pathname by resolving `.`, `..`, and
1399
1626
  * symbolic links.
@@ -1420,7 +1647,7 @@ declare module "_not-use-node-type_fs" {
1420
1647
  * dependent name for that object.
1421
1648
  * @since v0.1.31
1422
1649
  */
1423
- export function realpath(
1650
+ function realpath(
1424
1651
  path: PathLike,
1425
1652
  options: EncodingOption,
1426
1653
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
@@ -1430,30 +1657,30 @@ declare module "_not-use-node-type_fs" {
1430
1657
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1431
1658
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1432
1659
  */
1433
- export function realpath(
1660
+ function realpath(
1434
1661
  path: PathLike,
1435
1662
  options: BufferEncodingOption,
1436
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1663
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1437
1664
  ): void;
1438
1665
  /**
1439
1666
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1440
1667
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1441
1668
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1442
1669
  */
1443
- export function realpath(
1670
+ function realpath(
1444
1671
  path: PathLike,
1445
1672
  options: EncodingOption,
1446
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1673
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1447
1674
  ): void;
1448
1675
  /**
1449
1676
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1450
1677
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1451
1678
  */
1452
- export function realpath(
1679
+ function realpath(
1453
1680
  path: PathLike,
1454
1681
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
1455
1682
  ): void;
1456
- export namespace realpath {
1683
+ namespace realpath {
1457
1684
  /**
1458
1685
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1459
1686
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1465,13 +1692,13 @@ declare module "_not-use-node-type_fs" {
1465
1692
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1466
1693
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1467
1694
  */
1468
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1695
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1469
1696
  /**
1470
1697
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1471
1698
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1472
1699
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1473
1700
  */
1474
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1701
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1475
1702
  /**
1476
1703
  * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
1477
1704
  *
@@ -1497,12 +1724,12 @@ declare module "_not-use-node-type_fs" {
1497
1724
  function native(
1498
1725
  path: PathLike,
1499
1726
  options: BufferEncodingOption,
1500
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1727
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1501
1728
  ): void;
1502
1729
  function native(
1503
1730
  path: PathLike,
1504
1731
  options: EncodingOption,
1505
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1732
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1506
1733
  ): void;
1507
1734
  function native(
1508
1735
  path: PathLike,
@@ -1516,23 +1743,23 @@ declare module "_not-use-node-type_fs" {
1516
1743
  * this API: {@link realpath}.
1517
1744
  * @since v0.1.31
1518
1745
  */
1519
- export function realpathSync(path: PathLike, options?: EncodingOption): string;
1746
+ function realpathSync(path: PathLike, options?: EncodingOption): string;
1520
1747
  /**
1521
1748
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1522
1749
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1523
1750
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1524
1751
  */
1525
- export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
1752
+ function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1526
1753
  /**
1527
1754
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1528
1755
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1529
1756
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1530
1757
  */
1531
- export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer;
1532
- export namespace realpathSync {
1758
+ function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1759
+ namespace realpathSync {
1533
1760
  function native(path: PathLike, options?: EncodingOption): string;
1534
- function native(path: PathLike, options: BufferEncodingOption): Buffer;
1535
- function native(path: PathLike, options?: EncodingOption): string | Buffer;
1761
+ function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1762
+ function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1536
1763
  }
1537
1764
  /**
1538
1765
  * Asynchronously removes a file or symbolic link. No arguments other than a
@@ -1553,8 +1780,8 @@ declare module "_not-use-node-type_fs" {
1553
1780
  * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
1554
1781
  * @since v0.0.2
1555
1782
  */
1556
- export function unlink(path: PathLike, callback: NoParamCallback): void;
1557
- export namespace unlink {
1783
+ function unlink(path: PathLike, callback: NoParamCallback): void;
1784
+ namespace unlink {
1558
1785
  /**
1559
1786
  * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
1560
1787
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1565,34 +1792,10 @@ declare module "_not-use-node-type_fs" {
1565
1792
  * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
1566
1793
  * @since v0.1.21
1567
1794
  */
1568
- export function unlinkSync(path: PathLike): void;
1569
- export interface RmDirOptions {
1570
- /**
1571
- * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
1572
- * `EPERM` error is encountered, Node.js will retry the operation with a linear
1573
- * backoff wait of `retryDelay` ms longer on each try. This option represents the
1574
- * number of retries. This option is ignored if the `recursive` option is not
1575
- * `true`.
1576
- * @default 0
1577
- */
1578
- maxRetries?: number | undefined;
1579
- /**
1580
- * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
1581
- * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
1582
- * Use `fs.rm(path, { recursive: true, force: true })` instead.
1583
- *
1584
- * If `true`, perform a recursive directory removal. In
1585
- * recursive mode, operations are retried on failure.
1586
- * @default false
1587
- */
1588
- recursive?: boolean | undefined;
1589
- /**
1590
- * The amount of time in milliseconds to wait between retries.
1591
- * This option is ignored if the `recursive` option is not `true`.
1592
- * @default 100
1593
- */
1594
- retryDelay?: number | undefined;
1595
- }
1795
+ function unlinkSync(path: PathLike): void;
1796
+ /** @deprecated `rmdir()` no longer provides any options. This interface will be removed in a future version. */
1797
+ // TODO: remove in future major
1798
+ interface RmDirOptions {}
1596
1799
  /**
1597
1800
  * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
1598
1801
  * to the completion callback.
@@ -1603,14 +1806,13 @@ declare module "_not-use-node-type_fs" {
1603
1806
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
1604
1807
  * @since v0.0.2
1605
1808
  */
1606
- export function rmdir(path: PathLike, callback: NoParamCallback): void;
1607
- export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
1608
- export namespace rmdir {
1809
+ function rmdir(path: PathLike, callback: NoParamCallback): void;
1810
+ namespace rmdir {
1609
1811
  /**
1610
1812
  * Asynchronous rmdir(2) - delete a directory.
1611
1813
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1612
1814
  */
1613
- function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
1815
+ function __promisify__(path: PathLike): Promise<void>;
1614
1816
  }
1615
1817
  /**
1616
1818
  * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
@@ -1621,8 +1823,8 @@ declare module "_not-use-node-type_fs" {
1621
1823
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
1622
1824
  * @since v0.1.21
1623
1825
  */
1624
- export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
1625
- export interface RmOptions {
1826
+ function rmdirSync(path: PathLike): void;
1827
+ interface RmOptions {
1626
1828
  /**
1627
1829
  * When `true`, exceptions will be ignored if `path` does not exist.
1628
1830
  * @default false
@@ -1655,9 +1857,9 @@ declare module "_not-use-node-type_fs" {
1655
1857
  * completion callback.
1656
1858
  * @since v14.14.0
1657
1859
  */
1658
- export function rm(path: PathLike, callback: NoParamCallback): void;
1659
- export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1660
- export namespace rm {
1860
+ function rm(path: PathLike, callback: NoParamCallback): void;
1861
+ function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1862
+ namespace rm {
1661
1863
  /**
1662
1864
  * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
1663
1865
  */
@@ -1667,8 +1869,8 @@ declare module "_not-use-node-type_fs" {
1667
1869
  * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
1668
1870
  * @since v14.14.0
1669
1871
  */
1670
- export function rmSync(path: PathLike, options?: RmOptions): void;
1671
- export interface MakeDirectoryOptions {
1872
+ function rmSync(path: PathLike, options?: RmOptions): void;
1873
+ interface MakeDirectoryOptions {
1672
1874
  /**
1673
1875
  * Indicates whether parent folders should be created.
1674
1876
  * If a folder was created, the path to the first created folder will be returned.
@@ -1717,7 +1919,7 @@ declare module "_not-use-node-type_fs" {
1717
1919
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1718
1920
  * @since v0.1.8
1719
1921
  */
1720
- export function mkdir(
1922
+ function mkdir(
1721
1923
  path: PathLike,
1722
1924
  options: MakeDirectoryOptions & {
1723
1925
  recursive: true;
@@ -1730,7 +1932,7 @@ declare module "_not-use-node-type_fs" {
1730
1932
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1731
1933
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1732
1934
  */
1733
- export function mkdir(
1935
+ function mkdir(
1734
1936
  path: PathLike,
1735
1937
  options:
1736
1938
  | Mode
@@ -1747,7 +1949,7 @@ declare module "_not-use-node-type_fs" {
1747
1949
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1748
1950
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1749
1951
  */
1750
- export function mkdir(
1952
+ function mkdir(
1751
1953
  path: PathLike,
1752
1954
  options: Mode | MakeDirectoryOptions | null | undefined,
1753
1955
  callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
@@ -1756,8 +1958,8 @@ declare module "_not-use-node-type_fs" {
1756
1958
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
1757
1959
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1758
1960
  */
1759
- export function mkdir(path: PathLike, callback: NoParamCallback): void;
1760
- export namespace mkdir {
1961
+ function mkdir(path: PathLike, callback: NoParamCallback): void;
1962
+ namespace mkdir {
1761
1963
  /**
1762
1964
  * Asynchronous mkdir(2) - create a directory.
1763
1965
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1803,7 +2005,7 @@ declare module "_not-use-node-type_fs" {
1803
2005
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1804
2006
  * @since v0.1.21
1805
2007
  */
1806
- export function mkdirSync(
2008
+ function mkdirSync(
1807
2009
  path: PathLike,
1808
2010
  options: MakeDirectoryOptions & {
1809
2011
  recursive: true;
@@ -1815,7 +2017,7 @@ declare module "_not-use-node-type_fs" {
1815
2017
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1816
2018
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1817
2019
  */
1818
- export function mkdirSync(
2020
+ function mkdirSync(
1819
2021
  path: PathLike,
1820
2022
  options?:
1821
2023
  | Mode
@@ -1830,7 +2032,7 @@ declare module "_not-use-node-type_fs" {
1830
2032
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1831
2033
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1832
2034
  */
1833
- export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
2035
+ function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
1834
2036
  /**
1835
2037
  * Creates a unique temporary directory.
1836
2038
  *
@@ -1890,7 +2092,7 @@ declare module "_not-use-node-type_fs" {
1890
2092
  * ```
1891
2093
  * @since v5.10.0
1892
2094
  */
1893
- export function mkdtemp(
2095
+ function mkdtemp(
1894
2096
  prefix: string,
1895
2097
  options: EncodingOption,
1896
2098
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
@@ -1900,34 +2102,30 @@ declare module "_not-use-node-type_fs" {
1900
2102
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1901
2103
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1902
2104
  */
1903
- export function mkdtemp(
2105
+ function mkdtemp(
1904
2106
  prefix: string,
1905
- options:
1906
- | "buffer"
1907
- | {
1908
- encoding: "buffer";
1909
- },
1910
- callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
2107
+ options: BufferEncodingOption,
2108
+ callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
1911
2109
  ): void;
1912
2110
  /**
1913
2111
  * Asynchronously creates a unique temporary directory.
1914
2112
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1915
2113
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1916
2114
  */
1917
- export function mkdtemp(
2115
+ function mkdtemp(
1918
2116
  prefix: string,
1919
2117
  options: EncodingOption,
1920
- callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void,
2118
+ callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
1921
2119
  ): void;
1922
2120
  /**
1923
2121
  * Asynchronously creates a unique temporary directory.
1924
2122
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1925
2123
  */
1926
- export function mkdtemp(
2124
+ function mkdtemp(
1927
2125
  prefix: string,
1928
2126
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
1929
2127
  ): void;
1930
- export namespace mkdtemp {
2128
+ namespace mkdtemp {
1931
2129
  /**
1932
2130
  * Asynchronously creates a unique temporary directory.
1933
2131
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -1939,13 +2137,13 @@ declare module "_not-use-node-type_fs" {
1939
2137
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1940
2138
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1941
2139
  */
1942
- function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
2140
+ function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1943
2141
  /**
1944
2142
  * Asynchronously creates a unique temporary directory.
1945
2143
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1946
2144
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1947
2145
  */
1948
- function __promisify__(prefix: string, options?: EncodingOption): Promise<string | Buffer>;
2146
+ function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1949
2147
  }
1950
2148
  /**
1951
2149
  * Returns the created directory path.
@@ -1957,19 +2155,52 @@ declare module "_not-use-node-type_fs" {
1957
2155
  * object with an `encoding` property specifying the character encoding to use.
1958
2156
  * @since v5.10.0
1959
2157
  */
1960
- export function mkdtempSync(prefix: string, options?: EncodingOption): string;
2158
+ function mkdtempSync(prefix: string, options?: EncodingOption): string;
1961
2159
  /**
1962
2160
  * Synchronously creates a unique temporary directory.
1963
2161
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1964
2162
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1965
2163
  */
1966
- export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
2164
+ function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
1967
2165
  /**
1968
2166
  * Synchronously creates a unique temporary directory.
1969
2167
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1970
2168
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1971
2169
  */
1972
- export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
2170
+ function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2171
+ interface DisposableTempDir extends Disposable {
2172
+ /**
2173
+ * The path of the created directory.
2174
+ */
2175
+ path: string;
2176
+ /**
2177
+ * A function which removes the created directory.
2178
+ */
2179
+ remove(): void;
2180
+ /**
2181
+ * The same as `remove`.
2182
+ */
2183
+ [Symbol.dispose](): void;
2184
+ }
2185
+ /**
2186
+ * Returns a disposable object whose `path` property holds the created directory
2187
+ * path. When the object is disposed, the directory and its contents will be
2188
+ * removed if it still exists. If the directory cannot be deleted, disposal will
2189
+ * throw an error. The object has a `remove()` method which will perform the same
2190
+ * task.
2191
+ *
2192
+ * <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
2193
+ *
2194
+ * For detailed information, see the documentation of `fs.mkdtemp()`.
2195
+ *
2196
+ * There is no callback-based version of this API because it is designed for use
2197
+ * with the `using` syntax.
2198
+ *
2199
+ * The optional `options` argument can be a string specifying an encoding, or an
2200
+ * object with an `encoding` property specifying the character encoding to use.
2201
+ * @since v24.4.0
2202
+ */
2203
+ function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
1973
2204
  /**
1974
2205
  * Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`.
1975
2206
  *
@@ -1983,7 +2214,7 @@ declare module "_not-use-node-type_fs" {
1983
2214
  * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
1984
2215
  * @since v0.1.8
1985
2216
  */
1986
- export function readdir(
2217
+ function readdir(
1987
2218
  path: PathLike,
1988
2219
  options:
1989
2220
  | {
@@ -2001,7 +2232,7 @@ declare module "_not-use-node-type_fs" {
2001
2232
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2002
2233
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2003
2234
  */
2004
- export function readdir(
2235
+ function readdir(
2005
2236
  path: PathLike,
2006
2237
  options:
2007
2238
  | {
@@ -2010,14 +2241,14 @@ declare module "_not-use-node-type_fs" {
2010
2241
  recursive?: boolean | undefined;
2011
2242
  }
2012
2243
  | "buffer",
2013
- callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void,
2244
+ callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
2014
2245
  ): void;
2015
2246
  /**
2016
2247
  * Asynchronous readdir(3) - read a directory.
2017
2248
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2018
2249
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2019
2250
  */
2020
- export function readdir(
2251
+ function readdir(
2021
2252
  path: PathLike,
2022
2253
  options:
2023
2254
  | (ObjectEncodingOptions & {
@@ -2027,13 +2258,13 @@ declare module "_not-use-node-type_fs" {
2027
2258
  | BufferEncoding
2028
2259
  | undefined
2029
2260
  | null,
2030
- callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
2261
+ callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
2031
2262
  ): void;
2032
2263
  /**
2033
2264
  * Asynchronous readdir(3) - read a directory.
2034
2265
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2035
2266
  */
2036
- export function readdir(
2267
+ function readdir(
2037
2268
  path: PathLike,
2038
2269
  callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
2039
2270
  ): void;
@@ -2042,7 +2273,7 @@ declare module "_not-use-node-type_fs" {
2042
2273
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2043
2274
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2044
2275
  */
2045
- export function readdir(
2276
+ function readdir(
2046
2277
  path: PathLike,
2047
2278
  options: ObjectEncodingOptions & {
2048
2279
  withFileTypes: true;
@@ -2055,16 +2286,16 @@ declare module "_not-use-node-type_fs" {
2055
2286
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2056
2287
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2057
2288
  */
2058
- export function readdir(
2289
+ function readdir(
2059
2290
  path: PathLike,
2060
2291
  options: {
2061
2292
  encoding: "buffer";
2062
2293
  withFileTypes: true;
2063
2294
  recursive?: boolean | undefined;
2064
2295
  },
2065
- callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void,
2296
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
2066
2297
  ): void;
2067
- export namespace readdir {
2298
+ namespace readdir {
2068
2299
  /**
2069
2300
  * Asynchronous readdir(3) - read a directory.
2070
2301
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2095,7 +2326,7 @@ declare module "_not-use-node-type_fs" {
2095
2326
  withFileTypes?: false | undefined;
2096
2327
  recursive?: boolean | undefined;
2097
2328
  },
2098
- ): Promise<Buffer[]>;
2329
+ ): Promise<NonSharedBuffer[]>;
2099
2330
  /**
2100
2331
  * Asynchronous readdir(3) - read a directory.
2101
2332
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2110,7 +2341,7 @@ declare module "_not-use-node-type_fs" {
2110
2341
  })
2111
2342
  | BufferEncoding
2112
2343
  | null,
2113
- ): Promise<string[] | Buffer[]>;
2344
+ ): Promise<string[] | NonSharedBuffer[]>;
2114
2345
  /**
2115
2346
  * Asynchronous readdir(3) - read a directory.
2116
2347
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2135,7 +2366,7 @@ declare module "_not-use-node-type_fs" {
2135
2366
  withFileTypes: true;
2136
2367
  recursive?: boolean | undefined;
2137
2368
  },
2138
- ): Promise<Dirent<Buffer>[]>;
2369
+ ): Promise<Dirent<NonSharedBuffer>[]>;
2139
2370
  }
2140
2371
  /**
2141
2372
  * Reads the contents of the directory.
@@ -2150,7 +2381,7 @@ declare module "_not-use-node-type_fs" {
2150
2381
  * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
2151
2382
  * @since v0.1.21
2152
2383
  */
2153
- export function readdirSync(
2384
+ function readdirSync(
2154
2385
  path: PathLike,
2155
2386
  options?:
2156
2387
  | {
@@ -2166,7 +2397,7 @@ declare module "_not-use-node-type_fs" {
2166
2397
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2167
2398
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2168
2399
  */
2169
- export function readdirSync(
2400
+ function readdirSync(
2170
2401
  path: PathLike,
2171
2402
  options:
2172
2403
  | {
@@ -2175,13 +2406,13 @@ declare module "_not-use-node-type_fs" {
2175
2406
  recursive?: boolean | undefined;
2176
2407
  }
2177
2408
  | "buffer",
2178
- ): Buffer[];
2409
+ ): NonSharedBuffer[];
2179
2410
  /**
2180
2411
  * Synchronous readdir(3) - read a directory.
2181
2412
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2182
2413
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2183
2414
  */
2184
- export function readdirSync(
2415
+ function readdirSync(
2185
2416
  path: PathLike,
2186
2417
  options?:
2187
2418
  | (ObjectEncodingOptions & {
@@ -2190,13 +2421,13 @@ declare module "_not-use-node-type_fs" {
2190
2421
  })
2191
2422
  | BufferEncoding
2192
2423
  | null,
2193
- ): string[] | Buffer[];
2424
+ ): string[] | NonSharedBuffer[];
2194
2425
  /**
2195
2426
  * Synchronous readdir(3) - read a directory.
2196
2427
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2197
2428
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2198
2429
  */
2199
- export function readdirSync(
2430
+ function readdirSync(
2200
2431
  path: PathLike,
2201
2432
  options: ObjectEncodingOptions & {
2202
2433
  withFileTypes: true;
@@ -2208,14 +2439,14 @@ declare module "_not-use-node-type_fs" {
2208
2439
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2209
2440
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2210
2441
  */
2211
- export function readdirSync(
2442
+ function readdirSync(
2212
2443
  path: PathLike,
2213
2444
  options: {
2214
2445
  encoding: "buffer";
2215
2446
  withFileTypes: true;
2216
2447
  recursive?: boolean | undefined;
2217
2448
  },
2218
- ): Dirent<Buffer>[];
2449
+ ): Dirent<NonSharedBuffer>[];
2219
2450
  /**
2220
2451
  * Closes the file descriptor. No arguments other than a possible exception are
2221
2452
  * given to the completion callback.
@@ -2226,8 +2457,8 @@ declare module "_not-use-node-type_fs" {
2226
2457
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2227
2458
  * @since v0.0.2
2228
2459
  */
2229
- export function close(fd: number, callback?: NoParamCallback): void;
2230
- export namespace close {
2460
+ function close(fd: number, callback?: NoParamCallback): void;
2461
+ namespace close {
2231
2462
  /**
2232
2463
  * Asynchronous close(2) - close a file descriptor.
2233
2464
  * @param fd A file descriptor.
@@ -2243,7 +2474,7 @@ declare module "_not-use-node-type_fs" {
2243
2474
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2244
2475
  * @since v0.1.21
2245
2476
  */
2246
- export function closeSync(fd: number): void;
2477
+ function closeSync(fd: number): void;
2247
2478
  /**
2248
2479
  * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
2249
2480
  *
@@ -2261,7 +2492,7 @@ declare module "_not-use-node-type_fs" {
2261
2492
  * @param [flags='r'] See `support of file system `flags``.
2262
2493
  * @param [mode=0o666]
2263
2494
  */
2264
- export function open(
2495
+ function open(
2265
2496
  path: PathLike,
2266
2497
  flags: OpenMode | undefined,
2267
2498
  mode: Mode | undefined | null,
@@ -2272,7 +2503,7 @@ declare module "_not-use-node-type_fs" {
2272
2503
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2273
2504
  * @param [flags='r'] See `support of file system `flags``.
2274
2505
  */
2275
- export function open(
2506
+ function open(
2276
2507
  path: PathLike,
2277
2508
  flags: OpenMode | undefined,
2278
2509
  callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
@@ -2281,8 +2512,8 @@ declare module "_not-use-node-type_fs" {
2281
2512
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2282
2513
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2283
2514
  */
2284
- export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2285
- export namespace open {
2515
+ function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2516
+ namespace open {
2286
2517
  /**
2287
2518
  * Asynchronous open(2) - open and possibly create a file.
2288
2519
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2299,7 +2530,7 @@ declare module "_not-use-node-type_fs" {
2299
2530
  * @param [flags='r']
2300
2531
  * @param [mode=0o666]
2301
2532
  */
2302
- export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2533
+ function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2303
2534
  /**
2304
2535
  * Change the file system timestamps of the object referenced by `path`.
2305
2536
  *
@@ -2309,8 +2540,8 @@ declare module "_not-use-node-type_fs" {
2309
2540
  * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
2310
2541
  * @since v0.4.2
2311
2542
  */
2312
- export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2313
- export namespace utimes {
2543
+ function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2544
+ namespace utimes {
2314
2545
  /**
2315
2546
  * Asynchronously change file timestamps of the file referenced by the supplied path.
2316
2547
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2326,14 +2557,14 @@ declare module "_not-use-node-type_fs" {
2326
2557
  * this API: {@link utimes}.
2327
2558
  * @since v0.4.2
2328
2559
  */
2329
- export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2560
+ function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2330
2561
  /**
2331
2562
  * Change the file system timestamps of the object referenced by the supplied file
2332
2563
  * descriptor. See {@link utimes}.
2333
2564
  * @since v0.4.2
2334
2565
  */
2335
- export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2336
- export namespace futimes {
2566
+ function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2567
+ namespace futimes {
2337
2568
  /**
2338
2569
  * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
2339
2570
  * @param fd A file descriptor.
@@ -2346,7 +2577,7 @@ declare module "_not-use-node-type_fs" {
2346
2577
  * Synchronous version of {@link futimes}. Returns `undefined`.
2347
2578
  * @since v0.4.2
2348
2579
  */
2349
- export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2580
+ function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2350
2581
  /**
2351
2582
  * Request that all data for the open file descriptor is flushed to the storage
2352
2583
  * device. The specific implementation is operating system and device specific.
@@ -2354,8 +2585,8 @@ declare module "_not-use-node-type_fs" {
2354
2585
  * than a possible exception are given to the completion callback.
2355
2586
  * @since v0.1.96
2356
2587
  */
2357
- export function fsync(fd: number, callback: NoParamCallback): void;
2358
- export namespace fsync {
2588
+ function fsync(fd: number, callback: NoParamCallback): void;
2589
+ namespace fsync {
2359
2590
  /**
2360
2591
  * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
2361
2592
  * @param fd A file descriptor.
@@ -2368,8 +2599,8 @@ declare module "_not-use-node-type_fs" {
2368
2599
  * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
2369
2600
  * @since v0.1.96
2370
2601
  */
2371
- export function fsyncSync(fd: number): void;
2372
- export interface WriteOptions {
2602
+ function fsyncSync(fd: number): void;
2603
+ interface WriteOptions {
2373
2604
  /**
2374
2605
  * @default 0
2375
2606
  */
@@ -2381,7 +2612,7 @@ declare module "_not-use-node-type_fs" {
2381
2612
  /**
2382
2613
  * @default null
2383
2614
  */
2384
- position?: number | undefined | null;
2615
+ position?: number | null | undefined;
2385
2616
  }
2386
2617
  /**
2387
2618
  * Write `buffer` to the file specified by `fd`.
@@ -2410,7 +2641,7 @@ declare module "_not-use-node-type_fs" {
2410
2641
  * @param [length=buffer.byteLength - offset]
2411
2642
  * @param [position='null']
2412
2643
  */
2413
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2644
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2414
2645
  fd: number,
2415
2646
  buffer: TBuffer,
2416
2647
  offset: number | undefined | null,
@@ -2424,7 +2655,7 @@ declare module "_not-use-node-type_fs" {
2424
2655
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2425
2656
  * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2426
2657
  */
2427
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2658
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2428
2659
  fd: number,
2429
2660
  buffer: TBuffer,
2430
2661
  offset: number | undefined | null,
@@ -2436,7 +2667,7 @@ declare module "_not-use-node-type_fs" {
2436
2667
  * @param fd A file descriptor.
2437
2668
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2438
2669
  */
2439
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2670
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2440
2671
  fd: number,
2441
2672
  buffer: TBuffer,
2442
2673
  offset: number | undefined | null,
@@ -2446,7 +2677,7 @@ declare module "_not-use-node-type_fs" {
2446
2677
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2447
2678
  * @param fd A file descriptor.
2448
2679
  */
2449
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2680
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2450
2681
  fd: number,
2451
2682
  buffer: TBuffer,
2452
2683
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
@@ -2459,7 +2690,7 @@ declare module "_not-use-node-type_fs" {
2459
2690
  * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2460
2691
  * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2461
2692
  */
2462
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2693
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2463
2694
  fd: number,
2464
2695
  buffer: TBuffer,
2465
2696
  options: WriteOptions,
@@ -2472,7 +2703,7 @@ declare module "_not-use-node-type_fs" {
2472
2703
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2473
2704
  * @param encoding The expected string encoding.
2474
2705
  */
2475
- export function write(
2706
+ function write(
2476
2707
  fd: number,
2477
2708
  string: string,
2478
2709
  position: number | undefined | null,
@@ -2485,7 +2716,7 @@ declare module "_not-use-node-type_fs" {
2485
2716
  * @param string A string to write.
2486
2717
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2487
2718
  */
2488
- export function write(
2719
+ function write(
2489
2720
  fd: number,
2490
2721
  string: string,
2491
2722
  position: number | undefined | null,
@@ -2496,12 +2727,12 @@ declare module "_not-use-node-type_fs" {
2496
2727
  * @param fd A file descriptor.
2497
2728
  * @param string A string to write.
2498
2729
  */
2499
- export function write(
2730
+ function write(
2500
2731
  fd: number,
2501
2732
  string: string,
2502
2733
  callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
2503
2734
  ): void;
2504
- export namespace write {
2735
+ namespace write {
2505
2736
  /**
2506
2737
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2507
2738
  * @param fd A file descriptor.
@@ -2561,7 +2792,7 @@ declare module "_not-use-node-type_fs" {
2561
2792
  * @param [position='null']
2562
2793
  * @return The number of bytes written.
2563
2794
  */
2564
- export function writeSync(
2795
+ function writeSync(
2565
2796
  fd: number,
2566
2797
  buffer: NodeJS.ArrayBufferView,
2567
2798
  offset?: number | null,
@@ -2575,14 +2806,14 @@ declare module "_not-use-node-type_fs" {
2575
2806
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2576
2807
  * @param encoding The expected string encoding.
2577
2808
  */
2578
- export function writeSync(
2809
+ function writeSync(
2579
2810
  fd: number,
2580
2811
  string: string,
2581
2812
  position?: number | null,
2582
2813
  encoding?: BufferEncoding | null,
2583
2814
  ): number;
2584
- export type ReadPosition = number | bigint;
2585
- export interface ReadSyncOptions {
2815
+ type ReadPosition = number | bigint;
2816
+ interface ReadOptions {
2586
2817
  /**
2587
2818
  * @default 0
2588
2819
  */
@@ -2596,9 +2827,15 @@ declare module "_not-use-node-type_fs" {
2596
2827
  */
2597
2828
  position?: ReadPosition | null | undefined;
2598
2829
  }
2599
- export interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> extends ReadSyncOptions {
2600
- buffer?: TBuffer;
2830
+ interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2831
+ buffer?: T | undefined;
2601
2832
  }
2833
+ /** @deprecated Use `ReadOptions` instead. */
2834
+ // TODO: remove in future major
2835
+ interface ReadSyncOptions extends ReadOptions {}
2836
+ /** @deprecated Use `ReadOptionsWithBuffer` instead. */
2837
+ // TODO: remove in future major
2838
+ interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2602
2839
  /**
2603
2840
  * Read data from the file specified by `fd`.
2604
2841
  *
@@ -2616,7 +2853,7 @@ declare module "_not-use-node-type_fs" {
2616
2853
  * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
2617
2854
  * `position` is an integer, the file position will be unchanged.
2618
2855
  */
2619
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2856
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2620
2857
  fd: number,
2621
2858
  buffer: TBuffer,
2622
2859
  offset: number,
@@ -2633,27 +2870,27 @@ declare module "_not-use-node-type_fs" {
2633
2870
  * `position` defaults to `null`
2634
2871
  * @since v12.17.0, 13.11.0
2635
2872
  */
2636
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2873
+ function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2637
2874
  fd: number,
2638
- options: ReadAsyncOptions<TBuffer>,
2875
+ options: ReadOptionsWithBuffer<TBuffer>,
2639
2876
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2640
2877
  ): void;
2641
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2878
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2642
2879
  fd: number,
2643
2880
  buffer: TBuffer,
2644
- options: ReadSyncOptions,
2881
+ options: ReadOptions,
2645
2882
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2646
2883
  ): void;
2647
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2884
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2648
2885
  fd: number,
2649
2886
  buffer: TBuffer,
2650
2887
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2651
2888
  ): void;
2652
- export function read(
2889
+ function read(
2653
2890
  fd: number,
2654
- callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void,
2891
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
2655
2892
  ): void;
2656
- export namespace read {
2893
+ namespace read {
2657
2894
  /**
2658
2895
  * @param fd A file descriptor.
2659
2896
  * @param buffer The buffer that the data will be written to.
@@ -2671,16 +2908,16 @@ declare module "_not-use-node-type_fs" {
2671
2908
  bytesRead: number;
2672
2909
  buffer: TBuffer;
2673
2910
  }>;
2674
- function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2911
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2675
2912
  fd: number,
2676
- options: ReadAsyncOptions<TBuffer>,
2913
+ options: ReadOptionsWithBuffer<TBuffer>,
2677
2914
  ): Promise<{
2678
2915
  bytesRead: number;
2679
2916
  buffer: TBuffer;
2680
2917
  }>;
2681
2918
  function __promisify__(fd: number): Promise<{
2682
2919
  bytesRead: number;
2683
- buffer: NodeJS.ArrayBufferView;
2920
+ buffer: NonSharedBuffer;
2684
2921
  }>;
2685
2922
  }
2686
2923
  /**
@@ -2691,7 +2928,7 @@ declare module "_not-use-node-type_fs" {
2691
2928
  * @since v0.1.21
2692
2929
  * @param [position='null']
2693
2930
  */
2694
- export function readSync(
2931
+ function readSync(
2695
2932
  fd: number,
2696
2933
  buffer: NodeJS.ArrayBufferView,
2697
2934
  offset: number,
@@ -2702,7 +2939,7 @@ declare module "_not-use-node-type_fs" {
2702
2939
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
2703
2940
  * If no `options` object is specified, it will default with the above values.
2704
2941
  */
2705
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
2942
+ function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
2706
2943
  /**
2707
2944
  * Asynchronously reads the entire contents of a file.
2708
2945
  *
@@ -2769,7 +3006,7 @@ declare module "_not-use-node-type_fs" {
2769
3006
  * @since v0.1.29
2770
3007
  * @param path filename or file descriptor
2771
3008
  */
2772
- export function readFile(
3009
+ function readFile(
2773
3010
  path: PathOrFileDescriptor,
2774
3011
  options:
2775
3012
  | ({
@@ -2787,7 +3024,7 @@ declare module "_not-use-node-type_fs" {
2787
3024
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2788
3025
  * If a flag is not provided, it defaults to `'r'`.
2789
3026
  */
2790
- export function readFile(
3027
+ function readFile(
2791
3028
  path: PathOrFileDescriptor,
2792
3029
  options:
2793
3030
  | ({
@@ -2804,7 +3041,7 @@ declare module "_not-use-node-type_fs" {
2804
3041
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2805
3042
  * If a flag is not provided, it defaults to `'r'`.
2806
3043
  */
2807
- export function readFile(
3044
+ function readFile(
2808
3045
  path: PathOrFileDescriptor,
2809
3046
  options:
2810
3047
  | (ObjectEncodingOptions & {
@@ -2820,11 +3057,11 @@ declare module "_not-use-node-type_fs" {
2820
3057
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2821
3058
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2822
3059
  */
2823
- export function readFile(
3060
+ function readFile(
2824
3061
  path: PathOrFileDescriptor,
2825
3062
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2826
3063
  ): void;
2827
- export namespace readFile {
3064
+ namespace readFile {
2828
3065
  /**
2829
3066
  * Asynchronously reads the entire contents of a file.
2830
3067
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2898,7 +3135,7 @@ declare module "_not-use-node-type_fs" {
2898
3135
  * @since v0.1.8
2899
3136
  * @param path filename or file descriptor
2900
3137
  */
2901
- export function readFileSync(
3138
+ function readFileSync(
2902
3139
  path: PathOrFileDescriptor,
2903
3140
  options?: {
2904
3141
  encoding?: null | undefined;
@@ -2912,7 +3149,7 @@ declare module "_not-use-node-type_fs" {
2912
3149
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2913
3150
  * If a flag is not provided, it defaults to `'r'`.
2914
3151
  */
2915
- export function readFileSync(
3152
+ function readFileSync(
2916
3153
  path: PathOrFileDescriptor,
2917
3154
  options:
2918
3155
  | {
@@ -2928,7 +3165,7 @@ declare module "_not-use-node-type_fs" {
2928
3165
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2929
3166
  * If a flag is not provided, it defaults to `'r'`.
2930
3167
  */
2931
- export function readFileSync(
3168
+ function readFileSync(
2932
3169
  path: PathOrFileDescriptor,
2933
3170
  options?:
2934
3171
  | (ObjectEncodingOptions & {
@@ -2937,7 +3174,7 @@ declare module "_not-use-node-type_fs" {
2937
3174
  | BufferEncoding
2938
3175
  | null,
2939
3176
  ): string | NonSharedBuffer;
2940
- export type WriteFileOptions =
3177
+ type WriteFileOptions =
2941
3178
  | (
2942
3179
  & ObjectEncodingOptions
2943
3180
  & Abortable
@@ -3010,7 +3247,7 @@ declare module "_not-use-node-type_fs" {
3010
3247
  * @since v0.1.29
3011
3248
  * @param file filename or file descriptor
3012
3249
  */
3013
- export function writeFile(
3250
+ function writeFile(
3014
3251
  file: PathOrFileDescriptor,
3015
3252
  data: string | NodeJS.ArrayBufferView,
3016
3253
  options: WriteFileOptions,
@@ -3022,12 +3259,12 @@ declare module "_not-use-node-type_fs" {
3022
3259
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3023
3260
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3024
3261
  */
3025
- export function writeFile(
3262
+ function writeFile(
3026
3263
  path: PathOrFileDescriptor,
3027
3264
  data: string | NodeJS.ArrayBufferView,
3028
3265
  callback: NoParamCallback,
3029
3266
  ): void;
3030
- export namespace writeFile {
3267
+ namespace writeFile {
3031
3268
  /**
3032
3269
  * Asynchronously writes data to a file, replacing the file if it already exists.
3033
3270
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3056,7 +3293,7 @@ declare module "_not-use-node-type_fs" {
3056
3293
  * @since v0.1.29
3057
3294
  * @param file filename or file descriptor
3058
3295
  */
3059
- export function writeFileSync(
3296
+ function writeFileSync(
3060
3297
  file: PathOrFileDescriptor,
3061
3298
  data: string | NodeJS.ArrayBufferView,
3062
3299
  options?: WriteFileOptions,
@@ -3114,7 +3351,7 @@ declare module "_not-use-node-type_fs" {
3114
3351
  * @since v0.6.7
3115
3352
  * @param path filename or file descriptor
3116
3353
  */
3117
- export function appendFile(
3354
+ function appendFile(
3118
3355
  path: PathOrFileDescriptor,
3119
3356
  data: string | Uint8Array,
3120
3357
  options: WriteFileOptions,
@@ -3126,8 +3363,8 @@ declare module "_not-use-node-type_fs" {
3126
3363
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3127
3364
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3128
3365
  */
3129
- export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3130
- export namespace appendFile {
3366
+ function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3367
+ namespace appendFile {
3131
3368
  /**
3132
3369
  * Asynchronously append data to a file, creating the file if it does not exist.
3133
3370
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3193,7 +3430,7 @@ declare module "_not-use-node-type_fs" {
3193
3430
  * @since v0.6.7
3194
3431
  * @param path filename or file descriptor
3195
3432
  */
3196
- export function appendFileSync(
3433
+ function appendFileSync(
3197
3434
  path: PathOrFileDescriptor,
3198
3435
  data: string | Uint8Array,
3199
3436
  options?: WriteFileOptions,
@@ -3244,7 +3481,7 @@ declare module "_not-use-node-type_fs" {
3244
3481
  * * the file is renamed and then renamed a second time back to its original name
3245
3482
  * @since v0.1.31
3246
3483
  */
3247
- export interface WatchFileOptions {
3484
+ interface WatchFileOptions {
3248
3485
  bigint?: boolean | undefined;
3249
3486
  persistent?: boolean | undefined;
3250
3487
  interval?: number | undefined;
@@ -3295,7 +3532,7 @@ declare module "_not-use-node-type_fs" {
3295
3532
  * * the file is renamed and then renamed a second time back to its original name
3296
3533
  * @since v0.1.31
3297
3534
  */
3298
- export function watchFile(
3535
+ function watchFile(
3299
3536
  filename: PathLike,
3300
3537
  options:
3301
3538
  | (WatchFileOptions & {
@@ -3304,7 +3541,7 @@ declare module "_not-use-node-type_fs" {
3304
3541
  | undefined,
3305
3542
  listener: StatsListener,
3306
3543
  ): StatWatcher;
3307
- export function watchFile(
3544
+ function watchFile(
3308
3545
  filename: PathLike,
3309
3546
  options:
3310
3547
  | (WatchFileOptions & {
@@ -3317,7 +3554,7 @@ declare module "_not-use-node-type_fs" {
3317
3554
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
3318
3555
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3319
3556
  */
3320
- export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3557
+ function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3321
3558
  /**
3322
3559
  * Stop watching for changes on `filename`. If `listener` is specified, only that
3323
3560
  * particular listener is removed. Otherwise, _all_ listeners are removed,
@@ -3330,17 +3567,23 @@ declare module "_not-use-node-type_fs" {
3330
3567
  * @since v0.1.31
3331
3568
  * @param listener Optional, a listener previously attached using `fs.watchFile()`
3332
3569
  */
3333
- export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3334
- export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3335
- export interface WatchOptions extends Abortable {
3570
+ function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3571
+ function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3572
+ interface WatchOptions extends Abortable {
3336
3573
  encoding?: BufferEncoding | "buffer" | undefined;
3337
3574
  persistent?: boolean | undefined;
3338
3575
  recursive?: boolean | undefined;
3339
3576
  }
3340
- export type WatchEventType = "rename" | "change";
3341
- export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3342
- export type StatsListener = (curr: Stats, prev: Stats) => void;
3343
- export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3577
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
3578
+ encoding: "buffer";
3579
+ }
3580
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
3581
+ encoding?: BufferEncoding | undefined;
3582
+ }
3583
+ type WatchEventType = "rename" | "change";
3584
+ type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3585
+ type StatsListener = (curr: Stats, prev: Stats) => void;
3586
+ type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3344
3587
  /**
3345
3588
  * Watch for changes on `filename`, where `filename` is either a file or a
3346
3589
  * directory.
@@ -3361,46 +3604,22 @@ declare module "_not-use-node-type_fs" {
3361
3604
  * @since v0.5.10
3362
3605
  * @param listener
3363
3606
  */
3364
- export function watch(
3607
+ function watch(
3365
3608
  filename: PathLike,
3366
- options:
3367
- | (WatchOptions & {
3368
- encoding: "buffer";
3369
- })
3370
- | "buffer",
3371
- listener?: WatchListener<Buffer>,
3609
+ options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
3610
+ listener?: WatchListener<string>,
3372
3611
  ): FSWatcher;
3373
- /**
3374
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3375
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3376
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
3377
- * If `encoding` is not supplied, the default of `'utf8'` is used.
3378
- * If `persistent` is not supplied, the default of `true` is used.
3379
- * If `recursive` is not supplied, the default of `false` is used.
3380
- */
3381
- export function watch(
3612
+ function watch(
3382
3613
  filename: PathLike,
3383
- options?: WatchOptions | BufferEncoding | null,
3384
- listener?: WatchListener<string>,
3614
+ options: WatchOptionsWithBufferEncoding | "buffer",
3615
+ listener: WatchListener<NonSharedBuffer>,
3385
3616
  ): FSWatcher;
3386
- /**
3387
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3388
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3389
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
3390
- * If `encoding` is not supplied, the default of `'utf8'` is used.
3391
- * If `persistent` is not supplied, the default of `true` is used.
3392
- * If `recursive` is not supplied, the default of `false` is used.
3393
- */
3394
- export function watch(
3617
+ function watch(
3395
3618
  filename: PathLike,
3396
- options: WatchOptions | string,
3397
- listener?: WatchListener<string | Buffer>,
3619
+ options: WatchOptions | BufferEncoding | "buffer" | null,
3620
+ listener: WatchListener<string | NonSharedBuffer>,
3398
3621
  ): FSWatcher;
3399
- /**
3400
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3401
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3402
- */
3403
- export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
3622
+ function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3404
3623
  /**
3405
3624
  * Test whether or not the given path exists by checking with the file system.
3406
3625
  * Then call the `callback` argument with either true or false:
@@ -3530,9 +3749,9 @@ declare module "_not-use-node-type_fs" {
3530
3749
  * @since v0.0.2
3531
3750
  * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
3532
3751
  */
3533
- export function exists(path: PathLike, callback: (exists: boolean) => void): void;
3752
+ function exists(path: PathLike, callback: (exists: boolean) => void): void;
3534
3753
  /** @deprecated */
3535
- export namespace exists {
3754
+ namespace exists {
3536
3755
  /**
3537
3756
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3538
3757
  * URL support is _experimental_.
@@ -3556,8 +3775,8 @@ declare module "_not-use-node-type_fs" {
3556
3775
  * ```
3557
3776
  * @since v0.1.21
3558
3777
  */
3559
- export function existsSync(path: PathLike): boolean;
3560
- export namespace constants {
3778
+ function existsSync(path: PathLike): boolean;
3779
+ namespace constants {
3561
3780
  // File Access Constants
3562
3781
  /** Constant for fs.access(). File is visible to the calling process. */
3563
3782
  const F_OK: number;
@@ -3831,13 +4050,13 @@ declare module "_not-use-node-type_fs" {
3831
4050
  * @since v0.11.15
3832
4051
  * @param [mode=fs.constants.F_OK]
3833
4052
  */
3834
- export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
4053
+ function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
3835
4054
  /**
3836
4055
  * Asynchronously tests a user's permissions for the file specified by path.
3837
4056
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3838
4057
  */
3839
- export function access(path: PathLike, callback: NoParamCallback): void;
3840
- export namespace access {
4058
+ function access(path: PathLike, callback: NoParamCallback): void;
4059
+ namespace access {
3841
4060
  /**
3842
4061
  * Asynchronously tests a user's permissions for the file specified by path.
3843
4062
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -3868,11 +4087,11 @@ declare module "_not-use-node-type_fs" {
3868
4087
  * @since v0.11.15
3869
4088
  * @param [mode=fs.constants.F_OK]
3870
4089
  */
3871
- export function accessSync(path: PathLike, mode?: number): void;
4090
+ function accessSync(path: PathLike, mode?: number): void;
3872
4091
  interface StreamOptions {
3873
4092
  flags?: string | undefined;
3874
4093
  encoding?: BufferEncoding | undefined;
3875
- fd?: number | promises.FileHandle | undefined;
4094
+ fd?: number | FileHandle | undefined;
3876
4095
  mode?: number | undefined;
3877
4096
  autoClose?: boolean | undefined;
3878
4097
  emitClose?: boolean | undefined;
@@ -3960,7 +4179,7 @@ declare module "_not-use-node-type_fs" {
3960
4179
  * If `options` is a string, then it specifies the encoding.
3961
4180
  * @since v0.1.31
3962
4181
  */
3963
- export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
4182
+ function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
3964
4183
  /**
3965
4184
  * `options` may also include a `start` option to allow writing data at some
3966
4185
  * position past the beginning of the file, allowed values are in the
@@ -3988,7 +4207,7 @@ declare module "_not-use-node-type_fs" {
3988
4207
  * If `options` is a string, then it specifies the encoding.
3989
4208
  * @since v0.1.31
3990
4209
  */
3991
- export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
4210
+ function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
3992
4211
  /**
3993
4212
  * Forces all currently queued I/O operations associated with the file to the
3994
4213
  * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other
@@ -3996,8 +4215,8 @@ declare module "_not-use-node-type_fs" {
3996
4215
  * exception are given to the completion callback.
3997
4216
  * @since v0.1.96
3998
4217
  */
3999
- export function fdatasync(fd: number, callback: NoParamCallback): void;
4000
- export namespace fdatasync {
4218
+ function fdatasync(fd: number, callback: NoParamCallback): void;
4219
+ namespace fdatasync {
4001
4220
  /**
4002
4221
  * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4003
4222
  * @param fd A file descriptor.
@@ -4009,7 +4228,7 @@ declare module "_not-use-node-type_fs" {
4009
4228
  * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`.
4010
4229
  * @since v0.1.96
4011
4230
  */
4012
- export function fdatasyncSync(fd: number): void;
4231
+ function fdatasyncSync(fd: number): void;
4013
4232
  /**
4014
4233
  * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
4015
4234
  * already exists. No arguments other than a possible exception are given to the
@@ -4049,9 +4268,9 @@ declare module "_not-use-node-type_fs" {
4049
4268
  * @param dest destination filename of the copy operation
4050
4269
  * @param [mode=0] modifiers for copy operation.
4051
4270
  */
4052
- export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4053
- export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4054
- export namespace copyFile {
4271
+ function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4272
+ function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4273
+ namespace copyFile {
4055
4274
  function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
4056
4275
  }
4057
4276
  /**
@@ -4088,7 +4307,7 @@ declare module "_not-use-node-type_fs" {
4088
4307
  * @param dest destination filename of the copy operation
4089
4308
  * @param [mode=0] modifiers for copy operation.
4090
4309
  */
4091
- export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4310
+ function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4092
4311
  /**
4093
4312
  * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
4094
4313
  *
@@ -4109,27 +4328,29 @@ declare module "_not-use-node-type_fs" {
4109
4328
  * @since v12.9.0
4110
4329
  * @param [position='null']
4111
4330
  */
4112
- export function writev(
4331
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4113
4332
  fd: number,
4114
- buffers: readonly NodeJS.ArrayBufferView[],
4115
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4333
+ buffers: TBuffers,
4334
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4116
4335
  ): void;
4117
- export function writev(
4336
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4118
4337
  fd: number,
4119
- buffers: readonly NodeJS.ArrayBufferView[],
4338
+ buffers: TBuffers,
4120
4339
  position: number | null,
4121
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4340
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4122
4341
  ): void;
4123
- export interface WriteVResult {
4342
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4343
+ // TODO: remove default in future major version
4344
+ interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4124
4345
  bytesWritten: number;
4125
- buffers: NodeJS.ArrayBufferView[];
4346
+ buffers: T;
4126
4347
  }
4127
- export namespace writev {
4128
- function __promisify__(
4348
+ namespace writev {
4349
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4129
4350
  fd: number,
4130
- buffers: readonly NodeJS.ArrayBufferView[],
4351
+ buffers: TBuffers,
4131
4352
  position?: number,
4132
- ): Promise<WriteVResult>;
4353
+ ): Promise<WriteVResult<TBuffers>>;
4133
4354
  }
4134
4355
  /**
4135
4356
  * For detailed information, see the documentation of the asynchronous version of
@@ -4138,7 +4359,7 @@ declare module "_not-use-node-type_fs" {
4138
4359
  * @param [position='null']
4139
4360
  * @return The number of bytes written.
4140
4361
  */
4141
- export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4362
+ function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4142
4363
  /**
4143
4364
  * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
4144
4365
  * using `readv()`.
@@ -4154,27 +4375,29 @@ declare module "_not-use-node-type_fs" {
4154
4375
  * @since v13.13.0, v12.17.0
4155
4376
  * @param [position='null']
4156
4377
  */
4157
- export function readv(
4378
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4158
4379
  fd: number,
4159
- buffers: readonly NodeJS.ArrayBufferView[],
4160
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4380
+ buffers: TBuffers,
4381
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4161
4382
  ): void;
4162
- export function readv(
4383
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4163
4384
  fd: number,
4164
- buffers: readonly NodeJS.ArrayBufferView[],
4385
+ buffers: TBuffers,
4165
4386
  position: number | null,
4166
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4387
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4167
4388
  ): void;
4168
- export interface ReadVResult {
4389
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4390
+ // TODO: remove default in future major version
4391
+ interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4169
4392
  bytesRead: number;
4170
- buffers: NodeJS.ArrayBufferView[];
4393
+ buffers: T;
4171
4394
  }
4172
- export namespace readv {
4173
- function __promisify__(
4395
+ namespace readv {
4396
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4174
4397
  fd: number,
4175
- buffers: readonly NodeJS.ArrayBufferView[],
4398
+ buffers: TBuffers,
4176
4399
  position?: number,
4177
- ): Promise<ReadVResult>;
4400
+ ): Promise<ReadVResult<TBuffers>>;
4178
4401
  }
4179
4402
  /**
4180
4403
  * For detailed information, see the documentation of the asynchronous version of
@@ -4183,9 +4406,9 @@ declare module "_not-use-node-type_fs" {
4183
4406
  * @param [position='null']
4184
4407
  * @return The number of bytes read.
4185
4408
  */
4186
- export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4409
+ function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4187
4410
 
4188
- export interface OpenAsBlobOptions {
4411
+ interface OpenAsBlobOptions {
4189
4412
  /**
4190
4413
  * An optional mime type for the blob.
4191
4414
  *
@@ -4211,9 +4434,9 @@ declare module "_not-use-node-type_fs" {
4211
4434
  * ```
4212
4435
  * @since v19.8.0
4213
4436
  */
4214
- export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4437
+ function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4215
4438
 
4216
- export interface OpenDirOptions {
4439
+ interface OpenDirOptions {
4217
4440
  /**
4218
4441
  * @default 'utf8'
4219
4442
  */
@@ -4228,7 +4451,7 @@ declare module "_not-use-node-type_fs" {
4228
4451
  /**
4229
4452
  * @default false
4230
4453
  */
4231
- recursive?: boolean;
4454
+ recursive?: boolean | undefined;
4232
4455
  }
4233
4456
  /**
4234
4457
  * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
@@ -4240,7 +4463,7 @@ declare module "_not-use-node-type_fs" {
4240
4463
  * directory and subsequent read operations.
4241
4464
  * @since v12.12.0
4242
4465
  */
4243
- export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4466
+ function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4244
4467
  /**
4245
4468
  * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
4246
4469
  * more details.
@@ -4252,28 +4475,28 @@ declare module "_not-use-node-type_fs" {
4252
4475
  * directory and subsequent read operations.
4253
4476
  * @since v12.12.0
4254
4477
  */
4255
- export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4256
- export function opendir(
4478
+ function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4479
+ function opendir(
4257
4480
  path: PathLike,
4258
4481
  options: OpenDirOptions,
4259
4482
  cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
4260
4483
  ): void;
4261
- export namespace opendir {
4484
+ namespace opendir {
4262
4485
  function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
4263
4486
  }
4264
- export interface BigIntStats extends StatsBase<bigint> {
4487
+ interface BigIntStats extends StatsBase<bigint> {
4265
4488
  atimeNs: bigint;
4266
4489
  mtimeNs: bigint;
4267
4490
  ctimeNs: bigint;
4268
4491
  birthtimeNs: bigint;
4269
4492
  }
4270
- export interface BigIntOptions {
4493
+ interface BigIntOptions {
4271
4494
  bigint: true;
4272
4495
  }
4273
- export interface StatOptions {
4496
+ interface StatOptions {
4274
4497
  bigint?: boolean | undefined;
4275
4498
  }
4276
- export interface StatSyncOptions extends StatOptions {
4499
+ interface StatSyncOptions extends StatOptions {
4277
4500
  throwIfNoEntry?: boolean | undefined;
4278
4501
  }
4279
4502
  interface CopyOptionsBase {
@@ -4281,54 +4504,54 @@ declare module "_not-use-node-type_fs" {
4281
4504
  * Dereference symlinks
4282
4505
  * @default false
4283
4506
  */
4284
- dereference?: boolean;
4507
+ dereference?: boolean | undefined;
4285
4508
  /**
4286
4509
  * When `force` is `false`, and the destination
4287
4510
  * exists, throw an error.
4288
4511
  * @default false
4289
4512
  */
4290
- errorOnExist?: boolean;
4513
+ errorOnExist?: boolean | undefined;
4291
4514
  /**
4292
4515
  * Overwrite existing file or directory. _The copy
4293
4516
  * operation will ignore errors if you set this to false and the destination
4294
4517
  * exists. Use the `errorOnExist` option to change this behavior.
4295
4518
  * @default true
4296
4519
  */
4297
- force?: boolean;
4520
+ force?: boolean | undefined;
4298
4521
  /**
4299
4522
  * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
4300
4523
  */
4301
- mode?: number;
4524
+ mode?: number | undefined;
4302
4525
  /**
4303
4526
  * When `true` timestamps from `src` will
4304
4527
  * be preserved.
4305
4528
  * @default false
4306
4529
  */
4307
- preserveTimestamps?: boolean;
4530
+ preserveTimestamps?: boolean | undefined;
4308
4531
  /**
4309
4532
  * Copy directories recursively.
4310
4533
  * @default false
4311
4534
  */
4312
- recursive?: boolean;
4535
+ recursive?: boolean | undefined;
4313
4536
  /**
4314
4537
  * When true, path resolution for symlinks will be skipped
4315
4538
  * @default false
4316
4539
  */
4317
- verbatimSymlinks?: boolean;
4540
+ verbatimSymlinks?: boolean | undefined;
4318
4541
  }
4319
- export interface CopyOptions extends CopyOptionsBase {
4542
+ interface CopyOptions extends CopyOptionsBase {
4320
4543
  /**
4321
4544
  * Function to filter copied files/directories. Return
4322
4545
  * `true` to copy the item, `false` to ignore it.
4323
4546
  */
4324
- filter?(source: string, destination: string): boolean | Promise<boolean>;
4547
+ filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4325
4548
  }
4326
- export interface CopySyncOptions extends CopyOptionsBase {
4549
+ interface CopySyncOptions extends CopyOptionsBase {
4327
4550
  /**
4328
4551
  * Function to filter copied files/directories. Return
4329
4552
  * `true` to copy the item, `false` to ignore it.
4330
4553
  */
4331
- filter?(source: string, destination: string): boolean;
4554
+ filter?: ((source: string, destination: string) => boolean) | undefined;
4332
4555
  }
4333
4556
  /**
4334
4557
  * Asynchronously copies the entire directory structure from `src` to `dest`,
@@ -4341,12 +4564,12 @@ declare module "_not-use-node-type_fs" {
4341
4564
  * @param src source path to copy.
4342
4565
  * @param dest destination path to copy to.
4343
4566
  */
4344
- export function cp(
4567
+ function cp(
4345
4568
  source: string | URL,
4346
4569
  destination: string | URL,
4347
4570
  callback: (err: NodeJS.ErrnoException | null) => void,
4348
4571
  ): void;
4349
- export function cp(
4572
+ function cp(
4350
4573
  source: string | URL,
4351
4574
  destination: string | URL,
4352
4575
  opts: CopyOptions,
@@ -4363,14 +4586,15 @@ declare module "_not-use-node-type_fs" {
4363
4586
  * @param src source path to copy.
4364
4587
  * @param dest destination path to copy to.
4365
4588
  */
4366
- export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4589
+ function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4367
4590
 
4591
+ // TODO: collapse
4368
4592
  interface _GlobOptions<T extends Dirent | string> {
4369
4593
  /**
4370
4594
  * Current working directory.
4371
4595
  * @default process.cwd()
4372
4596
  */
4373
- cwd?: string | undefined;
4597
+ cwd?: string | URL | undefined;
4374
4598
  /**
4375
4599
  * `true` if the glob should return paths as `Dirent`s, `false` otherwise.
4376
4600
  * @default false
@@ -4381,15 +4605,18 @@ declare module "_not-use-node-type_fs" {
4381
4605
  * Function to filter out files/directories or a
4382
4606
  * list of glob patterns to be excluded. If a function is provided, return
4383
4607
  * `true` to exclude the item, `false` to include it.
4608
+ * If a string array is provided, each string should be a glob pattern that
4609
+ * specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
4610
+ * not supported.
4384
4611
  * @default undefined
4385
4612
  */
4386
4613
  exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
4387
4614
  }
4388
- export interface GlobOptions extends _GlobOptions<Dirent | string> {}
4389
- export interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4615
+ interface GlobOptions extends _GlobOptions<Dirent | string> {}
4616
+ interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4390
4617
  withFileTypes: true;
4391
4618
  }
4392
- export interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4619
+ interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4393
4620
  withFileTypes?: false | undefined;
4394
4621
  }
4395
4622
 
@@ -4406,11 +4633,11 @@ declare module "_not-use-node-type_fs" {
4406
4633
  * ```
4407
4634
  * @since v22.0.0
4408
4635
  */
4409
- export function glob(
4636
+ function glob(
4410
4637
  pattern: string | readonly string[],
4411
4638
  callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4412
4639
  ): void;
4413
- export function glob(
4640
+ function glob(
4414
4641
  pattern: string | readonly string[],
4415
4642
  options: GlobOptionsWithFileTypes,
4416
4643
  callback: (
@@ -4418,7 +4645,7 @@ declare module "_not-use-node-type_fs" {
4418
4645
  matches: Dirent[],
4419
4646
  ) => void,
4420
4647
  ): void;
4421
- export function glob(
4648
+ function glob(
4422
4649
  pattern: string | readonly string[],
4423
4650
  options: GlobOptionsWithoutFileTypes,
4424
4651
  callback: (
@@ -4426,7 +4653,7 @@ declare module "_not-use-node-type_fs" {
4426
4653
  matches: string[],
4427
4654
  ) => void,
4428
4655
  ): void;
4429
- export function glob(
4656
+ function glob(
4430
4657
  pattern: string | readonly string[],
4431
4658
  options: GlobOptions,
4432
4659
  callback: (
@@ -4443,17 +4670,20 @@ declare module "_not-use-node-type_fs" {
4443
4670
  * @since v22.0.0
4444
4671
  * @returns paths of files that match the pattern.
4445
4672
  */
4446
- export function globSync(pattern: string | readonly string[]): string[];
4447
- export function globSync(
4673
+ function globSync(pattern: string | readonly string[]): string[];
4674
+ function globSync(
4448
4675
  pattern: string | readonly string[],
4449
4676
  options: GlobOptionsWithFileTypes,
4450
4677
  ): Dirent[];
4451
- export function globSync(
4678
+ function globSync(
4452
4679
  pattern: string | readonly string[],
4453
4680
  options: GlobOptionsWithoutFileTypes,
4454
4681
  ): string[];
4455
- export function globSync(
4682
+ function globSync(
4456
4683
  pattern: string | readonly string[],
4457
4684
  options: GlobOptions,
4458
4685
  ): Dirent[] | string[];
4459
4686
  }
4687
+ declare module "_not-use-node-type_fs" {
4688
+ export * as promises from "node:fs/promises";
4689
+ }