@emulsify/cli 1.11.4 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/node_modules/.package-lock.json +34 -24
  2. package/dist/node_modules/@types/node/README.md +2 -2
  3. package/dist/node_modules/@types/node/assert.d.ts +23 -1
  4. package/dist/node_modules/@types/node/async_hooks.d.ts +64 -0
  5. package/dist/node_modules/@types/node/buffer.buffer.d.ts +124 -38
  6. package/dist/node_modules/@types/node/buffer.d.ts +19 -17
  7. package/dist/node_modules/@types/node/child_process.d.ts +88 -161
  8. package/dist/node_modules/@types/node/cluster.d.ts +5 -6
  9. package/dist/node_modules/@types/node/constants.d.ts +14 -12
  10. package/dist/node_modules/@types/node/crypto.d.ts +237 -166
  11. package/dist/node_modules/@types/node/dgram.d.ts +15 -14
  12. package/dist/node_modules/@types/node/diagnostics_channel.d.ts +39 -15
  13. package/dist/node_modules/@types/node/dns/promises.d.ts +11 -9
  14. package/dist/node_modules/@types/node/dns.d.ts +28 -21
  15. package/dist/node_modules/@types/node/events.d.ts +81 -35
  16. package/dist/node_modules/@types/node/fs/promises.d.ts +61 -36
  17. package/dist/node_modules/@types/node/fs.d.ts +251 -193
  18. package/dist/node_modules/@types/node/globals.d.ts +146 -442
  19. package/dist/node_modules/@types/node/globals.typedarray.d.ts +17 -0
  20. package/dist/node_modules/@types/node/http.d.ts +136 -31
  21. package/dist/node_modules/@types/node/http2.d.ts +102 -26
  22. package/dist/node_modules/@types/node/https.d.ts +94 -60
  23. package/dist/node_modules/@types/node/index.d.ts +5 -3
  24. package/dist/node_modules/@types/node/{inspector.d.ts → inspector.generated.d.ts} +272 -2
  25. package/dist/node_modules/@types/node/module.d.ts +362 -138
  26. package/dist/node_modules/@types/node/net.d.ts +27 -20
  27. package/dist/node_modules/@types/node/os.d.ts +14 -3
  28. package/dist/node_modules/@types/node/package.json +4 -89
  29. package/dist/node_modules/@types/node/perf_hooks.d.ts +37 -10
  30. package/dist/node_modules/@types/node/process.d.ts +108 -35
  31. package/dist/node_modules/@types/node/querystring.d.ts +2 -3
  32. package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
  33. package/dist/node_modules/@types/node/stream/consumers.d.ts +33 -7
  34. package/dist/node_modules/@types/node/stream/web.d.ts +13 -4
  35. package/dist/node_modules/@types/node/stream.d.ts +963 -1014
  36. package/dist/node_modules/@types/node/string_decoder.d.ts +2 -2
  37. package/dist/node_modules/@types/node/test.d.ts +1504 -1655
  38. package/dist/node_modules/@types/node/timers/promises.d.ts +28 -17
  39. package/dist/node_modules/@types/node/timers.d.ts +157 -111
  40. package/dist/node_modules/@types/node/tls.d.ts +105 -67
  41. package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +120 -37
  42. package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +15 -0
  43. package/dist/node_modules/@types/node/ts5.6/index.d.ts +5 -3
  44. package/dist/node_modules/@types/node/url.d.ts +10 -1
  45. package/dist/node_modules/@types/node/util.d.ts +28 -3
  46. package/dist/node_modules/@types/node/v8.d.ts +6 -5
  47. package/dist/node_modules/@types/node/vm.d.ts +147 -68
  48. package/dist/node_modules/@types/node/wasi.d.ts +1 -1
  49. package/dist/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  50. package/dist/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  51. package/dist/node_modules/@types/node/web-globals/events.d.ts +97 -0
  52. package/dist/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
  53. package/dist/node_modules/@types/node/worker_threads.d.ts +60 -39
  54. package/dist/node_modules/@types/node/zlib.d.ts +21 -20
  55. package/dist/node_modules/debug/package.json +7 -3
  56. package/dist/node_modules/debug/src/browser.js +2 -1
  57. package/dist/node_modules/debug/src/common.js +57 -39
  58. package/dist/node_modules/fast-uri/.github/dependabot.yml +1 -1
  59. package/dist/node_modules/fast-uri/.github/workflows/ci.yml +81 -3
  60. package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +6 -2
  61. package/dist/node_modules/fast-uri/LICENSE +3 -1
  62. package/dist/node_modules/fast-uri/README.md +55 -37
  63. package/dist/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  64. package/dist/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  65. package/dist/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  66. package/dist/node_modules/fast-uri/benchmark/package.json +17 -0
  67. package/dist/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  68. package/dist/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  69. package/dist/node_modules/fast-uri/eslint.config.js +6 -0
  70. package/dist/node_modules/fast-uri/index.js +98 -61
  71. package/dist/node_modules/fast-uri/lib/schemes.js +160 -81
  72. package/dist/node_modules/fast-uri/lib/utils.js +217 -123
  73. package/dist/node_modules/fast-uri/package.json +44 -14
  74. package/dist/node_modules/fast-uri/test/ajv.test.js +7 -3
  75. package/dist/node_modules/fast-uri/test/equal.test.js +7 -2
  76. package/dist/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
  77. package/dist/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  78. package/dist/node_modules/fast-uri/test/parse.test.js +31 -31
  79. package/dist/node_modules/fast-uri/test/resolve.test.js +52 -49
  80. package/dist/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  81. package/dist/node_modules/fast-uri/test/serialize.test.js +55 -47
  82. package/dist/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  83. package/dist/node_modules/fast-uri/test/uri-js.test.js +230 -230
  84. package/dist/node_modules/fast-uri/test/util.test.js +23 -8
  85. package/dist/node_modules/fast-uri/tsconfig.json +9 -0
  86. package/dist/node_modules/fast-uri/types/index.d.ts +16 -9
  87. package/dist/node_modules/fast-uri/types/index.test-d.ts +9 -9
  88. package/dist/node_modules/fs-extra/LICENSE +1 -1
  89. package/dist/node_modules/fs-extra/README.md +3 -1
  90. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +11 -1
  91. package/dist/node_modules/fs-extra/lib/copy/copy.js +13 -15
  92. package/dist/node_modules/fs-extra/lib/fs/index.js +6 -0
  93. package/dist/node_modules/fs-extra/lib/util/async.js +29 -0
  94. package/dist/node_modules/fs-extra/lib/util/stat.js +2 -1
  95. package/dist/node_modules/fs-extra/package.json +1 -1
  96. package/dist/node_modules/jsonfile/README.md +1 -1
  97. package/dist/node_modules/jsonfile/index.js +3 -3
  98. package/dist/node_modules/jsonfile/package.json +1 -1
  99. package/dist/node_modules/simple-git/dist/cjs/index.js +235 -235
  100. package/dist/node_modules/simple-git/dist/cjs/index.js.map +3 -3
  101. package/dist/node_modules/simple-git/dist/esm/index.js +229 -233
  102. package/dist/node_modules/simple-git/dist/esm/index.js.map +3 -3
  103. package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +1 -1
  104. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +1 -1
  105. package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +2 -3
  106. package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +2 -3
  107. package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +0 -1
  108. package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -1
  109. package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +2 -2
  110. package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +1 -1
  111. package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +1 -1
  112. package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +1 -1
  113. package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -3
  114. package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +1 -1
  115. package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +4 -2
  116. package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +3 -3
  117. package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +1 -1
  118. package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +2 -2
  119. package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +1 -1
  120. package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +9 -13
  121. package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +5 -6
  122. package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +5 -7
  123. package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +0 -1
  124. package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -1
  125. package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +1 -1
  126. package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +11 -10
  127. package/dist/node_modules/simple-git/package.json +6 -6
  128. package/dist/node_modules/simple-git/readme.md +8 -0
  129. package/dist/node_modules/undici-types/dispatcher.d.ts +1 -0
  130. package/dist/node_modules/undici-types/eventsource.d.ts +0 -2
  131. package/dist/node_modules/undici-types/filereader.d.ts +1 -1
  132. package/dist/node_modules/undici-types/interceptors.d.ts +3 -1
  133. package/dist/node_modules/undici-types/package.json +1 -1
  134. package/dist/node_modules/undici-types/patch.d.ts +0 -38
  135. package/dist/node_modules/undici-types/readable.d.ts +5 -0
  136. package/dist/node_modules/undici-types/webidl.d.ts +6 -0
  137. package/dist/node_modules/undici-types/websocket.d.ts +0 -2
  138. package/dist/package-lock.json +911 -812
  139. package/dist/package.json +1 -1
  140. package/dist/util/getAvailableStarters.js +2 -2
  141. package/package.json +1 -1
  142. package/dist/node_modules/@types/node/dom-events.d.ts +0 -124
  143. package/dist/node_modules/fast-uri/benchmark.js +0 -105
  144. package/dist/node_modules/fast-uri/lib/scopedChars.js +0 -30
  145. package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
  146. package/dist/node_modules/fast-uri/test/compatibility.test.js +0 -131
  147. package/dist/node_modules/jsonfile/CHANGELOG.md +0 -171
@@ -19,6 +19,7 @@
19
19
  * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/fs.js)
20
20
  */
21
21
  declare module "fs" {
22
+ import { NonSharedBuffer } from "node:buffer";
22
23
  import * as stream from "node:stream";
23
24
  import { Abortable, EventEmitter } from "node:events";
24
25
  import { URL } from "node:url";
@@ -196,7 +197,7 @@ declare module "fs" {
196
197
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
197
198
  * @since v10.10.0
198
199
  */
199
- export class Dirent {
200
+ export class Dirent<Name extends string | Buffer = string> {
200
201
  /**
201
202
  * Returns `true` if the `fs.Dirent` object describes a regular file.
202
203
  * @since v10.10.0
@@ -239,7 +240,7 @@ declare module "fs" {
239
240
  * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
240
241
  * @since v10.10.0
241
242
  */
242
- name: string;
243
+ name: Name;
243
244
  /**
244
245
  * The base path that this `fs.Dirent` object refers to.
245
246
  * @since v20.12.0
@@ -386,23 +387,29 @@ declare module "fs" {
386
387
  * 3. error
387
388
  */
388
389
  addListener(event: string, listener: (...args: any[]) => void): this;
389
- addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
390
+ addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
390
391
  addListener(event: "close", listener: () => void): this;
391
392
  addListener(event: "error", listener: (error: Error) => void): this;
392
393
  on(event: string, listener: (...args: any[]) => void): this;
393
- on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
394
+ on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
394
395
  on(event: "close", listener: () => void): this;
395
396
  on(event: "error", listener: (error: Error) => void): this;
396
397
  once(event: string, listener: (...args: any[]) => void): this;
397
- once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
398
+ once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
398
399
  once(event: "close", listener: () => void): this;
399
400
  once(event: "error", listener: (error: Error) => void): this;
400
401
  prependListener(event: string, listener: (...args: any[]) => void): this;
401
- prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
402
+ prependListener(
403
+ event: "change",
404
+ listener: (eventType: string, filename: string | NonSharedBuffer) => void,
405
+ ): this;
402
406
  prependListener(event: "close", listener: () => void): this;
403
407
  prependListener(event: "error", listener: (error: Error) => void): this;
404
408
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
405
- prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
409
+ prependOnceListener(
410
+ event: "change",
411
+ listener: (eventType: string, filename: string | NonSharedBuffer) => void,
412
+ ): this;
406
413
  prependOnceListener(event: "close", listener: () => void): this;
407
414
  prependOnceListener(event: "error", listener: (error: Error) => void): this;
408
415
  }
@@ -436,57 +443,47 @@ declare module "fs" {
436
443
  * 2. close
437
444
  * 3. ready
438
445
  */
439
- addListener(event: "close", listener: () => void): this;
440
- addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
441
- addListener(event: "end", listener: () => void): this;
442
- addListener(event: "error", listener: (err: Error) => void): this;
443
- addListener(event: "open", listener: (fd: number) => void): this;
444
- addListener(event: "pause", listener: () => void): this;
445
- addListener(event: "readable", listener: () => void): this;
446
- addListener(event: "ready", listener: () => void): this;
447
- addListener(event: "resume", listener: () => void): this;
448
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
449
- on(event: "close", listener: () => void): this;
450
- on(event: "data", listener: (chunk: Buffer | string) => void): this;
451
- on(event: "end", listener: () => void): this;
452
- on(event: "error", listener: (err: Error) => void): this;
453
- on(event: "open", listener: (fd: number) => void): this;
454
- on(event: "pause", listener: () => void): this;
455
- on(event: "readable", listener: () => void): this;
456
- on(event: "ready", listener: () => void): this;
457
- on(event: "resume", listener: () => void): this;
458
- on(event: string | symbol, listener: (...args: any[]) => void): this;
459
- once(event: "close", listener: () => void): this;
460
- once(event: "data", listener: (chunk: Buffer | string) => void): this;
461
- once(event: "end", listener: () => void): this;
462
- once(event: "error", listener: (err: Error) => void): this;
463
- once(event: "open", listener: (fd: number) => void): this;
464
- once(event: "pause", listener: () => void): this;
465
- once(event: "readable", listener: () => void): this;
466
- once(event: "ready", listener: () => void): this;
467
- once(event: "resume", listener: () => void): this;
468
- once(event: string | symbol, listener: (...args: any[]) => void): this;
469
- prependListener(event: "close", listener: () => void): this;
470
- prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
471
- prependListener(event: "end", listener: () => void): this;
472
- prependListener(event: "error", listener: (err: Error) => void): this;
473
- prependListener(event: "open", listener: (fd: number) => void): this;
474
- prependListener(event: "pause", listener: () => void): this;
475
- prependListener(event: "readable", listener: () => void): this;
476
- prependListener(event: "ready", listener: () => void): this;
477
- prependListener(event: "resume", listener: () => void): this;
478
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
479
- prependOnceListener(event: "close", listener: () => void): this;
480
- prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
481
- prependOnceListener(event: "end", listener: () => void): this;
482
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
483
- prependOnceListener(event: "open", listener: (fd: number) => void): this;
484
- prependOnceListener(event: "pause", listener: () => void): this;
485
- prependOnceListener(event: "readable", listener: () => void): this;
486
- prependOnceListener(event: "ready", listener: () => void): this;
487
- prependOnceListener(event: "resume", listener: () => void): this;
488
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
446
+ addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
447
+ on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
448
+ once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
449
+ prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
450
+ prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
489
451
  }
452
+
453
+ /**
454
+ * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
455
+ */
456
+ type ReadStreamEvents = {
457
+ close: () => void;
458
+ data: (chunk: Buffer | string) => void;
459
+ end: () => void;
460
+ error: (err: Error) => void;
461
+ open: (fd: number) => void;
462
+ pause: () => void;
463
+ readable: () => void;
464
+ ready: () => void;
465
+ resume: () => void;
466
+ } & CustomEvents;
467
+
468
+ /**
469
+ * string & {} allows to allow any kind of strings for the event
470
+ * but still allows to have auto completion for the normal events.
471
+ */
472
+ type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
473
+
474
+ /**
475
+ * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
476
+ */
477
+ type WriteStreamEvents = {
478
+ close: () => void;
479
+ drain: () => void;
480
+ error: (err: Error) => void;
481
+ finish: () => void;
482
+ open: (fd: number) => void;
483
+ pipe: (src: stream.Readable) => void;
484
+ ready: () => void;
485
+ unpipe: (src: stream.Readable) => void;
486
+ } & CustomEvents;
490
487
  /**
491
488
  * * Extends `stream.Writable`
492
489
  *
@@ -525,51 +522,11 @@ declare module "fs" {
525
522
  * 2. close
526
523
  * 3. ready
527
524
  */
528
- addListener(event: "close", listener: () => void): this;
529
- addListener(event: "drain", listener: () => void): this;
530
- addListener(event: "error", listener: (err: Error) => void): this;
531
- addListener(event: "finish", listener: () => void): this;
532
- addListener(event: "open", listener: (fd: number) => void): this;
533
- addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
534
- addListener(event: "ready", listener: () => void): this;
535
- addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
536
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
537
- on(event: "close", listener: () => void): this;
538
- on(event: "drain", listener: () => void): this;
539
- on(event: "error", listener: (err: Error) => void): this;
540
- on(event: "finish", listener: () => void): this;
541
- on(event: "open", listener: (fd: number) => void): this;
542
- on(event: "pipe", listener: (src: stream.Readable) => void): this;
543
- on(event: "ready", listener: () => void): this;
544
- on(event: "unpipe", listener: (src: stream.Readable) => void): this;
545
- on(event: string | symbol, listener: (...args: any[]) => void): this;
546
- once(event: "close", listener: () => void): this;
547
- once(event: "drain", listener: () => void): this;
548
- once(event: "error", listener: (err: Error) => void): this;
549
- once(event: "finish", listener: () => void): this;
550
- once(event: "open", listener: (fd: number) => void): this;
551
- once(event: "pipe", listener: (src: stream.Readable) => void): this;
552
- once(event: "ready", listener: () => void): this;
553
- once(event: "unpipe", listener: (src: stream.Readable) => void): this;
554
- once(event: string | symbol, listener: (...args: any[]) => void): this;
555
- prependListener(event: "close", listener: () => void): this;
556
- prependListener(event: "drain", listener: () => void): this;
557
- prependListener(event: "error", listener: (err: Error) => void): this;
558
- prependListener(event: "finish", listener: () => void): this;
559
- prependListener(event: "open", listener: (fd: number) => void): this;
560
- prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
561
- prependListener(event: "ready", listener: () => void): this;
562
- prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
563
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
564
- prependOnceListener(event: "close", listener: () => void): this;
565
- prependOnceListener(event: "drain", listener: () => void): this;
566
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
567
- prependOnceListener(event: "finish", listener: () => void): this;
568
- prependOnceListener(event: "open", listener: (fd: number) => void): this;
569
- prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
570
- prependOnceListener(event: "ready", listener: () => void): this;
571
- prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
572
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
525
+ addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
526
+ on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
527
+ once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
528
+ prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
529
+ prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
573
530
  }
574
531
  /**
575
532
  * Asynchronously rename file at `oldPath` to the pathname provided
@@ -629,7 +586,7 @@ declare module "fs" {
629
586
  * @since v0.8.6
630
587
  * @param [len=0]
631
588
  */
632
- export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
589
+ export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
633
590
  /**
634
591
  * Asynchronous truncate(2) - Truncate a file to a specified length.
635
592
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -641,7 +598,7 @@ declare module "fs" {
641
598
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
642
599
  * @param len If not specified, defaults to `0`.
643
600
  */
644
- function __promisify__(path: PathLike, len?: number | null): Promise<void>;
601
+ function __promisify__(path: PathLike, len?: number): Promise<void>;
645
602
  }
646
603
  /**
647
604
  * Truncates the file. Returns `undefined`. A file descriptor can also be
@@ -652,7 +609,7 @@ declare module "fs" {
652
609
  * @since v0.8.6
653
610
  * @param [len=0]
654
611
  */
655
- export function truncateSync(path: PathLike, len?: number | null): void;
612
+ export function truncateSync(path: PathLike, len?: number): void;
656
613
  /**
657
614
  * Truncates the file descriptor. No arguments other than a possible exception are
658
615
  * given to the completion callback.
@@ -696,7 +653,7 @@ declare module "fs" {
696
653
  * @since v0.8.6
697
654
  * @param [len=0]
698
655
  */
699
- export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
656
+ export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
700
657
  /**
701
658
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
702
659
  * @param fd A file descriptor.
@@ -708,7 +665,7 @@ declare module "fs" {
708
665
  * @param fd A file descriptor.
709
666
  * @param len If not specified, defaults to `0`.
710
667
  */
711
- function __promisify__(fd: number, len?: number | null): Promise<void>;
668
+ function __promisify__(fd: number, len?: number): Promise<void>;
712
669
  }
713
670
  /**
714
671
  * Truncates the file descriptor. Returns `undefined`.
@@ -718,7 +675,7 @@ declare module "fs" {
718
675
  * @since v0.8.6
719
676
  * @param [len=0]
720
677
  */
721
- export function ftruncateSync(fd: number, len?: number | null): void;
678
+ export function ftruncateSync(fd: number, len?: number): void;
722
679
  /**
723
680
  * Asynchronously changes owner and group of a file. No arguments other than a
724
681
  * possible exception are given to the completion callback.
@@ -1368,7 +1325,7 @@ declare module "fs" {
1368
1325
  export function readlink(
1369
1326
  path: PathLike,
1370
1327
  options: BufferEncodingOption,
1371
- callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void,
1328
+ callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
1372
1329
  ): void;
1373
1330
  /**
1374
1331
  * Asynchronous readlink(2) - read value of a symbolic link.
@@ -1378,7 +1335,7 @@ declare module "fs" {
1378
1335
  export function readlink(
1379
1336
  path: PathLike,
1380
1337
  options: EncodingOption,
1381
- callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void,
1338
+ callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
1382
1339
  ): void;
1383
1340
  /**
1384
1341
  * Asynchronous readlink(2) - read value of a symbolic link.
@@ -1400,13 +1357,13 @@ declare module "fs" {
1400
1357
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1401
1358
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1402
1359
  */
1403
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1360
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1404
1361
  /**
1405
1362
  * Asynchronous readlink(2) - read value of a symbolic link.
1406
1363
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1407
1364
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1408
1365
  */
1409
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1366
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1410
1367
  }
1411
1368
  /**
1412
1369
  * Returns the symbolic link's string value.
@@ -1425,13 +1382,13 @@ declare module "fs" {
1425
1382
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1426
1383
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1427
1384
  */
1428
- export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
1385
+ export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1429
1386
  /**
1430
1387
  * Synchronous readlink(2) - read value of a symbolic link.
1431
1388
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1432
1389
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1433
1390
  */
1434
- export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer;
1391
+ export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1435
1392
  /**
1436
1393
  * Asynchronously computes the canonical pathname by resolving `.`, `..`, and
1437
1394
  * symbolic links.
@@ -1471,7 +1428,7 @@ declare module "fs" {
1471
1428
  export function realpath(
1472
1429
  path: PathLike,
1473
1430
  options: BufferEncodingOption,
1474
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1431
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1475
1432
  ): void;
1476
1433
  /**
1477
1434
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
@@ -1481,7 +1438,7 @@ declare module "fs" {
1481
1438
  export function realpath(
1482
1439
  path: PathLike,
1483
1440
  options: EncodingOption,
1484
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1441
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1485
1442
  ): void;
1486
1443
  /**
1487
1444
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
@@ -1503,13 +1460,13 @@ declare module "fs" {
1503
1460
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1504
1461
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1505
1462
  */
1506
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1463
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1507
1464
  /**
1508
1465
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1509
1466
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1510
1467
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1511
1468
  */
1512
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1469
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1513
1470
  /**
1514
1471
  * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
1515
1472
  *
@@ -1535,12 +1492,12 @@ declare module "fs" {
1535
1492
  function native(
1536
1493
  path: PathLike,
1537
1494
  options: BufferEncodingOption,
1538
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1495
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1539
1496
  ): void;
1540
1497
  function native(
1541
1498
  path: PathLike,
1542
1499
  options: EncodingOption,
1543
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1500
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1544
1501
  ): void;
1545
1502
  function native(
1546
1503
  path: PathLike,
@@ -1560,17 +1517,17 @@ declare module "fs" {
1560
1517
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1561
1518
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1562
1519
  */
1563
- export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
1520
+ export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1564
1521
  /**
1565
1522
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1566
1523
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1567
1524
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1568
1525
  */
1569
- export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer;
1526
+ export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1570
1527
  export namespace realpathSync {
1571
1528
  function native(path: PathLike, options?: EncodingOption): string;
1572
- function native(path: PathLike, options: BufferEncodingOption): Buffer;
1573
- function native(path: PathLike, options?: EncodingOption): string | Buffer;
1529
+ function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1530
+ function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1574
1531
  }
1575
1532
  /**
1576
1533
  * Asynchronously removes a file or symbolic link. No arguments other than a
@@ -1940,12 +1897,8 @@ declare module "fs" {
1940
1897
  */
1941
1898
  export function mkdtemp(
1942
1899
  prefix: string,
1943
- options:
1944
- | "buffer"
1945
- | {
1946
- encoding: "buffer";
1947
- },
1948
- callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
1900
+ options: BufferEncodingOption,
1901
+ callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
1949
1902
  ): void;
1950
1903
  /**
1951
1904
  * Asynchronously creates a unique temporary directory.
@@ -1955,7 +1908,7 @@ declare module "fs" {
1955
1908
  export function mkdtemp(
1956
1909
  prefix: string,
1957
1910
  options: EncodingOption,
1958
- callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void,
1911
+ callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
1959
1912
  ): void;
1960
1913
  /**
1961
1914
  * Asynchronously creates a unique temporary directory.
@@ -1977,13 +1930,13 @@ declare module "fs" {
1977
1930
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1978
1931
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1979
1932
  */
1980
- function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
1933
+ function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1981
1934
  /**
1982
1935
  * Asynchronously creates a unique temporary directory.
1983
1936
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1984
1937
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1985
1938
  */
1986
- function __promisify__(prefix: string, options?: EncodingOption): Promise<string | Buffer>;
1939
+ function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1987
1940
  }
1988
1941
  /**
1989
1942
  * Returns the created directory path.
@@ -2001,13 +1954,13 @@ declare module "fs" {
2001
1954
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2002
1955
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2003
1956
  */
2004
- export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
1957
+ export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
2005
1958
  /**
2006
1959
  * Synchronously creates a unique temporary directory.
2007
1960
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2008
1961
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2009
1962
  */
2010
- export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
1963
+ export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2011
1964
  /**
2012
1965
  * 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 `'..'`.
2013
1966
  *
@@ -2048,7 +2001,7 @@ declare module "fs" {
2048
2001
  recursive?: boolean | undefined;
2049
2002
  }
2050
2003
  | "buffer",
2051
- callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void,
2004
+ callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
2052
2005
  ): void;
2053
2006
  /**
2054
2007
  * Asynchronous readdir(3) - read a directory.
@@ -2065,7 +2018,7 @@ declare module "fs" {
2065
2018
  | BufferEncoding
2066
2019
  | undefined
2067
2020
  | null,
2068
- callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
2021
+ callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
2069
2022
  ): void;
2070
2023
  /**
2071
2024
  * Asynchronous readdir(3) - read a directory.
@@ -2088,6 +2041,20 @@ declare module "fs" {
2088
2041
  },
2089
2042
  callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
2090
2043
  ): void;
2044
+ /**
2045
+ * Asynchronous readdir(3) - read a directory.
2046
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2047
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2048
+ */
2049
+ export function readdir(
2050
+ path: PathLike,
2051
+ options: {
2052
+ encoding: "buffer";
2053
+ withFileTypes: true;
2054
+ recursive?: boolean | undefined;
2055
+ },
2056
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
2057
+ ): void;
2091
2058
  export namespace readdir {
2092
2059
  /**
2093
2060
  * Asynchronous readdir(3) - read a directory.
@@ -2119,7 +2086,7 @@ declare module "fs" {
2119
2086
  withFileTypes?: false | undefined;
2120
2087
  recursive?: boolean | undefined;
2121
2088
  },
2122
- ): Promise<Buffer[]>;
2089
+ ): Promise<NonSharedBuffer[]>;
2123
2090
  /**
2124
2091
  * Asynchronous readdir(3) - read a directory.
2125
2092
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2134,7 +2101,7 @@ declare module "fs" {
2134
2101
  })
2135
2102
  | BufferEncoding
2136
2103
  | null,
2137
- ): Promise<string[] | Buffer[]>;
2104
+ ): Promise<string[] | NonSharedBuffer[]>;
2138
2105
  /**
2139
2106
  * Asynchronous readdir(3) - read a directory.
2140
2107
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2147,6 +2114,19 @@ declare module "fs" {
2147
2114
  recursive?: boolean | undefined;
2148
2115
  },
2149
2116
  ): Promise<Dirent[]>;
2117
+ /**
2118
+ * Asynchronous readdir(3) - read a directory.
2119
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2120
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2121
+ */
2122
+ function __promisify__(
2123
+ path: PathLike,
2124
+ options: {
2125
+ encoding: "buffer";
2126
+ withFileTypes: true;
2127
+ recursive?: boolean | undefined;
2128
+ },
2129
+ ): Promise<Dirent<NonSharedBuffer>[]>;
2150
2130
  }
2151
2131
  /**
2152
2132
  * Reads the contents of the directory.
@@ -2186,7 +2166,7 @@ declare module "fs" {
2186
2166
  recursive?: boolean | undefined;
2187
2167
  }
2188
2168
  | "buffer",
2189
- ): Buffer[];
2169
+ ): NonSharedBuffer[];
2190
2170
  /**
2191
2171
  * Synchronous readdir(3) - read a directory.
2192
2172
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2201,7 +2181,7 @@ declare module "fs" {
2201
2181
  })
2202
2182
  | BufferEncoding
2203
2183
  | null,
2204
- ): string[] | Buffer[];
2184
+ ): string[] | NonSharedBuffer[];
2205
2185
  /**
2206
2186
  * Synchronous readdir(3) - read a directory.
2207
2187
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2214,6 +2194,19 @@ declare module "fs" {
2214
2194
  recursive?: boolean | undefined;
2215
2195
  },
2216
2196
  ): Dirent[];
2197
+ /**
2198
+ * Synchronous readdir(3) - read a directory.
2199
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2200
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2201
+ */
2202
+ export function readdirSync(
2203
+ path: PathLike,
2204
+ options: {
2205
+ encoding: "buffer";
2206
+ withFileTypes: true;
2207
+ recursive?: boolean | undefined;
2208
+ },
2209
+ ): Dirent<NonSharedBuffer>[];
2217
2210
  /**
2218
2211
  * Closes the file descriptor. No arguments other than a possible exception are
2219
2212
  * given to the completion callback.
@@ -2367,6 +2360,20 @@ declare module "fs" {
2367
2360
  * @since v0.1.96
2368
2361
  */
2369
2362
  export function fsyncSync(fd: number): void;
2363
+ export interface WriteOptions {
2364
+ /**
2365
+ * @default 0
2366
+ */
2367
+ offset?: number | undefined;
2368
+ /**
2369
+ * @default `buffer.byteLength - offset`
2370
+ */
2371
+ length?: number | undefined;
2372
+ /**
2373
+ * @default null
2374
+ */
2375
+ position?: number | null | undefined;
2376
+ }
2370
2377
  /**
2371
2378
  * Write `buffer` to the file specified by `fd`.
2372
2379
  *
@@ -2435,6 +2442,20 @@ declare module "fs" {
2435
2442
  buffer: TBuffer,
2436
2443
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
2437
2444
  ): void;
2445
+ /**
2446
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2447
+ * @param fd A file descriptor.
2448
+ * @param options An object with the following properties:
2449
+ * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
2450
+ * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2451
+ * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2452
+ */
2453
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(
2454
+ fd: number,
2455
+ buffer: TBuffer,
2456
+ options: WriteOptions,
2457
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
2458
+ ): void;
2438
2459
  /**
2439
2460
  * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
2440
2461
  * @param fd A file descriptor.
@@ -2489,6 +2510,22 @@ declare module "fs" {
2489
2510
  bytesWritten: number;
2490
2511
  buffer: TBuffer;
2491
2512
  }>;
2513
+ /**
2514
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2515
+ * @param fd A file descriptor.
2516
+ * @param options An object with the following properties:
2517
+ * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
2518
+ * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2519
+ * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2520
+ */
2521
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2522
+ fd: number,
2523
+ buffer?: TBuffer,
2524
+ options?: WriteOptions,
2525
+ ): Promise<{
2526
+ bytesWritten: number;
2527
+ buffer: TBuffer;
2528
+ }>;
2492
2529
  /**
2493
2530
  * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
2494
2531
  * @param fd A file descriptor.
@@ -2536,7 +2573,7 @@ declare module "fs" {
2536
2573
  encoding?: BufferEncoding | null,
2537
2574
  ): number;
2538
2575
  export type ReadPosition = number | bigint;
2539
- export interface ReadSyncOptions {
2576
+ export interface ReadOptions {
2540
2577
  /**
2541
2578
  * @default 0
2542
2579
  */
@@ -2550,9 +2587,15 @@ declare module "fs" {
2550
2587
  */
2551
2588
  position?: ReadPosition | null | undefined;
2552
2589
  }
2553
- export interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> extends ReadSyncOptions {
2554
- buffer?: TBuffer;
2590
+ export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2591
+ buffer?: T | undefined;
2555
2592
  }
2593
+ /** @deprecated Use `ReadOptions` instead. */
2594
+ // TODO: remove in future major
2595
+ export interface ReadSyncOptions extends ReadOptions {}
2596
+ /** @deprecated Use `ReadOptionsWithBuffer` instead. */
2597
+ // TODO: remove in future major
2598
+ export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2556
2599
  /**
2557
2600
  * Read data from the file specified by `fd`.
2558
2601
  *
@@ -2587,14 +2630,25 @@ declare module "fs" {
2587
2630
  * `position` defaults to `null`
2588
2631
  * @since v12.17.0, 13.11.0
2589
2632
  */
2633
+ export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2634
+ fd: number,
2635
+ options: ReadOptionsWithBuffer<TBuffer>,
2636
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2637
+ ): void;
2590
2638
  export function read<TBuffer extends NodeJS.ArrayBufferView>(
2591
2639
  fd: number,
2592
- options: ReadAsyncOptions<TBuffer>,
2640
+ buffer: TBuffer,
2641
+ options: ReadOptions,
2642
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2643
+ ): void;
2644
+ export function read<TBuffer extends NodeJS.ArrayBufferView>(
2645
+ fd: number,
2646
+ buffer: TBuffer,
2593
2647
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2594
2648
  ): void;
2595
2649
  export function read(
2596
2650
  fd: number,
2597
- callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void,
2651
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
2598
2652
  ): void;
2599
2653
  export namespace read {
2600
2654
  /**
@@ -2614,16 +2668,16 @@ declare module "fs" {
2614
2668
  bytesRead: number;
2615
2669
  buffer: TBuffer;
2616
2670
  }>;
2617
- function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2671
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2618
2672
  fd: number,
2619
- options: ReadAsyncOptions<TBuffer>,
2673
+ options: ReadOptionsWithBuffer<TBuffer>,
2620
2674
  ): Promise<{
2621
2675
  bytesRead: number;
2622
2676
  buffer: TBuffer;
2623
2677
  }>;
2624
2678
  function __promisify__(fd: number): Promise<{
2625
2679
  bytesRead: number;
2626
- buffer: NodeJS.ArrayBufferView;
2680
+ buffer: NonSharedBuffer;
2627
2681
  }>;
2628
2682
  }
2629
2683
  /**
@@ -2645,7 +2699,7 @@ declare module "fs" {
2645
2699
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
2646
2700
  * If no `options` object is specified, it will default with the above values.
2647
2701
  */
2648
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
2702
+ export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
2649
2703
  /**
2650
2704
  * Asynchronously reads the entire contents of a file.
2651
2705
  *
@@ -2721,7 +2775,7 @@ declare module "fs" {
2721
2775
  } & Abortable)
2722
2776
  | undefined
2723
2777
  | null,
2724
- callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
2778
+ callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2725
2779
  ): void;
2726
2780
  /**
2727
2781
  * Asynchronously reads the entire contents of a file.
@@ -2756,7 +2810,7 @@ declare module "fs" {
2756
2810
  | BufferEncoding
2757
2811
  | undefined
2758
2812
  | null,
2759
- callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
2813
+ callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void,
2760
2814
  ): void;
2761
2815
  /**
2762
2816
  * Asynchronously reads the entire contents of a file.
@@ -2765,7 +2819,7 @@ declare module "fs" {
2765
2819
  */
2766
2820
  export function readFile(
2767
2821
  path: PathOrFileDescriptor,
2768
- callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
2822
+ callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2769
2823
  ): void;
2770
2824
  export namespace readFile {
2771
2825
  /**
@@ -2781,7 +2835,7 @@ declare module "fs" {
2781
2835
  encoding?: null | undefined;
2782
2836
  flag?: string | undefined;
2783
2837
  } | null,
2784
- ): Promise<Buffer>;
2838
+ ): Promise<NonSharedBuffer>;
2785
2839
  /**
2786
2840
  * Asynchronously reads the entire contents of a file.
2787
2841
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2815,7 +2869,7 @@ declare module "fs" {
2815
2869
  })
2816
2870
  | BufferEncoding
2817
2871
  | null,
2818
- ): Promise<string | Buffer>;
2872
+ ): Promise<string | NonSharedBuffer>;
2819
2873
  }
2820
2874
  /**
2821
2875
  * Returns the contents of the `path`.
@@ -2847,7 +2901,7 @@ declare module "fs" {
2847
2901
  encoding?: null | undefined;
2848
2902
  flag?: string | undefined;
2849
2903
  } | null,
2850
- ): Buffer;
2904
+ ): NonSharedBuffer;
2851
2905
  /**
2852
2906
  * Synchronously reads the entire contents of a file.
2853
2907
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2879,7 +2933,7 @@ declare module "fs" {
2879
2933
  })
2880
2934
  | BufferEncoding
2881
2935
  | null,
2882
- ): string | Buffer;
2936
+ ): string | NonSharedBuffer;
2883
2937
  export type WriteFileOptions =
2884
2938
  | (
2885
2939
  & ObjectEncodingOptions
@@ -3311,7 +3365,7 @@ declare module "fs" {
3311
3365
  encoding: "buffer";
3312
3366
  })
3313
3367
  | "buffer",
3314
- listener?: WatchListener<Buffer>,
3368
+ listener?: WatchListener<NonSharedBuffer>,
3315
3369
  ): FSWatcher;
3316
3370
  /**
3317
3371
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
@@ -3337,7 +3391,7 @@ declare module "fs" {
3337
3391
  export function watch(
3338
3392
  filename: PathLike,
3339
3393
  options: WatchOptions | string,
3340
- listener?: WatchListener<string | Buffer>,
3394
+ listener?: WatchListener<string | NonSharedBuffer>,
3341
3395
  ): FSWatcher;
3342
3396
  /**
3343
3397
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
@@ -4055,27 +4109,29 @@ declare module "fs" {
4055
4109
  * @since v12.9.0
4056
4110
  * @param [position='null']
4057
4111
  */
4058
- export function writev(
4112
+ export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4059
4113
  fd: number,
4060
- buffers: readonly NodeJS.ArrayBufferView[],
4061
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4114
+ buffers: TBuffers,
4115
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4062
4116
  ): void;
4063
- export function writev(
4117
+ export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4064
4118
  fd: number,
4065
- buffers: readonly NodeJS.ArrayBufferView[],
4066
- position: number,
4067
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4119
+ buffers: TBuffers,
4120
+ position: number | null,
4121
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4068
4122
  ): void;
4069
- export interface WriteVResult {
4123
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4124
+ // TODO: remove default in future major version
4125
+ export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4070
4126
  bytesWritten: number;
4071
- buffers: NodeJS.ArrayBufferView[];
4127
+ buffers: T;
4072
4128
  }
4073
4129
  export namespace writev {
4074
- function __promisify__(
4130
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4075
4131
  fd: number,
4076
- buffers: readonly NodeJS.ArrayBufferView[],
4132
+ buffers: TBuffers,
4077
4133
  position?: number,
4078
- ): Promise<WriteVResult>;
4134
+ ): Promise<WriteVResult<TBuffers>>;
4079
4135
  }
4080
4136
  /**
4081
4137
  * For detailed information, see the documentation of the asynchronous version of
@@ -4100,27 +4156,29 @@ declare module "fs" {
4100
4156
  * @since v13.13.0, v12.17.0
4101
4157
  * @param [position='null']
4102
4158
  */
4103
- export function readv(
4159
+ export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4104
4160
  fd: number,
4105
- buffers: readonly NodeJS.ArrayBufferView[],
4106
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4161
+ buffers: TBuffers,
4162
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4107
4163
  ): void;
4108
- export function readv(
4164
+ export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4109
4165
  fd: number,
4110
- buffers: readonly NodeJS.ArrayBufferView[],
4111
- position: number,
4112
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4166
+ buffers: TBuffers,
4167
+ position: number | null,
4168
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4113
4169
  ): void;
4114
- export interface ReadVResult {
4170
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4171
+ // TODO: remove default in future major version
4172
+ export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4115
4173
  bytesRead: number;
4116
- buffers: NodeJS.ArrayBufferView[];
4174
+ buffers: T;
4117
4175
  }
4118
4176
  export namespace readv {
4119
- function __promisify__(
4177
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4120
4178
  fd: number,
4121
- buffers: readonly NodeJS.ArrayBufferView[],
4179
+ buffers: TBuffers,
4122
4180
  position?: number,
4123
- ): Promise<ReadVResult>;
4181
+ ): Promise<ReadVResult<TBuffers>>;
4124
4182
  }
4125
4183
  /**
4126
4184
  * For detailed information, see the documentation of the asynchronous version of
@@ -4175,7 +4233,7 @@ declare module "fs" {
4175
4233
  /**
4176
4234
  * @default false
4177
4235
  */
4178
- recursive?: boolean;
4236
+ recursive?: boolean | undefined;
4179
4237
  }
4180
4238
  /**
4181
4239
  * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
@@ -4228,54 +4286,54 @@ declare module "fs" {
4228
4286
  * Dereference symlinks
4229
4287
  * @default false
4230
4288
  */
4231
- dereference?: boolean;
4289
+ dereference?: boolean | undefined;
4232
4290
  /**
4233
4291
  * When `force` is `false`, and the destination
4234
4292
  * exists, throw an error.
4235
4293
  * @default false
4236
4294
  */
4237
- errorOnExist?: boolean;
4295
+ errorOnExist?: boolean | undefined;
4238
4296
  /**
4239
4297
  * Overwrite existing file or directory. _The copy
4240
4298
  * operation will ignore errors if you set this to false and the destination
4241
4299
  * exists. Use the `errorOnExist` option to change this behavior.
4242
4300
  * @default true
4243
4301
  */
4244
- force?: boolean;
4302
+ force?: boolean | undefined;
4245
4303
  /**
4246
4304
  * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
4247
4305
  */
4248
- mode?: number;
4306
+ mode?: number | undefined;
4249
4307
  /**
4250
4308
  * When `true` timestamps from `src` will
4251
4309
  * be preserved.
4252
4310
  * @default false
4253
4311
  */
4254
- preserveTimestamps?: boolean;
4312
+ preserveTimestamps?: boolean | undefined;
4255
4313
  /**
4256
4314
  * Copy directories recursively.
4257
4315
  * @default false
4258
4316
  */
4259
- recursive?: boolean;
4317
+ recursive?: boolean | undefined;
4260
4318
  /**
4261
4319
  * When true, path resolution for symlinks will be skipped
4262
4320
  * @default false
4263
4321
  */
4264
- verbatimSymlinks?: boolean;
4322
+ verbatimSymlinks?: boolean | undefined;
4265
4323
  }
4266
4324
  export interface CopyOptions extends CopyOptionsBase {
4267
4325
  /**
4268
4326
  * Function to filter copied files/directories. Return
4269
4327
  * `true` to copy the item, `false` to ignore it.
4270
4328
  */
4271
- filter?(source: string, destination: string): boolean | Promise<boolean>;
4329
+ filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4272
4330
  }
4273
4331
  export interface CopySyncOptions extends CopyOptionsBase {
4274
4332
  /**
4275
4333
  * Function to filter copied files/directories. Return
4276
4334
  * `true` to copy the item, `false` to ignore it.
4277
4335
  */
4278
- filter?(source: string, destination: string): boolean;
4336
+ filter?: ((source: string, destination: string) => boolean) | undefined;
4279
4337
  }
4280
4338
  /**
4281
4339
  * Asynchronously copies the entire directory structure from `src` to `dest`,