@psnext/slingcli 3.3.20260911-1 → 3.3.20260914-1

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 (420) hide show
  1. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-VDBOM5UG.js → chunk-BRL3MDQL.js} +1 -1
  2. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
  3. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  4. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  5. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +79 -32
  6. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -0
  7. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +25 -8
  8. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -0
  9. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js +2 -0
  10. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js +23 -8
  11. package/node_modules/@smithy/core/package.json +1 -1
  12. package/node_modules/@types/node/README.md +2 -2
  13. package/node_modules/@types/node/assert/strict.d.ts +13 -56
  14. package/node_modules/@types/node/assert.d.ts +189 -190
  15. package/node_modules/@types/node/async_hooks.d.ts +151 -43
  16. package/node_modules/@types/node/buffer.buffer.d.ts +12 -13
  17. package/node_modules/@types/node/buffer.d.ts +103 -237
  18. package/node_modules/@types/node/child_process.d.ts +39 -154
  19. package/node_modules/@types/node/cluster.d.ts +238 -384
  20. package/node_modules/@types/node/console.d.ts +45 -404
  21. package/node_modules/@types/node/constants.d.ts +3 -10
  22. package/node_modules/@types/node/crypto.d.ts +1000 -1593
  23. package/node_modules/@types/node/dgram.d.ts +133 -81
  24. package/node_modules/@types/node/diagnostics_channel.d.ts +277 -59
  25. package/node_modules/@types/node/dns/promises.d.ts +9 -15
  26. package/node_modules/@types/node/dns.d.ts +136 -183
  27. package/node_modules/@types/node/domain.d.ts +12 -32
  28. package/node_modules/@types/node/events.d.ts +872 -840
  29. package/node_modules/@types/node/ffi.d.ts +486 -0
  30. package/node_modules/@types/node/fs/promises.d.ts +256 -85
  31. package/node_modules/@types/node/fs.d.ts +865 -525
  32. package/node_modules/@types/node/globals.d.ts +12 -34
  33. package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
  34. package/node_modules/@types/node/http.d.ts +433 -312
  35. package/node_modules/@types/node/http2.d.ts +545 -891
  36. package/node_modules/@types/node/https.d.ts +64 -243
  37. package/node_modules/@types/node/index.d.ts +25 -7
  38. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  39. package/node_modules/@types/node/inspector.d.ts +70 -58
  40. package/node_modules/@types/node/inspector.generated.d.ts +764 -410
  41. package/node_modules/@types/node/module.d.ts +54 -219
  42. package/node_modules/@types/node/net.d.ts +208 -222
  43. package/node_modules/@types/node/os.d.ts +41 -49
  44. package/node_modules/@types/node/package.json +13 -3
  45. package/node_modules/@types/node/path/posix.d.ts +8 -0
  46. package/node_modules/@types/node/path/win32.d.ts +8 -0
  47. package/node_modules/@types/node/path.d.ts +119 -141
  48. package/node_modules/@types/node/perf_hooks.d.ts +339 -690
  49. package/node_modules/@types/node/process.d.ts +389 -205
  50. package/node_modules/@types/node/punycode.d.ts +3 -31
  51. package/node_modules/@types/node/querystring.d.ts +3 -16
  52. package/node_modules/@types/node/quic.d.ts +2153 -0
  53. package/node_modules/@types/node/readline/promises.d.ts +3 -6
  54. package/node_modules/@types/node/readline.d.ts +66 -152
  55. package/node_modules/@types/node/repl.d.ts +101 -109
  56. package/node_modules/@types/node/sea.d.ts +1 -116
  57. package/node_modules/@types/node/sqlite.d.ts +486 -68
  58. package/node_modules/@types/node/stream/consumers.d.ts +91 -15
  59. package/node_modules/@types/node/stream/iter.d.ts +452 -0
  60. package/node_modules/@types/node/stream/promises.d.ts +136 -15
  61. package/node_modules/@types/node/stream/web.d.ts +197 -454
  62. package/node_modules/@types/node/stream.d.ts +603 -491
  63. package/node_modules/@types/node/string_decoder.d.ts +3 -43
  64. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  65. package/node_modules/@types/node/test.d.ts +513 -292
  66. package/node_modules/@types/node/timers/promises.d.ts +3 -18
  67. package/node_modules/@types/node/timers.d.ts +3 -141
  68. package/node_modules/@types/node/tls.d.ts +166 -257
  69. package/node_modules/@types/node/trace_events.d.ts +3 -97
  70. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -8
  71. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  72. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
  73. package/node_modules/@types/node/ts5.6/index.d.ts +26 -6
  74. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  75. package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  76. package/node_modules/@types/node/tty.d.ts +61 -43
  77. package/node_modules/@types/node/url.d.ts +156 -584
  78. package/node_modules/@types/node/util/types.d.ts +558 -0
  79. package/node_modules/@types/node/util.d.ts +170 -1099
  80. package/node_modules/@types/node/v8.d.ts +175 -36
  81. package/node_modules/@types/node/vfs.d.ts +211 -0
  82. package/node_modules/@types/node/vm.d.ts +292 -209
  83. package/node_modules/@types/node/wasi.d.ts +24 -74
  84. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  85. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  86. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  87. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  88. package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
  89. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  90. package/node_modules/@types/node/web-globals/events.d.ts +9 -0
  91. package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
  92. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  93. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  94. package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
  95. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  96. package/node_modules/@types/node/web-globals/streams.d.ts +97 -0
  97. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  98. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  99. package/node_modules/@types/node/worker_threads.d.ts +257 -407
  100. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  101. package/node_modules/@types/node/zlib.d.ts +24 -165
  102. package/node_modules/undici-types/agent.d.ts +12 -13
  103. package/node_modules/undici-types/api.d.ts +26 -26
  104. package/node_modules/undici-types/balanced-pool.d.ts +13 -12
  105. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  106. package/node_modules/undici-types/client-stats.d.ts +15 -0
  107. package/node_modules/undici-types/client.d.ts +63 -37
  108. package/node_modules/undici-types/connector.d.ts +5 -2
  109. package/node_modules/undici-types/cookies.d.ts +3 -1
  110. package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
  111. package/node_modules/undici-types/dispatcher.d.ts +136 -139
  112. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  113. package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
  114. package/node_modules/undici-types/errors.d.ts +92 -54
  115. package/node_modules/undici-types/eventsource.d.ts +9 -4
  116. package/node_modules/undici-types/fetch.d.ts +51 -25
  117. package/node_modules/undici-types/formdata.d.ts +7 -7
  118. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  119. package/node_modules/undici-types/global-origin.d.ts +5 -5
  120. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  121. package/node_modules/undici-types/handlers.d.ts +10 -9
  122. package/node_modules/undici-types/header.d.ts +162 -1
  123. package/node_modules/undici-types/index.d.ts +69 -47
  124. package/node_modules/undici-types/interceptors.d.ts +72 -9
  125. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  126. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  127. package/node_modules/undici-types/mock-client.d.ts +6 -4
  128. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  129. package/node_modules/undici-types/mock-interceptor.d.ts +26 -21
  130. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  131. package/node_modules/undici-types/package.json +1 -1
  132. package/node_modules/undici-types/patch.d.ts +0 -4
  133. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  134. package/node_modules/undici-types/pool.d.ts +14 -14
  135. package/node_modules/undici-types/proxy-agent.d.ts +14 -6
  136. package/node_modules/undici-types/readable.d.ts +19 -16
  137. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  138. package/node_modules/undici-types/retry-handler.d.ts +19 -10
  139. package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  140. package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  141. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  142. package/node_modules/undici-types/util.d.ts +3 -3
  143. package/node_modules/undici-types/utility.d.ts +7 -0
  144. package/node_modules/undici-types/webidl.d.ts +148 -30
  145. package/node_modules/undici-types/websocket.d.ts +48 -10
  146. package/node_modules/zod/README.md +2 -2
  147. package/node_modules/zod/package.json +1 -1
  148. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  149. package/node_modules/zod/src/v4/classic/schemas.ts +14 -30
  150. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +1 -0
  151. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +2 -11
  152. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -4
  153. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +22 -0
  154. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +1 -1
  155. package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
  156. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +53 -137
  157. package/node_modules/zod/src/v4/classic/tests/string.test.ts +70 -1
  158. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +87 -35
  159. package/node_modules/zod/src/v4/core/api.ts +21 -29
  160. package/node_modules/zod/src/v4/core/checks.ts +61 -1
  161. package/node_modules/zod/src/v4/core/compile.ts +35 -24
  162. package/node_modules/zod/src/v4/core/core.ts +1 -3
  163. package/node_modules/zod/src/v4/core/json-schema-processors.ts +9 -63
  164. package/node_modules/zod/src/v4/core/memoizer.ts +2 -5
  165. package/node_modules/zod/src/v4/core/regexes.ts +4 -0
  166. package/node_modules/zod/src/v4/core/schemas.ts +36 -109
  167. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
  168. package/node_modules/zod/src/v4/core/tests/compile.test.ts +177 -0
  169. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  170. package/node_modules/zod/src/v4/core/to-json-schema.ts +1 -1
  171. package/node_modules/zod/src/v4/core/util.ts +0 -4
  172. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  173. package/node_modules/zod/src/v4/core/visit.ts +0 -11
  174. package/node_modules/zod/src/v4/locales/ar.ts +1 -0
  175. package/node_modules/zod/src/v4/locales/az.ts +1 -0
  176. package/node_modules/zod/src/v4/locales/be.ts +1 -0
  177. package/node_modules/zod/src/v4/locales/bg.ts +1 -0
  178. package/node_modules/zod/src/v4/locales/bn.ts +1 -0
  179. package/node_modules/zod/src/v4/locales/ca.ts +1 -0
  180. package/node_modules/zod/src/v4/locales/ckb.ts +1 -0
  181. package/node_modules/zod/src/v4/locales/cs.ts +1 -0
  182. package/node_modules/zod/src/v4/locales/da.ts +1 -0
  183. package/node_modules/zod/src/v4/locales/de.ts +1 -0
  184. package/node_modules/zod/src/v4/locales/el.ts +1 -0
  185. package/node_modules/zod/src/v4/locales/en.ts +1 -0
  186. package/node_modules/zod/src/v4/locales/eo.ts +1 -0
  187. package/node_modules/zod/src/v4/locales/es.ts +1 -0
  188. package/node_modules/zod/src/v4/locales/fa.ts +1 -0
  189. package/node_modules/zod/src/v4/locales/fi.ts +1 -0
  190. package/node_modules/zod/src/v4/locales/fr-CA.ts +1 -0
  191. package/node_modules/zod/src/v4/locales/fr.ts +1 -0
  192. package/node_modules/zod/src/v4/locales/gu.ts +1 -0
  193. package/node_modules/zod/src/v4/locales/he.ts +1 -0
  194. package/node_modules/zod/src/v4/locales/hi.ts +1 -0
  195. package/node_modules/zod/src/v4/locales/hr.ts +1 -0
  196. package/node_modules/zod/src/v4/locales/hu.ts +1 -0
  197. package/node_modules/zod/src/v4/locales/hy.ts +1 -0
  198. package/node_modules/zod/src/v4/locales/id.ts +1 -0
  199. package/node_modules/zod/src/v4/locales/is.ts +1 -0
  200. package/node_modules/zod/src/v4/locales/it.ts +1 -0
  201. package/node_modules/zod/src/v4/locales/ja.ts +1 -0
  202. package/node_modules/zod/src/v4/locales/ka.ts +1 -0
  203. package/node_modules/zod/src/v4/locales/km.ts +1 -0
  204. package/node_modules/zod/src/v4/locales/kn.ts +1 -0
  205. package/node_modules/zod/src/v4/locales/ko.ts +1 -0
  206. package/node_modules/zod/src/v4/locales/lt.ts +1 -0
  207. package/node_modules/zod/src/v4/locales/mk.ts +1 -0
  208. package/node_modules/zod/src/v4/locales/ms.ts +1 -0
  209. package/node_modules/zod/src/v4/locales/ne.ts +1 -0
  210. package/node_modules/zod/src/v4/locales/nl.ts +1 -0
  211. package/node_modules/zod/src/v4/locales/nn.ts +1 -0
  212. package/node_modules/zod/src/v4/locales/no.ts +1 -0
  213. package/node_modules/zod/src/v4/locales/ota.ts +1 -0
  214. package/node_modules/zod/src/v4/locales/pl.ts +1 -0
  215. package/node_modules/zod/src/v4/locales/ps.ts +1 -0
  216. package/node_modules/zod/src/v4/locales/pt-BR.ts +1 -0
  217. package/node_modules/zod/src/v4/locales/pt.ts +1 -0
  218. package/node_modules/zod/src/v4/locales/ro.ts +1 -0
  219. package/node_modules/zod/src/v4/locales/ru.ts +1 -0
  220. package/node_modules/zod/src/v4/locales/sk.ts +1 -0
  221. package/node_modules/zod/src/v4/locales/sl.ts +1 -0
  222. package/node_modules/zod/src/v4/locales/sv.ts +1 -0
  223. package/node_modules/zod/src/v4/locales/ta.ts +1 -0
  224. package/node_modules/zod/src/v4/locales/tg.ts +1 -0
  225. package/node_modules/zod/src/v4/locales/th.ts +1 -0
  226. package/node_modules/zod/src/v4/locales/tk.ts +1 -0
  227. package/node_modules/zod/src/v4/locales/tr.ts +1 -0
  228. package/node_modules/zod/src/v4/locales/uk.ts +1 -0
  229. package/node_modules/zod/src/v4/locales/ur.ts +1 -0
  230. package/node_modules/zod/src/v4/locales/uz.ts +1 -0
  231. package/node_modules/zod/src/v4/locales/vi.ts +1 -0
  232. package/node_modules/zod/src/v4/locales/yo.ts +1 -0
  233. package/node_modules/zod/src/v4/locales/zh-CN.ts +1 -0
  234. package/node_modules/zod/src/v4/locales/zh-TW.ts +1 -0
  235. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  236. package/node_modules/zod/src/v4/mini/schemas.ts +12 -23
  237. package/node_modules/zod/src/v4/mini/tests/index.test.ts +56 -0
  238. package/node_modules/zod/src/v4/mini/tests/string.test.ts +7 -0
  239. package/node_modules/zod/v4/classic/checks.cjs +2 -1
  240. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  241. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  242. package/node_modules/zod/v4/classic/checks.js +1 -1
  243. package/node_modules/zod/v4/classic/schemas.cjs +11 -15
  244. package/node_modules/zod/v4/classic/schemas.d.cts +4 -6
  245. package/node_modules/zod/v4/classic/schemas.d.ts +4 -6
  246. package/node_modules/zod/v4/classic/schemas.js +9 -13
  247. package/node_modules/zod/v4/core/api.cjs +11 -23
  248. package/node_modules/zod/v4/core/api.d.cts +8 -4
  249. package/node_modules/zod/v4/core/api.d.ts +8 -4
  250. package/node_modules/zod/v4/core/api.js +11 -23
  251. package/node_modules/zod/v4/core/checks.cjs +32 -1
  252. package/node_modules/zod/v4/core/checks.d.cts +16 -0
  253. package/node_modules/zod/v4/core/checks.d.ts +16 -0
  254. package/node_modules/zod/v4/core/checks.js +31 -0
  255. package/node_modules/zod/v4/core/compile.cjs +12 -17
  256. package/node_modules/zod/v4/core/compile.js +13 -18
  257. package/node_modules/zod/v4/core/core.cjs +1 -1
  258. package/node_modules/zod/v4/core/core.js +1 -1
  259. package/node_modules/zod/v4/core/json-schema-processors.cjs +8 -44
  260. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -1
  261. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -1
  262. package/node_modules/zod/v4/core/json-schema-processors.js +8 -43
  263. package/node_modules/zod/v4/core/memoizer.cjs +2 -5
  264. package/node_modules/zod/v4/core/memoizer.js +2 -5
  265. package/node_modules/zod/v4/core/regexes.cjs +4 -2
  266. package/node_modules/zod/v4/core/regexes.d.cts +1 -0
  267. package/node_modules/zod/v4/core/regexes.d.ts +1 -0
  268. package/node_modules/zod/v4/core/regexes.js +2 -0
  269. package/node_modules/zod/v4/core/schemas.cjs +33 -73
  270. package/node_modules/zod/v4/core/schemas.d.cts +7 -22
  271. package/node_modules/zod/v4/core/schemas.d.ts +7 -22
  272. package/node_modules/zod/v4/core/schemas.js +30 -72
  273. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -1
  274. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -3
  275. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -3
  276. package/node_modules/zod/v4/core/to-json-schema.js +1 -1
  277. package/node_modules/zod/v4/core/util.cjs +0 -4
  278. package/node_modules/zod/v4/core/util.js +0 -4
  279. package/node_modules/zod/v4/core/versions.cjs +1 -1
  280. package/node_modules/zod/v4/core/versions.js +1 -1
  281. package/node_modules/zod/v4/core/visit.cjs +0 -12
  282. package/node_modules/zod/v4/core/visit.js +0 -12
  283. package/node_modules/zod/v4/locales/ar.cjs +1 -0
  284. package/node_modules/zod/v4/locales/ar.js +1 -0
  285. package/node_modules/zod/v4/locales/az.cjs +1 -0
  286. package/node_modules/zod/v4/locales/az.js +1 -0
  287. package/node_modules/zod/v4/locales/be.cjs +1 -0
  288. package/node_modules/zod/v4/locales/be.js +1 -0
  289. package/node_modules/zod/v4/locales/bg.cjs +1 -0
  290. package/node_modules/zod/v4/locales/bg.js +1 -0
  291. package/node_modules/zod/v4/locales/bn.cjs +1 -0
  292. package/node_modules/zod/v4/locales/bn.js +1 -0
  293. package/node_modules/zod/v4/locales/ca.cjs +1 -0
  294. package/node_modules/zod/v4/locales/ca.js +1 -0
  295. package/node_modules/zod/v4/locales/ckb.cjs +1 -0
  296. package/node_modules/zod/v4/locales/ckb.js +1 -0
  297. package/node_modules/zod/v4/locales/cs.cjs +1 -0
  298. package/node_modules/zod/v4/locales/cs.js +1 -0
  299. package/node_modules/zod/v4/locales/da.cjs +1 -0
  300. package/node_modules/zod/v4/locales/da.js +1 -0
  301. package/node_modules/zod/v4/locales/de.cjs +1 -0
  302. package/node_modules/zod/v4/locales/de.js +1 -0
  303. package/node_modules/zod/v4/locales/el.cjs +1 -0
  304. package/node_modules/zod/v4/locales/el.js +1 -0
  305. package/node_modules/zod/v4/locales/en.cjs +1 -0
  306. package/node_modules/zod/v4/locales/en.js +1 -0
  307. package/node_modules/zod/v4/locales/eo.cjs +1 -0
  308. package/node_modules/zod/v4/locales/eo.js +1 -0
  309. package/node_modules/zod/v4/locales/es.cjs +1 -0
  310. package/node_modules/zod/v4/locales/es.js +1 -0
  311. package/node_modules/zod/v4/locales/fa.cjs +1 -0
  312. package/node_modules/zod/v4/locales/fa.js +1 -0
  313. package/node_modules/zod/v4/locales/fi.cjs +1 -0
  314. package/node_modules/zod/v4/locales/fi.js +1 -0
  315. package/node_modules/zod/v4/locales/fr-CA.cjs +1 -0
  316. package/node_modules/zod/v4/locales/fr-CA.js +1 -0
  317. package/node_modules/zod/v4/locales/fr.cjs +1 -0
  318. package/node_modules/zod/v4/locales/fr.js +1 -0
  319. package/node_modules/zod/v4/locales/gu.cjs +1 -0
  320. package/node_modules/zod/v4/locales/gu.js +1 -0
  321. package/node_modules/zod/v4/locales/he.cjs +1 -0
  322. package/node_modules/zod/v4/locales/he.js +1 -0
  323. package/node_modules/zod/v4/locales/hi.cjs +1 -0
  324. package/node_modules/zod/v4/locales/hi.js +1 -0
  325. package/node_modules/zod/v4/locales/hr.cjs +1 -0
  326. package/node_modules/zod/v4/locales/hr.js +1 -0
  327. package/node_modules/zod/v4/locales/hu.cjs +1 -0
  328. package/node_modules/zod/v4/locales/hu.js +1 -0
  329. package/node_modules/zod/v4/locales/hy.cjs +1 -0
  330. package/node_modules/zod/v4/locales/hy.js +1 -0
  331. package/node_modules/zod/v4/locales/id.cjs +1 -0
  332. package/node_modules/zod/v4/locales/id.js +1 -0
  333. package/node_modules/zod/v4/locales/is.cjs +1 -0
  334. package/node_modules/zod/v4/locales/is.js +1 -0
  335. package/node_modules/zod/v4/locales/it.cjs +1 -0
  336. package/node_modules/zod/v4/locales/it.js +1 -0
  337. package/node_modules/zod/v4/locales/ja.cjs +1 -0
  338. package/node_modules/zod/v4/locales/ja.js +1 -0
  339. package/node_modules/zod/v4/locales/ka.cjs +1 -0
  340. package/node_modules/zod/v4/locales/ka.js +1 -0
  341. package/node_modules/zod/v4/locales/km.cjs +1 -0
  342. package/node_modules/zod/v4/locales/km.js +1 -0
  343. package/node_modules/zod/v4/locales/kn.cjs +1 -0
  344. package/node_modules/zod/v4/locales/kn.js +1 -0
  345. package/node_modules/zod/v4/locales/ko.cjs +1 -0
  346. package/node_modules/zod/v4/locales/ko.js +1 -0
  347. package/node_modules/zod/v4/locales/lt.cjs +1 -0
  348. package/node_modules/zod/v4/locales/lt.js +1 -0
  349. package/node_modules/zod/v4/locales/mk.cjs +1 -0
  350. package/node_modules/zod/v4/locales/mk.js +1 -0
  351. package/node_modules/zod/v4/locales/ms.cjs +1 -0
  352. package/node_modules/zod/v4/locales/ms.js +1 -0
  353. package/node_modules/zod/v4/locales/ne.cjs +1 -0
  354. package/node_modules/zod/v4/locales/ne.js +1 -0
  355. package/node_modules/zod/v4/locales/nl.cjs +1 -0
  356. package/node_modules/zod/v4/locales/nl.js +1 -0
  357. package/node_modules/zod/v4/locales/nn.cjs +1 -0
  358. package/node_modules/zod/v4/locales/nn.js +1 -0
  359. package/node_modules/zod/v4/locales/no.cjs +1 -0
  360. package/node_modules/zod/v4/locales/no.js +1 -0
  361. package/node_modules/zod/v4/locales/ota.cjs +1 -0
  362. package/node_modules/zod/v4/locales/ota.js +1 -0
  363. package/node_modules/zod/v4/locales/pl.cjs +1 -0
  364. package/node_modules/zod/v4/locales/pl.js +1 -0
  365. package/node_modules/zod/v4/locales/ps.cjs +1 -0
  366. package/node_modules/zod/v4/locales/ps.js +1 -0
  367. package/node_modules/zod/v4/locales/pt-BR.cjs +1 -0
  368. package/node_modules/zod/v4/locales/pt-BR.js +1 -0
  369. package/node_modules/zod/v4/locales/pt.cjs +1 -0
  370. package/node_modules/zod/v4/locales/pt.js +1 -0
  371. package/node_modules/zod/v4/locales/ro.cjs +1 -0
  372. package/node_modules/zod/v4/locales/ro.js +1 -0
  373. package/node_modules/zod/v4/locales/ru.cjs +1 -0
  374. package/node_modules/zod/v4/locales/ru.js +1 -0
  375. package/node_modules/zod/v4/locales/sk.cjs +1 -0
  376. package/node_modules/zod/v4/locales/sk.js +1 -0
  377. package/node_modules/zod/v4/locales/sl.cjs +1 -0
  378. package/node_modules/zod/v4/locales/sl.js +1 -0
  379. package/node_modules/zod/v4/locales/sv.cjs +1 -0
  380. package/node_modules/zod/v4/locales/sv.js +1 -0
  381. package/node_modules/zod/v4/locales/ta.cjs +1 -0
  382. package/node_modules/zod/v4/locales/ta.js +1 -0
  383. package/node_modules/zod/v4/locales/tg.cjs +1 -0
  384. package/node_modules/zod/v4/locales/tg.js +1 -0
  385. package/node_modules/zod/v4/locales/th.cjs +1 -0
  386. package/node_modules/zod/v4/locales/th.js +1 -0
  387. package/node_modules/zod/v4/locales/tk.cjs +1 -0
  388. package/node_modules/zod/v4/locales/tk.js +1 -0
  389. package/node_modules/zod/v4/locales/tr.cjs +1 -0
  390. package/node_modules/zod/v4/locales/tr.js +1 -0
  391. package/node_modules/zod/v4/locales/uk.cjs +1 -0
  392. package/node_modules/zod/v4/locales/uk.js +1 -0
  393. package/node_modules/zod/v4/locales/ur.cjs +1 -0
  394. package/node_modules/zod/v4/locales/ur.js +1 -0
  395. package/node_modules/zod/v4/locales/uz.cjs +1 -0
  396. package/node_modules/zod/v4/locales/uz.js +1 -0
  397. package/node_modules/zod/v4/locales/vi.cjs +1 -0
  398. package/node_modules/zod/v4/locales/vi.js +1 -0
  399. package/node_modules/zod/v4/locales/yo.cjs +1 -0
  400. package/node_modules/zod/v4/locales/yo.js +1 -0
  401. package/node_modules/zod/v4/locales/zh-CN.cjs +1 -0
  402. package/node_modules/zod/v4/locales/zh-CN.js +1 -0
  403. package/node_modules/zod/v4/locales/zh-TW.cjs +1 -0
  404. package/node_modules/zod/v4/locales/zh-TW.js +1 -0
  405. package/node_modules/zod/v4/mini/checks.cjs +2 -1
  406. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  407. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  408. package/node_modules/zod/v4/mini/checks.js +1 -1
  409. package/node_modules/zod/v4/mini/schemas.cjs +11 -13
  410. package/node_modules/zod/v4/mini/schemas.d.cts +1 -4
  411. package/node_modules/zod/v4/mini/schemas.d.ts +1 -4
  412. package/node_modules/zod/v4/mini/schemas.js +9 -11
  413. package/package.json +2 -2
  414. package/slingshot/index.js +183 -182
  415. package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  416. package/node_modules/@types/node/compatibility/index.d.ts +0 -9
  417. package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  418. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  419. package/node_modules/undici-types/file.d.ts +0 -39
  420. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,49 +1,28 @@
1
- /**
2
- * The `node:fs` module enables interacting with the file system in a
3
- * way modeled on standard POSIX functions.
4
- *
5
- * To use the promise-based APIs:
6
- *
7
- * ```js
8
- * import * as fs from 'node:fs/promises';
9
- * ```
10
- *
11
- * To use the callback and sync APIs:
12
- *
13
- * ```js
14
- * import * as fs from 'node:fs';
15
- * ```
16
- *
17
- * All file system operations have synchronous, callback, and promise-based
18
- * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
19
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js)
20
- */
21
- declare module "fs" {
22
- import { NonSharedBuffer } from "node:buffer";
1
+ declare module "node:fs" {
2
+ import { BufferView, NonSharedBuffer } from "node:buffer";
3
+ import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
4
+ import { FileHandle } from "node:fs/promises";
23
5
  import * as stream from "node:stream";
24
- import { Abortable, EventEmitter } from "node:events";
25
6
  import { URL } from "node:url";
26
- import * as promises from "node:fs/promises";
27
- export { promises };
28
7
  /**
29
8
  * Valid types for path values in "fs".
30
9
  */
31
- export type PathLike = string | Buffer | URL;
32
- export type PathOrFileDescriptor = PathLike | number;
33
- export type TimeLike = string | number | Date;
34
- export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
35
- export type BufferEncodingOption =
10
+ type PathLike = string | Buffer | URL;
11
+ type PathOrFileDescriptor = PathLike | number;
12
+ type TimeLike = string | number | Date;
13
+ type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
14
+ type BufferEncodingOption =
36
15
  | "buffer"
37
16
  | {
38
17
  encoding: "buffer";
39
18
  };
40
- export interface ObjectEncodingOptions {
19
+ interface ObjectEncodingOptions {
41
20
  encoding?: BufferEncoding | null | undefined;
42
21
  }
43
- export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
44
- export type OpenMode = number | string;
45
- export type Mode = number | string;
46
- export interface StatsBase<T> {
22
+ type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
23
+ type OpenMode = number | string;
24
+ type Mode = number | string;
25
+ interface StatsBase<T> {
47
26
  isFile(): boolean;
48
27
  isDirectory(): boolean;
49
28
  isBlockDevice(): boolean;
@@ -69,8 +48,15 @@ declare module "fs" {
69
48
  mtime: Date;
70
49
  ctime: Date;
71
50
  birthtime: Date;
51
+ // Deliberately not defining a type alias here... it'd be exported, and something in the ecosystem would inevitably start using it.
52
+ // TODO: replace with Temporal builtins once @types/node no longer supports TS <6.0.
53
+ atimeInstant: typeof globalThis extends { Temporal: { Instant: new(...args: any[]) => infer T } } ? T : unknown;
54
+ mtimeInstant: typeof globalThis extends { Temporal: { Instant: new(...args: any[]) => infer T } } ? T : unknown;
55
+ ctimeInstant: typeof globalThis extends { Temporal: { Instant: new(...args: any[]) => infer T } } ? T : unknown;
56
+ birthtimeInstant: typeof globalThis extends { Temporal: { Instant: new(...args: any[]) => infer T } } ? T
57
+ : unknown;
72
58
  }
73
- export interface Stats extends StatsBase<number> {}
59
+ interface Stats extends StatsBase<number> {}
74
60
  /**
75
61
  * A `fs.Stats` object provides information about a file.
76
62
  *
@@ -131,10 +117,10 @@ declare module "fs" {
131
117
  * ```
132
118
  * @since v0.1.21
133
119
  */
134
- export class Stats {
120
+ class Stats {
135
121
  private constructor();
136
122
  }
137
- export interface StatsFsBase<T> {
123
+ interface StatsFsBase<T> {
138
124
  /** Type of file system. */
139
125
  type: T;
140
126
  /** Optimal transfer block size. */
@@ -147,10 +133,12 @@ declare module "fs" {
147
133
  bavail: T;
148
134
  /** Total file nodes in file system. */
149
135
  files: T;
136
+ /** Fundamental file system block size. */
137
+ frsize: T;
150
138
  /** Free file nodes in file system. */
151
139
  ffree: T;
152
140
  }
153
- export interface StatsFs extends StatsFsBase<number> {}
141
+ interface StatsFs extends StatsFsBase<number> {}
154
142
  /**
155
143
  * Provides information about a mounted file system.
156
144
  *
@@ -185,9 +173,9 @@ declare module "fs" {
185
173
  * ```
186
174
  * @since v19.6.0, v18.15.0
187
175
  */
188
- export class StatsFs {}
189
- export interface BigIntStatsFs extends StatsFsBase<bigint> {}
190
- export interface StatFsOptions {
176
+ class StatsFs {}
177
+ interface BigIntStatsFs extends StatsFsBase<bigint> {}
178
+ interface StatFsOptions {
191
179
  bigint?: boolean | undefined;
192
180
  }
193
181
  /**
@@ -199,7 +187,7 @@ declare module "fs" {
199
187
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
200
188
  * @since v10.10.0
201
189
  */
202
- export class Dirent<Name extends string | Buffer = string> {
190
+ class Dirent<Name extends string | Buffer = string> {
203
191
  /**
204
192
  * Returns `true` if the `fs.Dirent` object describes a regular file.
205
193
  * @since v10.10.0
@@ -248,12 +236,6 @@ declare module "fs" {
248
236
  * @since v20.12.0, v18.20.0
249
237
  */
250
238
  parentPath: string;
251
- /**
252
- * Alias for `dirent.parentPath`.
253
- * @since v20.1.0
254
- * @deprecated Since v20.12.0
255
- */
256
- path: string;
257
239
  }
258
240
  /**
259
241
  * A class representing a directory stream.
@@ -276,7 +258,7 @@ declare module "fs" {
276
258
  * closed after the iterator exits.
277
259
  * @since v12.12.0
278
260
  */
279
- export class Dir implements AsyncIterable<Dirent> {
261
+ class Dir implements AsyncIterable<Dirent> {
280
262
  /**
281
263
  * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
282
264
  * @since v12.12.0
@@ -332,15 +314,13 @@ declare module "fs" {
332
314
  /**
333
315
  * Calls `dir.close()` if the directory handle is open, and returns a promise that
334
316
  * fulfills when disposal is complete.
335
- * @since v22.17.0
336
- * @experimental
317
+ * @since v24.1.0
337
318
  */
338
319
  [Symbol.asyncDispose](): Promise<void>;
339
320
  /**
340
321
  * Calls `dir.closeSync()` if the directory handle is open, and returns
341
322
  * `undefined`.
342
- * @since v22.17.0
343
- * @experimental
323
+ * @since v24.1.0
344
324
  */
345
325
  [Symbol.dispose](): void;
346
326
  }
@@ -350,7 +330,7 @@ declare module "fs" {
350
330
  * Extends `EventEmitter`
351
331
  * A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
352
332
  */
353
- export interface StatWatcher extends EventEmitter {
333
+ interface StatWatcher extends EventEmitter {
354
334
  /**
355
335
  * 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
356
336
  * no effect.
@@ -371,7 +351,12 @@ declare module "fs" {
371
351
  */
372
352
  unref(): this;
373
353
  }
374
- export interface FSWatcher extends EventEmitter {
354
+ interface FSWatcherEventMap {
355
+ "change": [eventType: string, filename: string | NonSharedBuffer];
356
+ "close": [];
357
+ "error": [error: Error];
358
+ }
359
+ interface FSWatcher extends InternalEventEmitter<FSWatcherEventMap> {
375
360
  /**
376
361
  * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
377
362
  * @since v0.5.8
@@ -396,44 +381,19 @@ declare module "fs" {
396
381
  * @since v14.3.0, v12.20.0
397
382
  */
398
383
  unref(): this;
399
- /**
400
- * events.EventEmitter
401
- * 1. change
402
- * 2. close
403
- * 3. error
404
- */
405
- addListener(event: string, listener: (...args: any[]) => void): this;
406
- addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
407
- addListener(event: "close", listener: () => void): this;
408
- addListener(event: "error", listener: (error: Error) => void): this;
409
- on(event: string, listener: (...args: any[]) => void): this;
410
- on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
411
- on(event: "close", listener: () => void): this;
412
- on(event: "error", listener: (error: Error) => void): this;
413
- once(event: string, listener: (...args: any[]) => void): this;
414
- once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
415
- once(event: "close", listener: () => void): this;
416
- once(event: "error", listener: (error: Error) => void): this;
417
- prependListener(event: string, listener: (...args: any[]) => void): this;
418
- prependListener(
419
- event: "change",
420
- listener: (eventType: string, filename: string | NonSharedBuffer) => void,
421
- ): this;
422
- prependListener(event: "close", listener: () => void): this;
423
- prependListener(event: "error", listener: (error: Error) => void): this;
424
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
425
- prependOnceListener(
426
- event: "change",
427
- listener: (eventType: string, filename: string | NonSharedBuffer) => void,
428
- ): this;
429
- prependOnceListener(event: "close", listener: () => void): this;
430
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
384
+ }
385
+ interface ReadStreamEventMap extends stream.ReadableEventMap {
386
+ "close": [];
387
+ "data": [chunk: string | NonSharedBuffer];
388
+ "open": [fd: number];
389
+ "ready": [];
431
390
  }
432
391
  /**
433
- * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
392
+ * Instances of `fs.ReadStream` cannot be constructed directly. They are created and
393
+ * returned using the `fs.createReadStream()` function.
434
394
  * @since v0.1.93
435
395
  */
436
- export class ReadStream extends stream.Readable {
396
+ class ReadStream extends stream.Readable {
437
397
  close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
438
398
  /**
439
399
  * The number of bytes that have been read so far.
@@ -453,60 +413,251 @@ declare module "fs" {
453
413
  * @since v11.2.0, v10.16.0
454
414
  */
455
415
  pending: boolean;
416
+ // #region InternalEventEmitter
417
+ addListener<E extends keyof ReadStreamEventMap>(
418
+ eventName: E,
419
+ listener: (...args: ReadStreamEventMap[E]) => void,
420
+ ): this;
421
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
422
+ emit<E extends keyof ReadStreamEventMap>(eventName: E, ...args: ReadStreamEventMap[E]): boolean;
423
+ emit(eventName: string | symbol, ...args: any[]): boolean;
424
+ listenerCount<E extends keyof ReadStreamEventMap>(
425
+ eventName: E,
426
+ listener?: (...args: ReadStreamEventMap[E]) => void,
427
+ ): number;
428
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
429
+ listeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
430
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
431
+ off<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
432
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
433
+ on<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
434
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
435
+ once<E extends keyof ReadStreamEventMap>(
436
+ eventName: E,
437
+ listener: (...args: ReadStreamEventMap[E]) => void,
438
+ ): this;
439
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
440
+ prependListener<E extends keyof ReadStreamEventMap>(
441
+ eventName: E,
442
+ listener: (...args: ReadStreamEventMap[E]) => void,
443
+ ): this;
444
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
445
+ prependOnceListener<E extends keyof ReadStreamEventMap>(
446
+ eventName: E,
447
+ listener: (...args: ReadStreamEventMap[E]) => void,
448
+ ): this;
449
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
450
+ rawListeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
451
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
452
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
453
+ removeAllListeners<E extends keyof ReadStreamEventMap>(eventName?: E): this;
454
+ removeAllListeners(eventName?: string | symbol): this;
455
+ removeListener<E extends keyof ReadStreamEventMap>(
456
+ eventName: E,
457
+ listener: (...args: ReadStreamEventMap[E]) => void,
458
+ ): this;
459
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
460
+ // #endregion
461
+ }
462
+ interface Utf8StreamOptions {
463
+ /**
464
+ * Appends writes to dest file instead of truncating it.
465
+ * @default true
466
+ */
467
+ append?: boolean | undefined;
468
+ /**
469
+ * Which type of data you can send to the write
470
+ * function, supported values are `'utf8'` or `'buffer'`.
471
+ * @default 'utf8'
472
+ */
473
+ contentMode?: "utf8" | "buffer" | undefined;
474
+ /**
475
+ * A path to a file to be written to (mode controlled by the
476
+ * append option).
477
+ */
478
+ dest?: string | undefined;
479
+ /**
480
+ * A file descriptor, something that is returned by `fs.open()`
481
+ * or `fs.openSync()`.
482
+ */
483
+ fd?: number | undefined;
484
+ /**
485
+ * An object that has the same API as the `fs` module, useful
486
+ * for mocking, testing, or customizing the behavior of the stream.
487
+ */
488
+ fs?: object | undefined;
489
+ /**
490
+ * Perform a `fs.fsyncSync()` every time a write is
491
+ * completed.
492
+ */
493
+ fsync?: boolean | undefined;
494
+ /**
495
+ * The maximum length of the internal buffer. If a write
496
+ * operation would cause the buffer to exceed `maxLength`, the data written is
497
+ * dropped and a drop event is emitted with the dropped data
498
+ */
499
+ maxLength?: number | undefined;
500
+ /**
501
+ * The maximum number of bytes that can be written;
502
+ * @default 16384
503
+ */
504
+ maxWrite?: number | undefined;
505
+ /**
506
+ * The minimum length of the internal buffer that is
507
+ * required to be full before flushing.
508
+ */
509
+ minLength?: number | undefined;
510
+ /**
511
+ * Ensure directory for `dest` file exists when true.
512
+ * @default false
513
+ */
514
+ mkdir?: boolean | undefined;
515
+ /**
516
+ * Specify the creating file mode (see `fs.open()`).
517
+ */
518
+ mode?: number | string | undefined;
456
519
  /**
457
- * events.EventEmitter
458
- * 1. open
459
- * 2. close
460
- * 3. ready
520
+ * Calls flush every `periodicFlush` milliseconds.
461
521
  */
462
- addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
463
- on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
464
- once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
465
- prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
466
- prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
522
+ periodicFlush?: number | undefined;
523
+ /**
524
+ * A function that will be called when `write()`,
525
+ * `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
526
+ * If the return value is `true` the operation will be retried, otherwise it
527
+ * will bubble the error. The `err` is the error that caused this function to
528
+ * be called, `writeBufferLen` is the length of the buffer that was written,
529
+ * and `remainingBufferLen` is the length of the remaining buffer that the
530
+ * stream did not try to write.
531
+ */
532
+ retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
533
+ /**
534
+ * Perform writes synchronously.
535
+ */
536
+ sync?: boolean | undefined;
537
+ }
538
+ interface Utf8StreamEventMap {
539
+ "close": [];
540
+ "drain": [];
541
+ "drop": [data: string | Buffer];
542
+ "error": [error: Error];
543
+ "finish": [];
544
+ "ready": [];
545
+ "write": [n: number];
467
546
  }
468
-
469
- /**
470
- * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
471
- */
472
- type ReadStreamEvents = {
473
- close: () => void;
474
- data: (chunk: Buffer | string) => void;
475
- end: () => void;
476
- error: (err: Error) => void;
477
- open: (fd: number) => void;
478
- pause: () => void;
479
- readable: () => void;
480
- ready: () => void;
481
- resume: () => void;
482
- } & CustomEvents;
483
-
484
- /**
485
- * string & {} allows to allow any kind of strings for the event
486
- * but still allows to have auto completion for the normal events.
487
- */
488
- type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
489
-
490
547
  /**
491
- * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
548
+ * An optimized UTF-8 stream writer that allows for flushing all the internal
549
+ * buffering on demand. It handles `EAGAIN` errors correctly, allowing for
550
+ * customization, for example, by dropping content if the disk is busy.
551
+ * @since v24.6.0
552
+ * @experimental
492
553
  */
493
- type WriteStreamEvents = {
494
- close: () => void;
495
- drain: () => void;
496
- error: (err: Error) => void;
497
- finish: () => void;
498
- open: (fd: number) => void;
499
- pipe: (src: stream.Readable) => void;
500
- ready: () => void;
501
- unpipe: (src: stream.Readable) => void;
502
- } & CustomEvents;
554
+ class Utf8Stream implements EventEmitter {
555
+ constructor(options: Utf8StreamOptions);
556
+ /**
557
+ * Whether the stream is appending to the file or truncating it.
558
+ */
559
+ readonly append: boolean;
560
+ /**
561
+ * The type of data that can be written to the stream. Supported
562
+ * values are `'utf8'` or `'buffer'`.
563
+ * @default 'utf8'
564
+ */
565
+ readonly contentMode: "utf8" | "buffer";
566
+ /**
567
+ * Close the stream immediately, without flushing the internal buffer.
568
+ */
569
+ destroy(): void;
570
+ /**
571
+ * Close the stream gracefully, flushing the internal buffer before closing.
572
+ */
573
+ end(): void;
574
+ /**
575
+ * The file descriptor that is being written to.
576
+ */
577
+ readonly fd: number;
578
+ /**
579
+ * The file that is being written to.
580
+ */
581
+ readonly file: string;
582
+ /**
583
+ * Writes the current buffer to the file if a write was not in progress. Do
584
+ * nothing if `minLength` is zero or if it is already writing.
585
+ */
586
+ flush(callback: (err: Error | null) => void): void;
587
+ /**
588
+ * Flushes the buffered data synchronously. This is a costly operation.
589
+ */
590
+ flushSync(): void;
591
+ /**
592
+ * Whether the stream is performing a `fs.fsyncSync()` after every
593
+ * write operation.
594
+ */
595
+ readonly fsync: boolean;
596
+ /**
597
+ * The maximum length of the internal buffer. If a write
598
+ * operation would cause the buffer to exceed `maxLength`, the data written is
599
+ * dropped and a drop event is emitted with the dropped data.
600
+ */
601
+ readonly maxLength: number;
602
+ /**
603
+ * The minimum length of the internal buffer that is required to be
604
+ * full before flushing.
605
+ */
606
+ readonly minLength: number;
607
+ /**
608
+ * Whether the stream should ensure that the directory for the
609
+ * `dest` file exists. If `true`, it will create the directory if it does not
610
+ * exist.
611
+ * @default false
612
+ */
613
+ readonly mkdir: boolean;
614
+ /**
615
+ * The mode of the file that is being written to.
616
+ */
617
+ readonly mode: number | string;
618
+ /**
619
+ * The number of milliseconds between flushes. If set to `0`, no
620
+ * periodic flushes will be performed.
621
+ */
622
+ readonly periodicFlush: number;
623
+ /**
624
+ * Reopen the file in place, useful for log rotation.
625
+ * @param file A path to a file to be written to (mode
626
+ * controlled by the append option).
627
+ */
628
+ reopen(file: PathLike): void;
629
+ /**
630
+ * Whether the stream is writing synchronously or asynchronously.
631
+ */
632
+ readonly sync: boolean;
633
+ /**
634
+ * When the `options.contentMode` is set to `'utf8'` when the stream is created,
635
+ * the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
636
+ * the `data` argument must be a `Buffer`.
637
+ * @param data The data to write.
638
+ */
639
+ write(data: string | Buffer): boolean;
640
+ /**
641
+ * Whether the stream is currently writing data to the file.
642
+ */
643
+ readonly writing: boolean;
644
+ /**
645
+ * Calls `utf8Stream.destroy()`.
646
+ */
647
+ [Symbol.dispose](): void;
648
+ }
649
+ interface Utf8Stream extends InternalEventEmitter<Utf8StreamEventMap> {}
650
+ interface WriteStreamEventMap extends stream.WritableEventMap {
651
+ "close": [];
652
+ "open": [fd: number];
653
+ "ready": [];
654
+ }
503
655
  /**
504
- * * Extends `stream.Writable`
505
- *
506
- * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
656
+ * Instances of `fs.WriteStream` cannot be constructed directly. They are created and
657
+ * returned using the `fs.createWriteStream()` function.
507
658
  * @since v0.1.93
508
659
  */
509
- export class WriteStream extends stream.Writable {
660
+ class WriteStream extends stream.Writable {
510
661
  /**
511
662
  * Closes `writeStream`. Optionally accepts a
512
663
  * callback that will be executed once the `writeStream`is closed.
@@ -532,17 +683,57 @@ declare module "fs" {
532
683
  * @since v11.2.0
533
684
  */
534
685
  pending: boolean;
535
- /**
536
- * events.EventEmitter
537
- * 1. open
538
- * 2. close
539
- * 3. ready
540
- */
541
- addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
542
- on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
543
- once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
544
- prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
545
- prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
686
+ // #region InternalEventEmitter
687
+ addListener<E extends keyof WriteStreamEventMap>(
688
+ eventName: E,
689
+ listener: (...args: WriteStreamEventMap[E]) => void,
690
+ ): this;
691
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
692
+ emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
693
+ emit(eventName: string | symbol, ...args: any[]): boolean;
694
+ listenerCount<E extends keyof WriteStreamEventMap>(
695
+ eventName: E,
696
+ listener?: (...args: WriteStreamEventMap[E]) => void,
697
+ ): number;
698
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
699
+ listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
700
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
701
+ off<E extends keyof WriteStreamEventMap>(
702
+ eventName: E,
703
+ listener: (...args: WriteStreamEventMap[E]) => void,
704
+ ): this;
705
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
706
+ on<E extends keyof WriteStreamEventMap>(
707
+ eventName: E,
708
+ listener: (...args: WriteStreamEventMap[E]) => void,
709
+ ): this;
710
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
711
+ once<E extends keyof WriteStreamEventMap>(
712
+ eventName: E,
713
+ listener: (...args: WriteStreamEventMap[E]) => void,
714
+ ): this;
715
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
716
+ prependListener<E extends keyof WriteStreamEventMap>(
717
+ eventName: E,
718
+ listener: (...args: WriteStreamEventMap[E]) => void,
719
+ ): this;
720
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
721
+ prependOnceListener<E extends keyof WriteStreamEventMap>(
722
+ eventName: E,
723
+ listener: (...args: WriteStreamEventMap[E]) => void,
724
+ ): this;
725
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
726
+ rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
727
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
728
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
729
+ removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
730
+ removeAllListeners(eventName?: string | symbol): this;
731
+ removeListener<E extends keyof WriteStreamEventMap>(
732
+ eventName: E,
733
+ listener: (...args: WriteStreamEventMap[E]) => void,
734
+ ): this;
735
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
736
+ // #endregion
546
737
  }
547
738
  /**
548
739
  * Asynchronously rename file at `oldPath` to the pathname provided
@@ -563,8 +754,8 @@ declare module "fs" {
563
754
  * ```
564
755
  * @since v0.0.2
565
756
  */
566
- export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
567
- export namespace rename {
757
+ function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
758
+ namespace rename {
568
759
  /**
569
760
  * Asynchronous rename(2) - Change the name or location of a file or directory.
570
761
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -580,7 +771,7 @@ declare module "fs" {
580
771
  * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
581
772
  * @since v0.1.21
582
773
  */
583
- export function renameSync(oldPath: PathLike, newPath: PathLike): void;
774
+ function renameSync(oldPath: PathLike, newPath: PathLike): void;
584
775
  /**
585
776
  * Truncates the file. No arguments other than a possible exception are
586
777
  * given to the completion callback. A file descriptor can also be passed as the
@@ -602,13 +793,13 @@ declare module "fs" {
602
793
  * @since v0.8.6
603
794
  * @param [len=0]
604
795
  */
605
- export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
796
+ function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
606
797
  /**
607
798
  * Asynchronous truncate(2) - Truncate a file to a specified length.
608
799
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
609
800
  */
610
- export function truncate(path: PathLike, callback: NoParamCallback): void;
611
- export namespace truncate {
801
+ function truncate(path: PathLike, callback: NoParamCallback): void;
802
+ namespace truncate {
612
803
  /**
613
804
  * Asynchronous truncate(2) - Truncate a file to a specified length.
614
805
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -625,7 +816,7 @@ declare module "fs" {
625
816
  * @since v0.8.6
626
817
  * @param [len=0]
627
818
  */
628
- export function truncateSync(path: PathLike, len?: number): void;
819
+ function truncateSync(path: PathLike, len?: number): void;
629
820
  /**
630
821
  * Truncates the file descriptor. No arguments other than a possible exception are
631
822
  * given to the completion callback.
@@ -669,13 +860,13 @@ declare module "fs" {
669
860
  * @since v0.8.6
670
861
  * @param [len=0]
671
862
  */
672
- export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
863
+ function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
673
864
  /**
674
865
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
675
866
  * @param fd A file descriptor.
676
867
  */
677
- export function ftruncate(fd: number, callback: NoParamCallback): void;
678
- export namespace ftruncate {
868
+ function ftruncate(fd: number, callback: NoParamCallback): void;
869
+ namespace ftruncate {
679
870
  /**
680
871
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
681
872
  * @param fd A file descriptor.
@@ -691,7 +882,7 @@ declare module "fs" {
691
882
  * @since v0.8.6
692
883
  * @param [len=0]
693
884
  */
694
- export function ftruncateSync(fd: number, len?: number): void;
885
+ function ftruncateSync(fd: number, len?: number): void;
695
886
  /**
696
887
  * Asynchronously changes owner and group of a file. No arguments other than a
697
888
  * possible exception are given to the completion callback.
@@ -699,8 +890,8 @@ declare module "fs" {
699
890
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
700
891
  * @since v0.1.97
701
892
  */
702
- export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
703
- export namespace chown {
893
+ function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
894
+ namespace chown {
704
895
  /**
705
896
  * Asynchronous chown(2) - Change ownership of a file.
706
897
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -714,7 +905,7 @@ declare module "fs" {
714
905
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
715
906
  * @since v0.1.97
716
907
  */
717
- export function chownSync(path: PathLike, uid: number, gid: number): void;
908
+ function chownSync(path: PathLike, uid: number, gid: number): void;
718
909
  /**
719
910
  * Sets the owner of the file. No arguments other than a possible exception are
720
911
  * given to the completion callback.
@@ -722,8 +913,8 @@ declare module "fs" {
722
913
  * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
723
914
  * @since v0.4.7
724
915
  */
725
- export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
726
- export namespace fchown {
916
+ function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
917
+ namespace fchown {
727
918
  /**
728
919
  * Asynchronous fchown(2) - Change ownership of a file.
729
920
  * @param fd A file descriptor.
@@ -738,15 +929,15 @@ declare module "fs" {
738
929
  * @param uid The file's new owner's user id.
739
930
  * @param gid The file's new group's group id.
740
931
  */
741
- export function fchownSync(fd: number, uid: number, gid: number): void;
932
+ function fchownSync(fd: number, uid: number, gid: number): void;
742
933
  /**
743
934
  * Set the owner of the symbolic link. No arguments other than a possible
744
935
  * exception are given to the completion callback.
745
936
  *
746
937
  * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
747
938
  */
748
- export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
749
- export namespace lchown {
939
+ function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
940
+ namespace lchown {
750
941
  /**
751
942
  * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
752
943
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -760,7 +951,7 @@ declare module "fs" {
760
951
  * @param uid The file's new owner's user id.
761
952
  * @param gid The file's new group's group id.
762
953
  */
763
- export function lchownSync(path: PathLike, uid: number, gid: number): void;
954
+ function lchownSync(path: PathLike, uid: number, gid: number): void;
764
955
  /**
765
956
  * 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
766
957
  * link, then the link is not dereferenced: instead, the timestamps of the
@@ -770,8 +961,8 @@ declare module "fs" {
770
961
  * callback.
771
962
  * @since v14.5.0, v12.19.0
772
963
  */
773
- export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
774
- export namespace lutimes {
964
+ function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
965
+ namespace lutimes {
775
966
  /**
776
967
  * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
777
968
  * with the difference that if the path refers to a symbolic link, then the link is not
@@ -788,7 +979,7 @@ declare module "fs" {
788
979
  * the operation fails. This is the synchronous version of {@link lutimes}.
789
980
  * @since v14.5.0, v12.19.0
790
981
  */
791
- export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
982
+ function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
792
983
  /**
793
984
  * Asynchronously changes the permissions of a file. No arguments other than a
794
985
  * possible exception are given to the completion callback.
@@ -805,8 +996,8 @@ declare module "fs" {
805
996
  * ```
806
997
  * @since v0.1.30
807
998
  */
808
- export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
809
- export namespace chmod {
999
+ function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1000
+ namespace chmod {
810
1001
  /**
811
1002
  * Asynchronous chmod(2) - Change permissions of a file.
812
1003
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -821,7 +1012,7 @@ declare module "fs" {
821
1012
  * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
822
1013
  * @since v0.6.7
823
1014
  */
824
- export function chmodSync(path: PathLike, mode: Mode): void;
1015
+ function chmodSync(path: PathLike, mode: Mode): void;
825
1016
  /**
826
1017
  * Sets the permissions on the file. No arguments other than a possible exception
827
1018
  * are given to the completion callback.
@@ -829,8 +1020,8 @@ declare module "fs" {
829
1020
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
830
1021
  * @since v0.4.7
831
1022
  */
832
- export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
833
- export namespace fchmod {
1023
+ function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
1024
+ namespace fchmod {
834
1025
  /**
835
1026
  * Asynchronous fchmod(2) - Change permissions of a file.
836
1027
  * @param fd A file descriptor.
@@ -844,7 +1035,7 @@ declare module "fs" {
844
1035
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
845
1036
  * @since v0.4.7
846
1037
  */
847
- export function fchmodSync(fd: number, mode: Mode): void;
1038
+ function fchmodSync(fd: number, mode: Mode): void;
848
1039
  /**
849
1040
  * Changes the permissions on a symbolic link. No arguments other than a possible
850
1041
  * exception are given to the completion callback.
@@ -854,9 +1045,9 @@ declare module "fs" {
854
1045
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
855
1046
  * @deprecated Since v0.4.7
856
1047
  */
857
- export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1048
+ function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
858
1049
  /** @deprecated */
859
- export namespace lchmod {
1050
+ namespace lchmod {
860
1051
  /**
861
1052
  * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
862
1053
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -872,7 +1063,7 @@ declare module "fs" {
872
1063
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
873
1064
  * @deprecated Since v0.4.7
874
1065
  */
875
- export function lchmodSync(path: PathLike, mode: Mode): void;
1066
+ function lchmodSync(path: PathLike, mode: Mode): void;
876
1067
  /**
877
1068
  * 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.
878
1069
  *
@@ -958,48 +1149,98 @@ declare module "fs" {
958
1149
  * ```
959
1150
  * @since v0.0.2
960
1151
  */
961
- export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
962
- export function stat(
1152
+ function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1153
+ function stat(
963
1154
  path: PathLike,
964
1155
  options:
965
1156
  | (StatOptions & {
966
1157
  bigint?: false | undefined;
1158
+ throwIfNoEntry?: true | undefined;
967
1159
  })
968
1160
  | undefined,
969
1161
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
970
1162
  ): void;
971
- export function stat(
1163
+ function stat(
972
1164
  path: PathLike,
973
1165
  options: StatOptions & {
974
1166
  bigint: true;
1167
+ throwIfNoEntry?: true | undefined;
975
1168
  },
976
1169
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
977
1170
  ): void;
978
- export function stat(
1171
+ function stat(
979
1172
  path: PathLike,
980
- options: StatOptions | undefined,
1173
+ options: StatOptions & {
1174
+ bigint?: false | undefined;
1175
+ throwIfNoEntry: false;
1176
+ },
1177
+ callback: (err: NodeJS.ErrnoException | null, stats: Stats | undefined) => void,
1178
+ ): void;
1179
+ function stat(
1180
+ path: PathLike,
1181
+ options: StatOptions & {
1182
+ bigint: true;
1183
+ throwIfNoEntry: false;
1184
+ },
1185
+ callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats | undefined) => void,
1186
+ ): void;
1187
+ function stat(
1188
+ path: PathLike,
1189
+ options: StatOptions & {
1190
+ throwIfNoEntry?: true | undefined;
1191
+ },
981
1192
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
982
1193
  ): void;
983
- export namespace stat {
1194
+ function stat(
1195
+ path: PathLike,
1196
+ options: StatOptions | undefined,
1197
+ callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats | undefined) => void,
1198
+ ): void;
1199
+ namespace stat {
1200
+ // TODO: aliased promisify signatures
984
1201
  /**
985
1202
  * Asynchronous stat(2) - Get file status.
986
1203
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
987
1204
  */
1205
+ function __promisify__(path: PathLike): Promise<Stats>;
988
1206
  function __promisify__(
989
1207
  path: PathLike,
990
1208
  options?: StatOptions & {
991
1209
  bigint?: false | undefined;
1210
+ throwIfNoEntry?: true | undefined;
992
1211
  },
993
1212
  ): Promise<Stats>;
994
1213
  function __promisify__(
995
1214
  path: PathLike,
996
1215
  options: StatOptions & {
997
1216
  bigint: true;
1217
+ throwIfNoEntry?: true | undefined;
998
1218
  },
999
1219
  ): Promise<BigIntStats>;
1000
- function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
1220
+ function __promisify__(
1221
+ path: PathLike,
1222
+ options: StatOptions & {
1223
+ bigint?: false | undefined;
1224
+ throwIfNoEntry: false;
1225
+ },
1226
+ ): Promise<Stats | undefined>;
1227
+ function __promisify__(
1228
+ path: PathLike,
1229
+ options: StatOptions & {
1230
+ bigint: true;
1231
+ throwIfNoEntry: false;
1232
+ },
1233
+ ): Promise<BigIntStats | undefined>;
1234
+ function __promisify__(
1235
+ path: PathLike,
1236
+ options: StatOptions & {
1237
+ throwIfNoEntry?: true | undefined;
1238
+ },
1239
+ ): Promise<Stats | BigIntStats>;
1240
+ function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats | undefined>;
1001
1241
  }
1002
- export interface StatSyncFn extends Function {
1242
+ /** @deprecated This orphaned interface will be removed in a future version. */
1243
+ interface StatSyncFn extends Function {
1003
1244
  (path: PathLike, options?: undefined): Stats;
1004
1245
  (
1005
1246
  path: PathLike,
@@ -1040,15 +1281,50 @@ declare module "fs" {
1040
1281
  * Synchronous stat(2) - Get file status.
1041
1282
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1042
1283
  */
1043
- export const statSync: StatSyncFn;
1284
+ function statSync(path: PathLike): Stats;
1285
+ function statSync(
1286
+ path: PathLike,
1287
+ options?: StatOptions & {
1288
+ bigint?: false | undefined;
1289
+ throwIfNoEntry?: true | undefined;
1290
+ },
1291
+ ): Stats;
1292
+ function statSync(
1293
+ path: PathLike,
1294
+ options: StatOptions & {
1295
+ bigint: true;
1296
+ throwIfNoEntry?: true | undefined;
1297
+ },
1298
+ ): BigIntStats;
1299
+ function statSync(
1300
+ path: PathLike,
1301
+ options: StatOptions & {
1302
+ bigint?: false | undefined;
1303
+ throwIfNoEntry: false;
1304
+ },
1305
+ ): Stats | undefined;
1306
+ function statSync(
1307
+ path: PathLike,
1308
+ options: StatOptions & {
1309
+ bigint: true;
1310
+ throwIfNoEntry: false;
1311
+ },
1312
+ ): BigIntStats | undefined;
1313
+ function statSync(
1314
+ path: PathLike,
1315
+ options: StatOptions & {
1316
+ throwIfNoEntry?: true | undefined;
1317
+ },
1318
+ ): Stats | BigIntStats;
1319
+ function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats | undefined;
1044
1320
  /**
1045
1321
  * Invokes the callback with the `fs.Stats` for the file descriptor.
1046
1322
  *
1047
1323
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1048
1324
  * @since v0.1.95
1049
1325
  */
1050
- export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1051
- export function fstat(
1326
+ function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1327
+ function fstat(
1052
1328
  fd: number,
1053
1329
  options:
1054
1330
  | (StatOptions & {
@@ -1057,19 +1333,19 @@ declare module "fs" {
1057
1333
  | undefined,
1058
1334
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1059
1335
  ): void;
1060
- export function fstat(
1336
+ function fstat(
1061
1337
  fd: number,
1062
1338
  options: StatOptions & {
1063
1339
  bigint: true;
1064
1340
  },
1065
1341
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1066
1342
  ): void;
1067
- export function fstat(
1343
+ function fstat(
1068
1344
  fd: number,
1069
1345
  options: StatOptions | undefined,
1070
1346
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1071
1347
  ): void;
1072
- export namespace fstat {
1348
+ namespace fstat {
1073
1349
  /**
1074
1350
  * Asynchronous fstat(2) - Get file status.
1075
1351
  * @param fd A file descriptor.
@@ -1094,19 +1370,19 @@ declare module "fs" {
1094
1370
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1095
1371
  * @since v0.1.95
1096
1372
  */
1097
- export function fstatSync(
1373
+ function fstatSync(
1098
1374
  fd: number,
1099
1375
  options?: StatOptions & {
1100
1376
  bigint?: false | undefined;
1101
1377
  },
1102
1378
  ): Stats;
1103
- export function fstatSync(
1379
+ function fstatSync(
1104
1380
  fd: number,
1105
1381
  options: StatOptions & {
1106
1382
  bigint: true;
1107
1383
  },
1108
1384
  ): BigIntStats;
1109
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1385
+ function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1110
1386
  /**
1111
1387
  * Retrieves the `fs.Stats` for the symbolic link referred to by the path.
1112
1388
  * 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
@@ -1115,8 +1391,8 @@ declare module "fs" {
1115
1391
  * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
1116
1392
  * @since v0.1.30
1117
1393
  */
1118
- export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1119
- export function lstat(
1394
+ function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1395
+ function lstat(
1120
1396
  path: PathLike,
1121
1397
  options:
1122
1398
  | (StatOptions & {
@@ -1125,19 +1401,19 @@ declare module "fs" {
1125
1401
  | undefined,
1126
1402
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1127
1403
  ): void;
1128
- export function lstat(
1404
+ function lstat(
1129
1405
  path: PathLike,
1130
1406
  options: StatOptions & {
1131
1407
  bigint: true;
1132
1408
  },
1133
1409
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1134
1410
  ): void;
1135
- export function lstat(
1411
+ function lstat(
1136
1412
  path: PathLike,
1137
1413
  options: StatOptions | undefined,
1138
1414
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1139
1415
  ): void;
1140
- export namespace lstat {
1416
+ namespace lstat {
1141
1417
  /**
1142
1418
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
1143
1419
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1164,8 +1440,8 @@ declare module "fs" {
1164
1440
  * @since v19.6.0, v18.15.0
1165
1441
  * @param path A path to an existing file or directory on the file system to be queried.
1166
1442
  */
1167
- export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1168
- export function statfs(
1443
+ function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1444
+ function statfs(
1169
1445
  path: PathLike,
1170
1446
  options:
1171
1447
  | (StatFsOptions & {
@@ -1174,19 +1450,19 @@ declare module "fs" {
1174
1450
  | undefined,
1175
1451
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void,
1176
1452
  ): void;
1177
- export function statfs(
1453
+ function statfs(
1178
1454
  path: PathLike,
1179
1455
  options: StatFsOptions & {
1180
1456
  bigint: true;
1181
1457
  },
1182
1458
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void,
1183
1459
  ): void;
1184
- export function statfs(
1460
+ function statfs(
1185
1461
  path: PathLike,
1186
1462
  options: StatFsOptions | undefined,
1187
1463
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void,
1188
1464
  ): void;
1189
- export namespace statfs {
1465
+ namespace statfs {
1190
1466
  /**
1191
1467
  * 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.
1192
1468
  * @param path A path to an existing file or directory on the file system to be queried.
@@ -1213,32 +1489,67 @@ declare module "fs" {
1213
1489
  * @since v19.6.0, v18.15.0
1214
1490
  * @param path A path to an existing file or directory on the file system to be queried.
1215
1491
  */
1216
- export function statfsSync(
1492
+ function statfsSync(
1217
1493
  path: PathLike,
1218
1494
  options?: StatFsOptions & {
1219
1495
  bigint?: false | undefined;
1220
1496
  },
1221
1497
  ): StatsFs;
1222
- export function statfsSync(
1498
+ function statfsSync(
1223
1499
  path: PathLike,
1224
1500
  options: StatFsOptions & {
1225
1501
  bigint: true;
1226
1502
  },
1227
1503
  ): BigIntStatsFs;
1228
- export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1504
+ function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1229
1505
  /**
1230
1506
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1231
1507
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1232
1508
  */
1233
- export const lstatSync: StatSyncFn;
1509
+ function lstatSync(path: PathLike): Stats;
1510
+ function lstatSync(
1511
+ path: PathLike,
1512
+ options?: StatOptions & {
1513
+ bigint?: false | undefined;
1514
+ throwIfNoEntry?: true | undefined;
1515
+ },
1516
+ ): Stats;
1517
+ function lstatSync(
1518
+ path: PathLike,
1519
+ options: StatOptions & {
1520
+ bigint: true;
1521
+ throwIfNoEntry?: true | undefined;
1522
+ },
1523
+ ): BigIntStats;
1524
+ function lstatSync(
1525
+ path: PathLike,
1526
+ options: StatOptions & {
1527
+ bigint?: false | undefined;
1528
+ throwIfNoEntry: false;
1529
+ },
1530
+ ): Stats | undefined;
1531
+ function lstatSync(
1532
+ path: PathLike,
1533
+ options: StatOptions & {
1534
+ bigint: true;
1535
+ throwIfNoEntry: false;
1536
+ },
1537
+ ): BigIntStats | undefined;
1538
+ function lstatSync(
1539
+ path: PathLike,
1540
+ options: StatOptions & {
1541
+ throwIfNoEntry?: true | undefined;
1542
+ },
1543
+ ): Stats | BigIntStats;
1544
+ function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats | undefined;
1234
1545
  /**
1235
1546
  * 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
1236
1547
  * a possible
1237
1548
  * exception are given to the completion callback.
1238
1549
  * @since v0.1.31
1239
1550
  */
1240
- export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1241
- export namespace link {
1551
+ function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1552
+ namespace link {
1242
1553
  /**
1243
1554
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
1244
1555
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1250,7 +1561,7 @@ declare module "fs" {
1250
1561
  * 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`.
1251
1562
  * @since v0.1.31
1252
1563
  */
1253
- export function linkSync(existingPath: PathLike, newPath: PathLike): void;
1564
+ function linkSync(existingPath: PathLike, newPath: PathLike): void;
1254
1565
  /**
1255
1566
  * Creates the link called `path` pointing to `target`. No arguments other than a
1256
1567
  * possible exception are given to the completion callback.
@@ -1284,7 +1595,7 @@ declare module "fs" {
1284
1595
  * @since v0.1.31
1285
1596
  * @param [type='null']
1286
1597
  */
1287
- export function symlink(
1598
+ function symlink(
1288
1599
  target: PathLike,
1289
1600
  path: PathLike,
1290
1601
  type: symlink.Type | undefined | null,
@@ -1295,8 +1606,8 @@ declare module "fs" {
1295
1606
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
1296
1607
  * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
1297
1608
  */
1298
- export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1299
- export namespace symlink {
1609
+ function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1610
+ namespace symlink {
1300
1611
  /**
1301
1612
  * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
1302
1613
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
@@ -1315,7 +1626,7 @@ declare module "fs" {
1315
1626
  * @since v0.1.31
1316
1627
  * @param [type='null']
1317
1628
  */
1318
- export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1629
+ function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1319
1630
  /**
1320
1631
  * Reads the contents of the symbolic link referred to by `path`. The callback gets
1321
1632
  * two arguments `(err, linkString)`.
@@ -1328,7 +1639,7 @@ declare module "fs" {
1328
1639
  * the link path returned will be passed as a `Buffer` object.
1329
1640
  * @since v0.1.31
1330
1641
  */
1331
- export function readlink(
1642
+ function readlink(
1332
1643
  path: PathLike,
1333
1644
  options: EncodingOption,
1334
1645
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
@@ -1338,7 +1649,7 @@ declare module "fs" {
1338
1649
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1339
1650
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1340
1651
  */
1341
- export function readlink(
1652
+ function readlink(
1342
1653
  path: PathLike,
1343
1654
  options: BufferEncodingOption,
1344
1655
  callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
@@ -1348,7 +1659,7 @@ declare module "fs" {
1348
1659
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1349
1660
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1350
1661
  */
1351
- export function readlink(
1662
+ function readlink(
1352
1663
  path: PathLike,
1353
1664
  options: EncodingOption,
1354
1665
  callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
@@ -1357,11 +1668,11 @@ declare module "fs" {
1357
1668
  * Asynchronous readlink(2) - read value of a symbolic link.
1358
1669
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1359
1670
  */
1360
- export function readlink(
1671
+ function readlink(
1361
1672
  path: PathLike,
1362
1673
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
1363
1674
  ): void;
1364
- export namespace readlink {
1675
+ namespace readlink {
1365
1676
  /**
1366
1677
  * Asynchronous readlink(2) - read value of a symbolic link.
1367
1678
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1392,19 +1703,19 @@ declare module "fs" {
1392
1703
  * the link path returned will be passed as a `Buffer` object.
1393
1704
  * @since v0.1.31
1394
1705
  */
1395
- export function readlinkSync(path: PathLike, options?: EncodingOption): string;
1706
+ function readlinkSync(path: PathLike, options?: EncodingOption): string;
1396
1707
  /**
1397
1708
  * Synchronous readlink(2) - read value of a symbolic link.
1398
1709
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1399
1710
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1400
1711
  */
1401
- export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1712
+ function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1402
1713
  /**
1403
1714
  * Synchronous readlink(2) - read value of a symbolic link.
1404
1715
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1405
1716
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1406
1717
  */
1407
- export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1718
+ function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1408
1719
  /**
1409
1720
  * Asynchronously computes the canonical pathname by resolving `.`, `..`, and
1410
1721
  * symbolic links.
@@ -1431,7 +1742,7 @@ declare module "fs" {
1431
1742
  * dependent name for that object.
1432
1743
  * @since v0.1.31
1433
1744
  */
1434
- export function realpath(
1745
+ function realpath(
1435
1746
  path: PathLike,
1436
1747
  options: EncodingOption,
1437
1748
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
@@ -1441,7 +1752,7 @@ declare module "fs" {
1441
1752
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1442
1753
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1443
1754
  */
1444
- export function realpath(
1755
+ function realpath(
1445
1756
  path: PathLike,
1446
1757
  options: BufferEncodingOption,
1447
1758
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
@@ -1451,7 +1762,7 @@ declare module "fs" {
1451
1762
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1452
1763
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1453
1764
  */
1454
- export function realpath(
1765
+ function realpath(
1455
1766
  path: PathLike,
1456
1767
  options: EncodingOption,
1457
1768
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
@@ -1460,11 +1771,11 @@ declare module "fs" {
1460
1771
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1461
1772
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1462
1773
  */
1463
- export function realpath(
1774
+ function realpath(
1464
1775
  path: PathLike,
1465
1776
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
1466
1777
  ): void;
1467
- export namespace realpath {
1778
+ namespace realpath {
1468
1779
  /**
1469
1780
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1470
1781
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1527,20 +1838,20 @@ declare module "fs" {
1527
1838
  * this API: {@link realpath}.
1528
1839
  * @since v0.1.31
1529
1840
  */
1530
- export function realpathSync(path: PathLike, options?: EncodingOption): string;
1841
+ function realpathSync(path: PathLike, options?: EncodingOption): string;
1531
1842
  /**
1532
1843
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1533
1844
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1534
1845
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1535
1846
  */
1536
- export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1847
+ function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1537
1848
  /**
1538
1849
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1539
1850
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1540
1851
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1541
1852
  */
1542
- export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1543
- export namespace realpathSync {
1853
+ function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1854
+ namespace realpathSync {
1544
1855
  function native(path: PathLike, options?: EncodingOption): string;
1545
1856
  function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1546
1857
  function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
@@ -1564,8 +1875,8 @@ declare module "fs" {
1564
1875
  * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
1565
1876
  * @since v0.0.2
1566
1877
  */
1567
- export function unlink(path: PathLike, callback: NoParamCallback): void;
1568
- export namespace unlink {
1878
+ function unlink(path: PathLike, callback: NoParamCallback): void;
1879
+ namespace unlink {
1569
1880
  /**
1570
1881
  * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
1571
1882
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1576,34 +1887,10 @@ declare module "fs" {
1576
1887
  * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
1577
1888
  * @since v0.1.21
1578
1889
  */
1579
- export function unlinkSync(path: PathLike): void;
1580
- export interface RmDirOptions {
1581
- /**
1582
- * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
1583
- * `EPERM` error is encountered, Node.js will retry the operation with a linear
1584
- * backoff wait of `retryDelay` ms longer on each try. This option represents the
1585
- * number of retries. This option is ignored if the `recursive` option is not
1586
- * `true`.
1587
- * @default 0
1588
- */
1589
- maxRetries?: number | undefined;
1590
- /**
1591
- * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
1592
- * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
1593
- * Use `fs.rm(path, { recursive: true, force: true })` instead.
1594
- *
1595
- * If `true`, perform a recursive directory removal. In
1596
- * recursive mode, operations are retried on failure.
1597
- * @default false
1598
- */
1599
- recursive?: boolean | undefined;
1600
- /**
1601
- * The amount of time in milliseconds to wait between retries.
1602
- * This option is ignored if the `recursive` option is not `true`.
1603
- * @default 100
1604
- */
1605
- retryDelay?: number | undefined;
1606
- }
1890
+ function unlinkSync(path: PathLike): void;
1891
+ /** @deprecated `rmdir()` no longer provides any options. This interface will be removed in a future version. */
1892
+ // TODO: remove in future major
1893
+ interface RmDirOptions {}
1607
1894
  /**
1608
1895
  * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
1609
1896
  * to the completion callback.
@@ -1614,14 +1901,13 @@ declare module "fs" {
1614
1901
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
1615
1902
  * @since v0.0.2
1616
1903
  */
1617
- export function rmdir(path: PathLike, callback: NoParamCallback): void;
1618
- export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
1619
- export namespace rmdir {
1904
+ function rmdir(path: PathLike, callback: NoParamCallback): void;
1905
+ namespace rmdir {
1620
1906
  /**
1621
1907
  * Asynchronous rmdir(2) - delete a directory.
1622
1908
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1623
1909
  */
1624
- function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
1910
+ function __promisify__(path: PathLike): Promise<void>;
1625
1911
  }
1626
1912
  /**
1627
1913
  * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
@@ -1632,8 +1918,8 @@ declare module "fs" {
1632
1918
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
1633
1919
  * @since v0.1.21
1634
1920
  */
1635
- export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
1636
- export interface RmOptions {
1921
+ function rmdirSync(path: PathLike): void;
1922
+ interface RmOptions {
1637
1923
  /**
1638
1924
  * When `true`, exceptions will be ignored if `path` does not exist.
1639
1925
  * @default false
@@ -1666,9 +1952,9 @@ declare module "fs" {
1666
1952
  * completion callback.
1667
1953
  * @since v14.14.0
1668
1954
  */
1669
- export function rm(path: PathLike, callback: NoParamCallback): void;
1670
- export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1671
- export namespace rm {
1955
+ function rm(path: PathLike, callback: NoParamCallback): void;
1956
+ function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1957
+ namespace rm {
1672
1958
  /**
1673
1959
  * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
1674
1960
  */
@@ -1678,8 +1964,8 @@ declare module "fs" {
1678
1964
  * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
1679
1965
  * @since v14.14.0
1680
1966
  */
1681
- export function rmSync(path: PathLike, options?: RmOptions): void;
1682
- export interface MakeDirectoryOptions {
1967
+ function rmSync(path: PathLike, options?: RmOptions): void;
1968
+ interface MakeDirectoryOptions {
1683
1969
  /**
1684
1970
  * Indicates whether parent folders should be created.
1685
1971
  * If a folder was created, the path to the first created folder will be returned.
@@ -1728,7 +2014,7 @@ declare module "fs" {
1728
2014
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1729
2015
  * @since v0.1.8
1730
2016
  */
1731
- export function mkdir(
2017
+ function mkdir(
1732
2018
  path: PathLike,
1733
2019
  options: MakeDirectoryOptions & {
1734
2020
  recursive: true;
@@ -1741,7 +2027,7 @@ declare module "fs" {
1741
2027
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1742
2028
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1743
2029
  */
1744
- export function mkdir(
2030
+ function mkdir(
1745
2031
  path: PathLike,
1746
2032
  options:
1747
2033
  | Mode
@@ -1758,7 +2044,7 @@ declare module "fs" {
1758
2044
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1759
2045
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1760
2046
  */
1761
- export function mkdir(
2047
+ function mkdir(
1762
2048
  path: PathLike,
1763
2049
  options: Mode | MakeDirectoryOptions | null | undefined,
1764
2050
  callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
@@ -1767,8 +2053,8 @@ declare module "fs" {
1767
2053
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
1768
2054
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1769
2055
  */
1770
- export function mkdir(path: PathLike, callback: NoParamCallback): void;
1771
- export namespace mkdir {
2056
+ function mkdir(path: PathLike, callback: NoParamCallback): void;
2057
+ namespace mkdir {
1772
2058
  /**
1773
2059
  * Asynchronous mkdir(2) - create a directory.
1774
2060
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1814,7 +2100,7 @@ declare module "fs" {
1814
2100
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1815
2101
  * @since v0.1.21
1816
2102
  */
1817
- export function mkdirSync(
2103
+ function mkdirSync(
1818
2104
  path: PathLike,
1819
2105
  options: MakeDirectoryOptions & {
1820
2106
  recursive: true;
@@ -1826,7 +2112,7 @@ declare module "fs" {
1826
2112
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1827
2113
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1828
2114
  */
1829
- export function mkdirSync(
2115
+ function mkdirSync(
1830
2116
  path: PathLike,
1831
2117
  options?:
1832
2118
  | Mode
@@ -1841,7 +2127,7 @@ declare module "fs" {
1841
2127
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1842
2128
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1843
2129
  */
1844
- export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
2130
+ function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
1845
2131
  /**
1846
2132
  * Creates a unique temporary directory.
1847
2133
  *
@@ -1901,7 +2187,7 @@ declare module "fs" {
1901
2187
  * ```
1902
2188
  * @since v5.10.0
1903
2189
  */
1904
- export function mkdtemp(
2190
+ function mkdtemp(
1905
2191
  prefix: string,
1906
2192
  options: EncodingOption,
1907
2193
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
@@ -1911,7 +2197,7 @@ declare module "fs" {
1911
2197
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1912
2198
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1913
2199
  */
1914
- export function mkdtemp(
2200
+ function mkdtemp(
1915
2201
  prefix: string,
1916
2202
  options: BufferEncodingOption,
1917
2203
  callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
@@ -1921,7 +2207,7 @@ declare module "fs" {
1921
2207
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1922
2208
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1923
2209
  */
1924
- export function mkdtemp(
2210
+ function mkdtemp(
1925
2211
  prefix: string,
1926
2212
  options: EncodingOption,
1927
2213
  callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
@@ -1930,11 +2216,11 @@ declare module "fs" {
1930
2216
  * Asynchronously creates a unique temporary directory.
1931
2217
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1932
2218
  */
1933
- export function mkdtemp(
2219
+ function mkdtemp(
1934
2220
  prefix: string,
1935
2221
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
1936
2222
  ): void;
1937
- export namespace mkdtemp {
2223
+ namespace mkdtemp {
1938
2224
  /**
1939
2225
  * Asynchronously creates a unique temporary directory.
1940
2226
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -1964,19 +2250,52 @@ declare module "fs" {
1964
2250
  * object with an `encoding` property specifying the character encoding to use.
1965
2251
  * @since v5.10.0
1966
2252
  */
1967
- export function mkdtempSync(prefix: string, options?: EncodingOption): string;
2253
+ function mkdtempSync(prefix: string, options?: EncodingOption): string;
1968
2254
  /**
1969
2255
  * Synchronously creates a unique temporary directory.
1970
2256
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1971
2257
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1972
2258
  */
1973
- export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
2259
+ function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
1974
2260
  /**
1975
2261
  * Synchronously creates a unique temporary directory.
1976
2262
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1977
2263
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1978
2264
  */
1979
- export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2265
+ function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2266
+ interface DisposableTempDir extends Disposable {
2267
+ /**
2268
+ * The path of the created directory.
2269
+ */
2270
+ path: string;
2271
+ /**
2272
+ * A function which removes the created directory.
2273
+ */
2274
+ remove(): void;
2275
+ /**
2276
+ * The same as `remove`.
2277
+ */
2278
+ [Symbol.dispose](): void;
2279
+ }
2280
+ /**
2281
+ * Returns a disposable object whose `path` property holds the created directory
2282
+ * path. When the object is disposed, the directory and its contents will be
2283
+ * removed if it still exists. If the directory cannot be deleted, disposal will
2284
+ * throw an error. The object has a `remove()` method which will perform the same
2285
+ * task.
2286
+ *
2287
+ * <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
2288
+ *
2289
+ * For detailed information, see the documentation of `fs.mkdtemp()`.
2290
+ *
2291
+ * There is no callback-based version of this API because it is designed for use
2292
+ * with the `using` syntax.
2293
+ *
2294
+ * The optional `options` argument can be a string specifying an encoding, or an
2295
+ * object with an `encoding` property specifying the character encoding to use.
2296
+ * @since v24.4.0
2297
+ */
2298
+ function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
1980
2299
  /**
1981
2300
  * 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 `'..'`.
1982
2301
  *
@@ -1990,7 +2309,7 @@ declare module "fs" {
1990
2309
  * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
1991
2310
  * @since v0.1.8
1992
2311
  */
1993
- export function readdir(
2312
+ function readdir(
1994
2313
  path: PathLike,
1995
2314
  options:
1996
2315
  | {
@@ -2008,7 +2327,7 @@ declare module "fs" {
2008
2327
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2009
2328
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2010
2329
  */
2011
- export function readdir(
2330
+ function readdir(
2012
2331
  path: PathLike,
2013
2332
  options:
2014
2333
  | {
@@ -2024,7 +2343,7 @@ declare module "fs" {
2024
2343
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2025
2344
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2026
2345
  */
2027
- export function readdir(
2346
+ function readdir(
2028
2347
  path: PathLike,
2029
2348
  options:
2030
2349
  | (ObjectEncodingOptions & {
@@ -2040,7 +2359,7 @@ declare module "fs" {
2040
2359
  * Asynchronous readdir(3) - read a directory.
2041
2360
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2042
2361
  */
2043
- export function readdir(
2362
+ function readdir(
2044
2363
  path: PathLike,
2045
2364
  callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
2046
2365
  ): void;
@@ -2049,7 +2368,7 @@ declare module "fs" {
2049
2368
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2050
2369
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2051
2370
  */
2052
- export function readdir(
2371
+ function readdir(
2053
2372
  path: PathLike,
2054
2373
  options: ObjectEncodingOptions & {
2055
2374
  withFileTypes: true;
@@ -2062,7 +2381,7 @@ declare module "fs" {
2062
2381
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2063
2382
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2064
2383
  */
2065
- export function readdir(
2384
+ function readdir(
2066
2385
  path: PathLike,
2067
2386
  options: {
2068
2387
  encoding: "buffer";
@@ -2071,7 +2390,7 @@ declare module "fs" {
2071
2390
  },
2072
2391
  callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
2073
2392
  ): void;
2074
- export namespace readdir {
2393
+ namespace readdir {
2075
2394
  /**
2076
2395
  * Asynchronous readdir(3) - read a directory.
2077
2396
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2157,7 +2476,7 @@ declare module "fs" {
2157
2476
  * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
2158
2477
  * @since v0.1.21
2159
2478
  */
2160
- export function readdirSync(
2479
+ function readdirSync(
2161
2480
  path: PathLike,
2162
2481
  options?:
2163
2482
  | {
@@ -2173,7 +2492,7 @@ declare module "fs" {
2173
2492
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2174
2493
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2175
2494
  */
2176
- export function readdirSync(
2495
+ function readdirSync(
2177
2496
  path: PathLike,
2178
2497
  options:
2179
2498
  | {
@@ -2188,7 +2507,7 @@ declare module "fs" {
2188
2507
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2189
2508
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2190
2509
  */
2191
- export function readdirSync(
2510
+ function readdirSync(
2192
2511
  path: PathLike,
2193
2512
  options?:
2194
2513
  | (ObjectEncodingOptions & {
@@ -2203,7 +2522,7 @@ declare module "fs" {
2203
2522
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2204
2523
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2205
2524
  */
2206
- export function readdirSync(
2525
+ function readdirSync(
2207
2526
  path: PathLike,
2208
2527
  options: ObjectEncodingOptions & {
2209
2528
  withFileTypes: true;
@@ -2215,7 +2534,7 @@ declare module "fs" {
2215
2534
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2216
2535
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2217
2536
  */
2218
- export function readdirSync(
2537
+ function readdirSync(
2219
2538
  path: PathLike,
2220
2539
  options: {
2221
2540
  encoding: "buffer";
@@ -2233,8 +2552,8 @@ declare module "fs" {
2233
2552
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2234
2553
  * @since v0.0.2
2235
2554
  */
2236
- export function close(fd: number, callback?: NoParamCallback): void;
2237
- export namespace close {
2555
+ function close(fd: number, callback?: NoParamCallback): void;
2556
+ namespace close {
2238
2557
  /**
2239
2558
  * Asynchronous close(2) - close a file descriptor.
2240
2559
  * @param fd A file descriptor.
@@ -2250,7 +2569,7 @@ declare module "fs" {
2250
2569
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2251
2570
  * @since v0.1.21
2252
2571
  */
2253
- export function closeSync(fd: number): void;
2572
+ function closeSync(fd: number): void;
2254
2573
  /**
2255
2574
  * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
2256
2575
  *
@@ -2268,7 +2587,7 @@ declare module "fs" {
2268
2587
  * @param [flags='r'] See `support of file system `flags``.
2269
2588
  * @param [mode=0o666]
2270
2589
  */
2271
- export function open(
2590
+ function open(
2272
2591
  path: PathLike,
2273
2592
  flags: OpenMode | undefined,
2274
2593
  mode: Mode | undefined | null,
@@ -2279,7 +2598,7 @@ declare module "fs" {
2279
2598
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2280
2599
  * @param [flags='r'] See `support of file system `flags``.
2281
2600
  */
2282
- export function open(
2601
+ function open(
2283
2602
  path: PathLike,
2284
2603
  flags: OpenMode | undefined,
2285
2604
  callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
@@ -2288,8 +2607,8 @@ declare module "fs" {
2288
2607
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2289
2608
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2290
2609
  */
2291
- export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2292
- export namespace open {
2610
+ function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2611
+ namespace open {
2293
2612
  /**
2294
2613
  * Asynchronous open(2) - open and possibly create a file.
2295
2614
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2306,7 +2625,7 @@ declare module "fs" {
2306
2625
  * @param [flags='r']
2307
2626
  * @param [mode=0o666]
2308
2627
  */
2309
- export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2628
+ function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2310
2629
  /**
2311
2630
  * Change the file system timestamps of the object referenced by `path`.
2312
2631
  *
@@ -2316,8 +2635,8 @@ declare module "fs" {
2316
2635
  * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
2317
2636
  * @since v0.4.2
2318
2637
  */
2319
- export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2320
- export namespace utimes {
2638
+ function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2639
+ namespace utimes {
2321
2640
  /**
2322
2641
  * Asynchronously change file timestamps of the file referenced by the supplied path.
2323
2642
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2333,14 +2652,14 @@ declare module "fs" {
2333
2652
  * this API: {@link utimes}.
2334
2653
  * @since v0.4.2
2335
2654
  */
2336
- export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2655
+ function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2337
2656
  /**
2338
2657
  * Change the file system timestamps of the object referenced by the supplied file
2339
2658
  * descriptor. See {@link utimes}.
2340
2659
  * @since v0.4.2
2341
2660
  */
2342
- export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2343
- export namespace futimes {
2661
+ function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2662
+ namespace futimes {
2344
2663
  /**
2345
2664
  * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
2346
2665
  * @param fd A file descriptor.
@@ -2353,7 +2672,7 @@ declare module "fs" {
2353
2672
  * Synchronous version of {@link futimes}. Returns `undefined`.
2354
2673
  * @since v0.4.2
2355
2674
  */
2356
- export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2675
+ function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2357
2676
  /**
2358
2677
  * Request that all data for the open file descriptor is flushed to the storage
2359
2678
  * device. The specific implementation is operating system and device specific.
@@ -2361,8 +2680,8 @@ declare module "fs" {
2361
2680
  * than a possible exception are given to the completion callback.
2362
2681
  * @since v0.1.96
2363
2682
  */
2364
- export function fsync(fd: number, callback: NoParamCallback): void;
2365
- export namespace fsync {
2683
+ function fsync(fd: number, callback: NoParamCallback): void;
2684
+ namespace fsync {
2366
2685
  /**
2367
2686
  * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
2368
2687
  * @param fd A file descriptor.
@@ -2375,8 +2694,8 @@ declare module "fs" {
2375
2694
  * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
2376
2695
  * @since v0.1.96
2377
2696
  */
2378
- export function fsyncSync(fd: number): void;
2379
- export interface WriteOptions {
2697
+ function fsyncSync(fd: number): void;
2698
+ interface WriteOptions {
2380
2699
  /**
2381
2700
  * @default 0
2382
2701
  */
@@ -2417,7 +2736,7 @@ declare module "fs" {
2417
2736
  * @param [length=buffer.byteLength - offset]
2418
2737
  * @param [position='null']
2419
2738
  */
2420
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2739
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2421
2740
  fd: number,
2422
2741
  buffer: TBuffer,
2423
2742
  offset: number | undefined | null,
@@ -2431,7 +2750,7 @@ declare module "fs" {
2431
2750
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2432
2751
  * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2433
2752
  */
2434
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2753
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2435
2754
  fd: number,
2436
2755
  buffer: TBuffer,
2437
2756
  offset: number | undefined | null,
@@ -2443,7 +2762,7 @@ declare module "fs" {
2443
2762
  * @param fd A file descriptor.
2444
2763
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2445
2764
  */
2446
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2765
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2447
2766
  fd: number,
2448
2767
  buffer: TBuffer,
2449
2768
  offset: number | undefined | null,
@@ -2453,7 +2772,7 @@ declare module "fs" {
2453
2772
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2454
2773
  * @param fd A file descriptor.
2455
2774
  */
2456
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2775
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2457
2776
  fd: number,
2458
2777
  buffer: TBuffer,
2459
2778
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
@@ -2466,7 +2785,7 @@ declare module "fs" {
2466
2785
  * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2467
2786
  * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2468
2787
  */
2469
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2788
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2470
2789
  fd: number,
2471
2790
  buffer: TBuffer,
2472
2791
  options: WriteOptions,
@@ -2479,7 +2798,7 @@ declare module "fs" {
2479
2798
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2480
2799
  * @param encoding The expected string encoding.
2481
2800
  */
2482
- export function write(
2801
+ function write(
2483
2802
  fd: number,
2484
2803
  string: string,
2485
2804
  position: number | undefined | null,
@@ -2492,7 +2811,7 @@ declare module "fs" {
2492
2811
  * @param string A string to write.
2493
2812
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2494
2813
  */
2495
- export function write(
2814
+ function write(
2496
2815
  fd: number,
2497
2816
  string: string,
2498
2817
  position: number | undefined | null,
@@ -2503,12 +2822,12 @@ declare module "fs" {
2503
2822
  * @param fd A file descriptor.
2504
2823
  * @param string A string to write.
2505
2824
  */
2506
- export function write(
2825
+ function write(
2507
2826
  fd: number,
2508
2827
  string: string,
2509
2828
  callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
2510
2829
  ): void;
2511
- export namespace write {
2830
+ namespace write {
2512
2831
  /**
2513
2832
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2514
2833
  * @param fd A file descriptor.
@@ -2568,7 +2887,7 @@ declare module "fs" {
2568
2887
  * @param [position='null']
2569
2888
  * @return The number of bytes written.
2570
2889
  */
2571
- export function writeSync(
2890
+ function writeSync(
2572
2891
  fd: number,
2573
2892
  buffer: NodeJS.ArrayBufferView,
2574
2893
  offset?: number | null,
@@ -2582,14 +2901,14 @@ declare module "fs" {
2582
2901
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2583
2902
  * @param encoding The expected string encoding.
2584
2903
  */
2585
- export function writeSync(
2904
+ function writeSync(
2586
2905
  fd: number,
2587
2906
  string: string,
2588
2907
  position?: number | null,
2589
2908
  encoding?: BufferEncoding | null,
2590
2909
  ): number;
2591
- export type ReadPosition = number | bigint;
2592
- export interface ReadOptions {
2910
+ type ReadPosition = number | bigint;
2911
+ interface ReadOptions {
2593
2912
  /**
2594
2913
  * @default 0
2595
2914
  */
@@ -2603,15 +2922,9 @@ declare module "fs" {
2603
2922
  */
2604
2923
  position?: ReadPosition | null | undefined;
2605
2924
  }
2606
- export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2925
+ interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2607
2926
  buffer?: T | undefined;
2608
2927
  }
2609
- /** @deprecated Use `ReadOptions` instead. */
2610
- // TODO: remove in future major
2611
- export interface ReadSyncOptions extends ReadOptions {}
2612
- /** @deprecated Use `ReadOptionsWithBuffer` instead. */
2613
- // TODO: remove in future major
2614
- export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2615
2928
  /**
2616
2929
  * Read data from the file specified by `fd`.
2617
2930
  *
@@ -2629,7 +2942,7 @@ declare module "fs" {
2629
2942
  * @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
2630
2943
  * `position` is an integer, the file position will be unchanged.
2631
2944
  */
2632
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2945
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2633
2946
  fd: number,
2634
2947
  buffer: TBuffer,
2635
2948
  offset: number,
@@ -2646,27 +2959,27 @@ declare module "fs" {
2646
2959
  * `position` defaults to `null`
2647
2960
  * @since v12.17.0, 13.11.0
2648
2961
  */
2649
- export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2962
+ function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2650
2963
  fd: number,
2651
2964
  options: ReadOptionsWithBuffer<TBuffer>,
2652
2965
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2653
2966
  ): void;
2654
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2967
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2655
2968
  fd: number,
2656
2969
  buffer: TBuffer,
2657
2970
  options: ReadOptions,
2658
2971
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2659
2972
  ): void;
2660
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2973
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2661
2974
  fd: number,
2662
2975
  buffer: TBuffer,
2663
2976
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2664
2977
  ): void;
2665
- export function read(
2978
+ function read(
2666
2979
  fd: number,
2667
2980
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
2668
2981
  ): void;
2669
- export namespace read {
2982
+ namespace read {
2670
2983
  /**
2671
2984
  * @param fd A file descriptor.
2672
2985
  * @param buffer The buffer that the data will be written to.
@@ -2704,7 +3017,7 @@ declare module "fs" {
2704
3017
  * @since v0.1.21
2705
3018
  * @param [position='null']
2706
3019
  */
2707
- export function readSync(
3020
+ function readSync(
2708
3021
  fd: number,
2709
3022
  buffer: NodeJS.ArrayBufferView,
2710
3023
  offset: number,
@@ -2715,7 +3028,20 @@ declare module "fs" {
2715
3028
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
2716
3029
  * If no `options` object is specified, it will default with the above values.
2717
3030
  */
2718
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
3031
+ function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
3032
+ interface ReadFileOptions extends Abortable {
3033
+ encoding?: BufferEncoding | null | undefined;
3034
+ flag?: OpenMode | undefined;
3035
+ }
3036
+ interface ReadFileOptionsWithStringEncoding extends ReadFileOptions {
3037
+ encoding: BufferEncoding;
3038
+ }
3039
+ interface ReadFileOptionsWithBufferEncoding extends ReadFileOptions {
3040
+ encoding?: null | undefined;
3041
+ }
3042
+ interface ReadFileOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadFileOptionsWithBufferEncoding {
3043
+ buffer: T | ((size: number) => T);
3044
+ }
2719
3045
  /**
2720
3046
  * Asynchronously reads the entire contents of a file.
2721
3047
  *
@@ -2733,6 +3059,11 @@ declare module "fs" {
2733
3059
  *
2734
3060
  * If no encoding is specified, then the raw buffer is returned.
2735
3061
  *
3062
+ * If `buffer` is provided and no encoding is specified, the returned `Buffer` is
3063
+ * a view over the supplied buffer containing only the bytes read. If the
3064
+ * supplied buffer is too small to contain the entire file, the callback is
3065
+ * called with an error.
3066
+ *
2736
3067
  * If `options` is a string, then it specifies the encoding:
2737
3068
  *
2738
3069
  * ```js
@@ -2741,7 +3072,8 @@ declare module "fs" {
2741
3072
  * readFile('/etc/passwd', 'utf8', callback);
2742
3073
  * ```
2743
3074
  *
2744
- * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an
3075
+ * When the path is a directory, the behavior of `fs.readFile()` and
3076
+ * `fs.readFileSync()` is platform-specific. On macOS, Linux, and Windows, an
2745
3077
  * error will be returned. On FreeBSD, a representation of the directory's contents
2746
3078
  * will be returned.
2747
3079
  *
@@ -2779,65 +3111,61 @@ declare module "fs" {
2779
3111
  *
2780
3112
  * Aborting an ongoing request does not abort individual operating
2781
3113
  * system requests but rather the internal buffering `fs.readFile` performs.
3114
+ *
3115
+ * An example using the `buffer` option with a pre-allocated buffer:
3116
+ *
3117
+ * ```js
3118
+ * import { Buffer } from 'node:buffer';
3119
+ * import { readFile } from 'node:fs';
3120
+ *
3121
+ * const buf = Buffer.alloc(16384);
3122
+ * readFile('/path/to/file', { buffer: buf }, (err, data) => {
3123
+ * if (err) throw err;
3124
+ * console.log(data); // A view over `buf` containing only the bytes read
3125
+ * });
3126
+ * ```
3127
+ *
3128
+ * An example using the `buffer` option with a function returning a buffer:
3129
+ *
3130
+ * ```js
3131
+ * import { Buffer } from 'node:buffer';
3132
+ * import { readFile } from 'node:fs';
3133
+ *
3134
+ * readFile('/path/to/file', {
3135
+ * buffer: (size) => Buffer.alloc(size),
3136
+ * }, (err, data) => {
3137
+ * if (err) throw err;
3138
+ * console.log(data);
3139
+ * });
3140
+ * ```
2782
3141
  * @since v0.1.29
2783
3142
  * @param path filename or file descriptor
2784
3143
  */
2785
- export function readFile(
3144
+ function readFile<T extends NodeJS.ArrayBufferView>(
2786
3145
  path: PathOrFileDescriptor,
2787
- options:
2788
- | ({
2789
- encoding?: null | undefined;
2790
- flag?: string | undefined;
2791
- } & Abortable)
2792
- | undefined
2793
- | null,
3146
+ options: ReadFileOptionsWithBuffer<T>,
3147
+ callback: (err: NodeJS.ErrnoException | null, data: BufferView<T>) => void,
3148
+ ): void;
3149
+ function readFile(
3150
+ path: PathOrFileDescriptor,
3151
+ options: ReadFileOptionsWithBufferEncoding | null | undefined,
2794
3152
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2795
3153
  ): void;
2796
- /**
2797
- * Asynchronously reads the entire contents of a file.
2798
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2799
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2800
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2801
- * If a flag is not provided, it defaults to `'r'`.
2802
- */
2803
- export function readFile(
3154
+ function readFile(
2804
3155
  path: PathOrFileDescriptor,
2805
- options:
2806
- | ({
2807
- encoding: BufferEncoding;
2808
- flag?: string | undefined;
2809
- } & Abortable)
2810
- | BufferEncoding,
3156
+ options: ReadFileOptionsWithStringEncoding | BufferEncoding,
2811
3157
  callback: (err: NodeJS.ErrnoException | null, data: string) => void,
2812
3158
  ): void;
2813
- /**
2814
- * Asynchronously reads the entire contents of a file.
2815
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2816
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2817
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2818
- * If a flag is not provided, it defaults to `'r'`.
2819
- */
2820
- export function readFile(
3159
+ function readFile(
2821
3160
  path: PathOrFileDescriptor,
2822
- options:
2823
- | (ObjectEncodingOptions & {
2824
- flag?: string | undefined;
2825
- } & Abortable)
2826
- | BufferEncoding
2827
- | undefined
2828
- | null,
3161
+ options: ReadFileOptions | BufferEncoding | null | undefined,
2829
3162
  callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void,
2830
3163
  ): void;
2831
- /**
2832
- * Asynchronously reads the entire contents of a file.
2833
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2834
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2835
- */
2836
- export function readFile(
3164
+ function readFile(
2837
3165
  path: PathOrFileDescriptor,
2838
3166
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2839
3167
  ): void;
2840
- export namespace readFile {
3168
+ namespace readFile {
2841
3169
  /**
2842
3170
  * Asynchronously reads the entire contents of a file.
2843
3171
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2887,16 +3215,37 @@ declare module "fs" {
2887
3215
  | null,
2888
3216
  ): Promise<string | NonSharedBuffer>;
2889
3217
  }
3218
+ interface ReadFileSyncOptions {
3219
+ encoding?: BufferEncoding | null | undefined;
3220
+ flag?: OpenMode | undefined;
3221
+ }
3222
+ interface ReadFileSyncOptionsWithStringEncoding extends ReadFileSyncOptions {
3223
+ encoding: BufferEncoding;
3224
+ }
3225
+ interface ReadFileSyncOptionsWithBufferEncoding extends ReadFileSyncOptions {
3226
+ encoding?: null | undefined;
3227
+ }
3228
+ interface ReadFileSyncOptionsWithBuffer<T extends NodeJS.ArrayBufferView>
3229
+ extends ReadFileSyncOptionsWithBufferEncoding
3230
+ {
3231
+ buffer: T | ((size: number) => T);
3232
+ }
2890
3233
  /**
2891
3234
  * Returns the contents of the `path`.
2892
3235
  *
2893
3236
  * For detailed information, see the documentation of the asynchronous version of
2894
- * this API: {@link readFile}.
3237
+ * this API: `fs.readFile()`.
2895
3238
  *
2896
3239
  * If the `encoding` option is specified then this function returns a
2897
3240
  * string. Otherwise it returns a buffer.
2898
3241
  *
2899
- * Similar to {@link readFile}, when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific.
3242
+ * If `buffer` is provided and no encoding is specified, the returned {Buffer} is
3243
+ * a view over the supplied buffer containing only the bytes read. If the
3244
+ * supplied buffer is too small to contain the entire file, an error will be
3245
+ * thrown.
3246
+ *
3247
+ * Similar to `fs.readFile()`, when the path is a directory, the behavior of
3248
+ * `fs.readFileSync()` is platform-specific.
2900
3249
  *
2901
3250
  * ```js
2902
3251
  * import { readFileSync } from 'node:fs';
@@ -2911,46 +3260,20 @@ declare module "fs" {
2911
3260
  * @since v0.1.8
2912
3261
  * @param path filename or file descriptor
2913
3262
  */
2914
- export function readFileSync(
3263
+ function readFileSync<T extends NodeJS.ArrayBufferView>(
3264
+ path: PathOrFileDescriptor,
3265
+ options: ReadFileSyncOptionsWithBuffer<T>,
3266
+ ): BufferView<T>;
3267
+ function readFileSync(
2915
3268
  path: PathOrFileDescriptor,
2916
- options?: {
2917
- encoding?: null | undefined;
2918
- flag?: string | undefined;
2919
- } | null,
3269
+ options?: ReadFileSyncOptionsWithBufferEncoding | null,
2920
3270
  ): NonSharedBuffer;
2921
- /**
2922
- * Synchronously reads the entire contents of a file.
2923
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2924
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2925
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2926
- * If a flag is not provided, it defaults to `'r'`.
2927
- */
2928
- export function readFileSync(
3271
+ function readFileSync(
2929
3272
  path: PathOrFileDescriptor,
2930
- options:
2931
- | {
2932
- encoding: BufferEncoding;
2933
- flag?: string | undefined;
2934
- }
2935
- | BufferEncoding,
3273
+ options: ReadFileSyncOptionsWithStringEncoding | BufferEncoding,
2936
3274
  ): string;
2937
- /**
2938
- * Synchronously reads the entire contents of a file.
2939
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2940
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2941
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2942
- * If a flag is not provided, it defaults to `'r'`.
2943
- */
2944
- export function readFileSync(
2945
- path: PathOrFileDescriptor,
2946
- options?:
2947
- | (ObjectEncodingOptions & {
2948
- flag?: string | undefined;
2949
- })
2950
- | BufferEncoding
2951
- | null,
2952
- ): string | NonSharedBuffer;
2953
- export type WriteFileOptions =
3275
+ function readFileSync(path: PathOrFileDescriptor, options: ReadFileSyncOptions): string | NonSharedBuffer;
3276
+ type WriteFileOptions =
2954
3277
  | (
2955
3278
  & ObjectEncodingOptions
2956
3279
  & Abortable
@@ -3023,7 +3346,7 @@ declare module "fs" {
3023
3346
  * @since v0.1.29
3024
3347
  * @param file filename or file descriptor
3025
3348
  */
3026
- export function writeFile(
3349
+ function writeFile(
3027
3350
  file: PathOrFileDescriptor,
3028
3351
  data: string | NodeJS.ArrayBufferView,
3029
3352
  options: WriteFileOptions,
@@ -3035,12 +3358,12 @@ declare module "fs" {
3035
3358
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3036
3359
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3037
3360
  */
3038
- export function writeFile(
3361
+ function writeFile(
3039
3362
  path: PathOrFileDescriptor,
3040
3363
  data: string | NodeJS.ArrayBufferView,
3041
3364
  callback: NoParamCallback,
3042
3365
  ): void;
3043
- export namespace writeFile {
3366
+ namespace writeFile {
3044
3367
  /**
3045
3368
  * Asynchronously writes data to a file, replacing the file if it already exists.
3046
3369
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3069,7 +3392,7 @@ declare module "fs" {
3069
3392
  * @since v0.1.29
3070
3393
  * @param file filename or file descriptor
3071
3394
  */
3072
- export function writeFileSync(
3395
+ function writeFileSync(
3073
3396
  file: PathOrFileDescriptor,
3074
3397
  data: string | NodeJS.ArrayBufferView,
3075
3398
  options?: WriteFileOptions,
@@ -3127,7 +3450,7 @@ declare module "fs" {
3127
3450
  * @since v0.6.7
3128
3451
  * @param path filename or file descriptor
3129
3452
  */
3130
- export function appendFile(
3453
+ function appendFile(
3131
3454
  path: PathOrFileDescriptor,
3132
3455
  data: string | Uint8Array,
3133
3456
  options: WriteFileOptions,
@@ -3139,8 +3462,8 @@ declare module "fs" {
3139
3462
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3140
3463
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3141
3464
  */
3142
- export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3143
- export namespace appendFile {
3465
+ function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3466
+ namespace appendFile {
3144
3467
  /**
3145
3468
  * Asynchronously append data to a file, creating the file if it does not exist.
3146
3469
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3206,7 +3529,7 @@ declare module "fs" {
3206
3529
  * @since v0.6.7
3207
3530
  * @param path filename or file descriptor
3208
3531
  */
3209
- export function appendFileSync(
3532
+ function appendFileSync(
3210
3533
  path: PathOrFileDescriptor,
3211
3534
  data: string | Uint8Array,
3212
3535
  options?: WriteFileOptions,
@@ -3257,7 +3580,7 @@ declare module "fs" {
3257
3580
  * * the file is renamed and then renamed a second time back to its original name
3258
3581
  * @since v0.1.31
3259
3582
  */
3260
- export interface WatchFileOptions {
3583
+ interface WatchFileOptions {
3261
3584
  bigint?: boolean | undefined;
3262
3585
  persistent?: boolean | undefined;
3263
3586
  interval?: number | undefined;
@@ -3308,7 +3631,7 @@ declare module "fs" {
3308
3631
  * * the file is renamed and then renamed a second time back to its original name
3309
3632
  * @since v0.1.31
3310
3633
  */
3311
- export function watchFile(
3634
+ function watchFile(
3312
3635
  filename: PathLike,
3313
3636
  options:
3314
3637
  | (WatchFileOptions & {
@@ -3317,7 +3640,7 @@ declare module "fs" {
3317
3640
  | undefined,
3318
3641
  listener: StatsListener,
3319
3642
  ): StatWatcher;
3320
- export function watchFile(
3643
+ function watchFile(
3321
3644
  filename: PathLike,
3322
3645
  options:
3323
3646
  | (WatchFileOptions & {
@@ -3330,7 +3653,7 @@ declare module "fs" {
3330
3653
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
3331
3654
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3332
3655
  */
3333
- export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3656
+ function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3334
3657
  /**
3335
3658
  * Stop watching for changes on `filename`. If `listener` is specified, only that
3336
3659
  * particular listener is removed. Otherwise, _all_ listeners are removed,
@@ -3343,23 +3666,25 @@ declare module "fs" {
3343
3666
  * @since v0.1.31
3344
3667
  * @param listener Optional, a listener previously attached using `fs.watchFile()`
3345
3668
  */
3346
- export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3347
- export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3348
- export interface WatchOptions extends Abortable {
3669
+ function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3670
+ function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3671
+ type WatchIgnorePredicate = string | RegExp | ((filename: string) => boolean);
3672
+ interface WatchOptions extends Abortable {
3349
3673
  encoding?: BufferEncoding | "buffer" | undefined;
3350
3674
  persistent?: boolean | undefined;
3351
3675
  recursive?: boolean | undefined;
3676
+ ignore?: WatchIgnorePredicate | readonly WatchIgnorePredicate[] | undefined;
3352
3677
  }
3353
- export interface WatchOptionsWithBufferEncoding extends WatchOptions {
3678
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
3354
3679
  encoding: "buffer";
3355
3680
  }
3356
- export interface WatchOptionsWithStringEncoding extends WatchOptions {
3681
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
3357
3682
  encoding?: BufferEncoding | undefined;
3358
3683
  }
3359
- export type WatchEventType = "rename" | "change";
3360
- export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3361
- export type StatsListener = (curr: Stats, prev: Stats) => void;
3362
- export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3684
+ type WatchEventType = "rename" | "change";
3685
+ type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3686
+ type StatsListener = (curr: Stats, prev: Stats) => void;
3687
+ type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3363
3688
  /**
3364
3689
  * Watch for changes on `filename`, where `filename` is either a file or a
3365
3690
  * directory.
@@ -3380,22 +3705,22 @@ declare module "fs" {
3380
3705
  * @since v0.5.10
3381
3706
  * @param listener
3382
3707
  */
3383
- export function watch(
3708
+ function watch(
3384
3709
  filename: PathLike,
3385
3710
  options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
3386
3711
  listener?: WatchListener<string>,
3387
3712
  ): FSWatcher;
3388
- export function watch(
3713
+ function watch(
3389
3714
  filename: PathLike,
3390
3715
  options: WatchOptionsWithBufferEncoding | "buffer",
3391
3716
  listener: WatchListener<NonSharedBuffer>,
3392
3717
  ): FSWatcher;
3393
- export function watch(
3718
+ function watch(
3394
3719
  filename: PathLike,
3395
3720
  options: WatchOptions | BufferEncoding | "buffer" | null,
3396
3721
  listener: WatchListener<string | NonSharedBuffer>,
3397
3722
  ): FSWatcher;
3398
- export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3723
+ function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3399
3724
  /**
3400
3725
  * Test whether or not the given path exists by checking with the file system.
3401
3726
  * Then call the `callback` argument with either true or false:
@@ -3525,9 +3850,9 @@ declare module "fs" {
3525
3850
  * @since v0.0.2
3526
3851
  * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
3527
3852
  */
3528
- export function exists(path: PathLike, callback: (exists: boolean) => void): void;
3853
+ function exists(path: PathLike, callback: (exists: boolean) => void): void;
3529
3854
  /** @deprecated */
3530
- export namespace exists {
3855
+ namespace exists {
3531
3856
  /**
3532
3857
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3533
3858
  * URL support is _experimental_.
@@ -3551,8 +3876,8 @@ declare module "fs" {
3551
3876
  * ```
3552
3877
  * @since v0.1.21
3553
3878
  */
3554
- export function existsSync(path: PathLike): boolean;
3555
- export namespace constants {
3879
+ function existsSync(path: PathLike): boolean;
3880
+ namespace constants {
3556
3881
  // File Access Constants
3557
3882
  /** Constant for fs.access(). File is visible to the calling process. */
3558
3883
  const F_OK: number;
@@ -3826,13 +4151,13 @@ declare module "fs" {
3826
4151
  * @since v0.11.15
3827
4152
  * @param [mode=fs.constants.F_OK]
3828
4153
  */
3829
- export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
4154
+ function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
3830
4155
  /**
3831
4156
  * Asynchronously tests a user's permissions for the file specified by path.
3832
4157
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3833
4158
  */
3834
- export function access(path: PathLike, callback: NoParamCallback): void;
3835
- export namespace access {
4159
+ function access(path: PathLike, callback: NoParamCallback): void;
4160
+ namespace access {
3836
4161
  /**
3837
4162
  * Asynchronously tests a user's permissions for the file specified by path.
3838
4163
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -3863,11 +4188,11 @@ declare module "fs" {
3863
4188
  * @since v0.11.15
3864
4189
  * @param [mode=fs.constants.F_OK]
3865
4190
  */
3866
- export function accessSync(path: PathLike, mode?: number): void;
4191
+ function accessSync(path: PathLike, mode?: number): void;
3867
4192
  interface StreamOptions {
3868
4193
  flags?: string | undefined;
3869
4194
  encoding?: BufferEncoding | undefined;
3870
- fd?: number | promises.FileHandle | undefined;
4195
+ fd?: number | FileHandle | undefined;
3871
4196
  mode?: number | undefined;
3872
4197
  autoClose?: boolean | undefined;
3873
4198
  emitClose?: boolean | undefined;
@@ -3955,7 +4280,7 @@ declare module "fs" {
3955
4280
  * If `options` is a string, then it specifies the encoding.
3956
4281
  * @since v0.1.31
3957
4282
  */
3958
- export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
4283
+ function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
3959
4284
  /**
3960
4285
  * `options` may also include a `start` option to allow writing data at some
3961
4286
  * position past the beginning of the file, allowed values are in the
@@ -3983,7 +4308,7 @@ declare module "fs" {
3983
4308
  * If `options` is a string, then it specifies the encoding.
3984
4309
  * @since v0.1.31
3985
4310
  */
3986
- export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
4311
+ function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
3987
4312
  /**
3988
4313
  * Forces all currently queued I/O operations associated with the file to the
3989
4314
  * 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
@@ -3991,8 +4316,8 @@ declare module "fs" {
3991
4316
  * exception are given to the completion callback.
3992
4317
  * @since v0.1.96
3993
4318
  */
3994
- export function fdatasync(fd: number, callback: NoParamCallback): void;
3995
- export namespace fdatasync {
4319
+ function fdatasync(fd: number, callback: NoParamCallback): void;
4320
+ namespace fdatasync {
3996
4321
  /**
3997
4322
  * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
3998
4323
  * @param fd A file descriptor.
@@ -4004,7 +4329,7 @@ declare module "fs" {
4004
4329
  * 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`.
4005
4330
  * @since v0.1.96
4006
4331
  */
4007
- export function fdatasyncSync(fd: number): void;
4332
+ function fdatasyncSync(fd: number): void;
4008
4333
  /**
4009
4334
  * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
4010
4335
  * already exists. No arguments other than a possible exception are given to the
@@ -4044,9 +4369,9 @@ declare module "fs" {
4044
4369
  * @param dest destination filename of the copy operation
4045
4370
  * @param [mode=0] modifiers for copy operation.
4046
4371
  */
4047
- export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4048
- export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4049
- export namespace copyFile {
4372
+ function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4373
+ function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4374
+ namespace copyFile {
4050
4375
  function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
4051
4376
  }
4052
4377
  /**
@@ -4083,7 +4408,7 @@ declare module "fs" {
4083
4408
  * @param dest destination filename of the copy operation
4084
4409
  * @param [mode=0] modifiers for copy operation.
4085
4410
  */
4086
- export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4411
+ function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4087
4412
  /**
4088
4413
  * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
4089
4414
  *
@@ -4104,12 +4429,12 @@ declare module "fs" {
4104
4429
  * @since v12.9.0
4105
4430
  * @param [position='null']
4106
4431
  */
4107
- export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4432
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4108
4433
  fd: number,
4109
4434
  buffers: TBuffers,
4110
4435
  cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4111
4436
  ): void;
4112
- export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4437
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4113
4438
  fd: number,
4114
4439
  buffers: TBuffers,
4115
4440
  position: number | null,
@@ -4117,11 +4442,11 @@ declare module "fs" {
4117
4442
  ): void;
4118
4443
  // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4119
4444
  // TODO: remove default in future major version
4120
- export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4445
+ interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4121
4446
  bytesWritten: number;
4122
4447
  buffers: T;
4123
4448
  }
4124
- export namespace writev {
4449
+ namespace writev {
4125
4450
  function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4126
4451
  fd: number,
4127
4452
  buffers: TBuffers,
@@ -4135,7 +4460,7 @@ declare module "fs" {
4135
4460
  * @param [position='null']
4136
4461
  * @return The number of bytes written.
4137
4462
  */
4138
- export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4463
+ function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4139
4464
  /**
4140
4465
  * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
4141
4466
  * using `readv()`.
@@ -4151,12 +4476,12 @@ declare module "fs" {
4151
4476
  * @since v13.13.0, v12.17.0
4152
4477
  * @param [position='null']
4153
4478
  */
4154
- export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4479
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4155
4480
  fd: number,
4156
4481
  buffers: TBuffers,
4157
4482
  cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4158
4483
  ): void;
4159
- export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4484
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4160
4485
  fd: number,
4161
4486
  buffers: TBuffers,
4162
4487
  position: number | null,
@@ -4164,11 +4489,11 @@ declare module "fs" {
4164
4489
  ): void;
4165
4490
  // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4166
4491
  // TODO: remove default in future major version
4167
- export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4492
+ interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4168
4493
  bytesRead: number;
4169
4494
  buffers: T;
4170
4495
  }
4171
- export namespace readv {
4496
+ namespace readv {
4172
4497
  function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4173
4498
  fd: number,
4174
4499
  buffers: TBuffers,
@@ -4182,9 +4507,9 @@ declare module "fs" {
4182
4507
  * @param [position='null']
4183
4508
  * @return The number of bytes read.
4184
4509
  */
4185
- export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4510
+ function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4186
4511
 
4187
- export interface OpenAsBlobOptions {
4512
+ interface OpenAsBlobOptions {
4188
4513
  /**
4189
4514
  * An optional mime type for the blob.
4190
4515
  *
@@ -4210,9 +4535,9 @@ declare module "fs" {
4210
4535
  * ```
4211
4536
  * @since v19.8.0
4212
4537
  */
4213
- export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4538
+ function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4214
4539
 
4215
- export interface OpenDirOptions {
4540
+ interface OpenDirOptions {
4216
4541
  /**
4217
4542
  * @default 'utf8'
4218
4543
  */
@@ -4239,7 +4564,7 @@ declare module "fs" {
4239
4564
  * directory and subsequent read operations.
4240
4565
  * @since v12.12.0
4241
4566
  */
4242
- export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4567
+ function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4243
4568
  /**
4244
4569
  * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
4245
4570
  * more details.
@@ -4251,30 +4576,31 @@ declare module "fs" {
4251
4576
  * directory and subsequent read operations.
4252
4577
  * @since v12.12.0
4253
4578
  */
4254
- export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4255
- export function opendir(
4579
+ function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4580
+ function opendir(
4256
4581
  path: PathLike,
4257
4582
  options: OpenDirOptions,
4258
4583
  cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
4259
4584
  ): void;
4260
- export namespace opendir {
4585
+ namespace opendir {
4261
4586
  function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
4262
4587
  }
4263
- export interface BigIntStats extends StatsBase<bigint> {
4588
+ interface BigIntStats extends StatsBase<bigint> {
4264
4589
  atimeNs: bigint;
4265
4590
  mtimeNs: bigint;
4266
4591
  ctimeNs: bigint;
4267
4592
  birthtimeNs: bigint;
4268
4593
  }
4269
- export interface BigIntOptions {
4594
+ interface BigIntOptions {
4270
4595
  bigint: true;
4271
4596
  }
4272
- export interface StatOptions {
4597
+ interface StatOptions {
4598
+ // TODO: add signal option once we sort its behavior out upstream
4273
4599
  bigint?: boolean | undefined;
4274
- }
4275
- export interface StatSyncOptions extends StatOptions {
4276
4600
  throwIfNoEntry?: boolean | undefined;
4277
4601
  }
4602
+ /** @deprecated This orphaned interface will be removed in a future version. Use `StatOptions` instead. */
4603
+ interface StatSyncOptions extends StatOptions {}
4278
4604
  interface CopyOptionsBase {
4279
4605
  /**
4280
4606
  * Dereference symlinks
@@ -4315,14 +4641,14 @@ declare module "fs" {
4315
4641
  */
4316
4642
  verbatimSymlinks?: boolean | undefined;
4317
4643
  }
4318
- export interface CopyOptions extends CopyOptionsBase {
4644
+ interface CopyOptions extends CopyOptionsBase {
4319
4645
  /**
4320
4646
  * Function to filter copied files/directories. Return
4321
4647
  * `true` to copy the item, `false` to ignore it.
4322
4648
  */
4323
4649
  filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4324
4650
  }
4325
- export interface CopySyncOptions extends CopyOptionsBase {
4651
+ interface CopySyncOptions extends CopyOptionsBase {
4326
4652
  /**
4327
4653
  * Function to filter copied files/directories. Return
4328
4654
  * `true` to copy the item, `false` to ignore it.
@@ -4340,12 +4666,12 @@ declare module "fs" {
4340
4666
  * @param src source path to copy.
4341
4667
  * @param dest destination path to copy to.
4342
4668
  */
4343
- export function cp(
4669
+ function cp(
4344
4670
  source: string | URL,
4345
4671
  destination: string | URL,
4346
4672
  callback: (err: NodeJS.ErrnoException | null) => void,
4347
4673
  ): void;
4348
- export function cp(
4674
+ function cp(
4349
4675
  source: string | URL,
4350
4676
  destination: string | URL,
4351
4677
  opts: CopyOptions,
@@ -4362,41 +4688,49 @@ declare module "fs" {
4362
4688
  * @param src source path to copy.
4363
4689
  * @param dest destination path to copy to.
4364
4690
  */
4365
- export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4366
-
4367
- interface _GlobOptions<T extends Dirent | string> {
4691
+ function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4692
+ interface GlobOptions<T extends Dirent | string = Dirent | string> {
4368
4693
  /**
4369
4694
  * Current working directory.
4370
4695
  * @default process.cwd()
4371
4696
  */
4372
4697
  cwd?: string | URL | undefined;
4373
- /**
4374
- * `true` if the glob should return paths as `Dirent`s, `false` otherwise.
4375
- * @default false
4376
- * @since v22.2.0
4377
- */
4378
- withFileTypes?: boolean | undefined;
4379
4698
  /**
4380
4699
  * Function to filter out files/directories or a
4381
4700
  * list of glob patterns to be excluded. If a function is provided, return
4382
- * `true` to exclude the item, `false` to include it. If a string array is
4383
- * provided, each string should be a glob pattern that specifies paths to exclude.
4384
- * Note: Negation patterns (e.g., '!foo.js') are not supported.
4701
+ * `true` to exclude the item, `false` to include it.
4702
+ * If a string array is provided, each string should be a glob pattern that
4703
+ * specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
4704
+ * not supported.
4385
4705
  * @default undefined
4386
4706
  */
4387
4707
  exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
4708
+ /**
4709
+ * When `true`, symbolic links to directories are
4710
+ * followed while expanding `**` patterns.
4711
+ * @default false
4712
+ */
4713
+ followSymlinks?: boolean | undefined;
4714
+ /**
4715
+ * `true` if the glob should return paths as `Dirent`s, `false` otherwise.
4716
+ * @default false
4717
+ * @since v22.2.0
4718
+ */
4719
+ withFileTypes?: boolean | undefined;
4388
4720
  }
4389
- export interface GlobOptions extends _GlobOptions<Dirent | string> {}
4390
- export interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4721
+ interface GlobOptionsWithFileTypes extends GlobOptions<Dirent> {
4391
4722
  withFileTypes: true;
4392
4723
  }
4393
- export interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4724
+ interface GlobOptionsWithoutFileTypes extends GlobOptions<string> {
4394
4725
  withFileTypes?: false | undefined;
4395
4726
  }
4396
4727
 
4397
4728
  /**
4398
4729
  * Retrieves the files matching the specified pattern.
4399
4730
  *
4731
+ * When `followSymlinks` is enabled, detected symbolic link cycles are not
4732
+ * traversed recursively.
4733
+ *
4400
4734
  * ```js
4401
4735
  * import { glob } from 'node:fs';
4402
4736
  *
@@ -4407,11 +4741,11 @@ declare module "fs" {
4407
4741
  * ```
4408
4742
  * @since v22.0.0
4409
4743
  */
4410
- export function glob(
4744
+ function glob(
4411
4745
  pattern: string | readonly string[],
4412
4746
  callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4413
4747
  ): void;
4414
- export function glob(
4748
+ function glob(
4415
4749
  pattern: string | readonly string[],
4416
4750
  options: GlobOptionsWithFileTypes,
4417
4751
  callback: (
@@ -4419,7 +4753,7 @@ declare module "fs" {
4419
4753
  matches: Dirent[],
4420
4754
  ) => void,
4421
4755
  ): void;
4422
- export function glob(
4756
+ function glob(
4423
4757
  pattern: string | readonly string[],
4424
4758
  options: GlobOptionsWithoutFileTypes,
4425
4759
  callback: (
@@ -4427,7 +4761,7 @@ declare module "fs" {
4427
4761
  matches: string[],
4428
4762
  ) => void,
4429
4763
  ): void;
4430
- export function glob(
4764
+ function glob(
4431
4765
  pattern: string | readonly string[],
4432
4766
  options: GlobOptions,
4433
4767
  callback: (
@@ -4436,6 +4770,9 @@ declare module "fs" {
4436
4770
  ) => void,
4437
4771
  ): void;
4438
4772
  /**
4773
+ * When `followSymlinks` is enabled, detected symbolic link cycles are not
4774
+ * traversed recursively.
4775
+ *
4439
4776
  * ```js
4440
4777
  * import { globSync } from 'node:fs';
4441
4778
  *
@@ -4444,20 +4781,23 @@ declare module "fs" {
4444
4781
  * @since v22.0.0
4445
4782
  * @returns paths of files that match the pattern.
4446
4783
  */
4447
- export function globSync(pattern: string | readonly string[]): string[];
4448
- export function globSync(
4784
+ function globSync(pattern: string | readonly string[]): string[];
4785
+ function globSync(
4449
4786
  pattern: string | readonly string[],
4450
4787
  options: GlobOptionsWithFileTypes,
4451
4788
  ): Dirent[];
4452
- export function globSync(
4789
+ function globSync(
4453
4790
  pattern: string | readonly string[],
4454
4791
  options: GlobOptionsWithoutFileTypes,
4455
4792
  ): string[];
4456
- export function globSync(
4793
+ function globSync(
4457
4794
  pattern: string | readonly string[],
4458
4795
  options: GlobOptions,
4459
4796
  ): Dirent[] | string[];
4460
4797
  }
4461
4798
  declare module "node:fs" {
4462
- export * from "fs";
4799
+ export * as promises from "node:fs/promises";
4800
+ }
4801
+ declare module "fs" {
4802
+ export * from "node:fs";
4463
4803
  }