@integration-app/react 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. package/node_modules/@compwright/namecase/LICENSE +26 -0
  2. package/node_modules/@compwright/namecase/README.md +49 -0
  3. package/node_modules/@compwright/namecase/bin/namecase +28 -0
  4. package/node_modules/@compwright/namecase/dist/namecase.min.js +4 -0
  5. package/node_modules/@compwright/namecase/dist/namecase.min.js.map +1 -0
  6. package/node_modules/@compwright/namecase/package.json +46 -0
  7. package/node_modules/@compwright/namecase/src/index.js +146 -0
  8. package/node_modules/@integration-app/sdk/bundle.js +404 -262
  9. package/node_modules/@integration-app/sdk/bundle.js.map +1 -1
  10. package/node_modules/@integration-app/sdk/client.d.ts +3 -3
  11. package/node_modules/@integration-app/sdk/data-builder/formulas/case.d.ts +3 -7
  12. package/node_modules/@integration-app/sdk/data-builder/formulas/case.js +16 -32
  13. package/node_modules/@integration-app/sdk/data-builder/formulas/case.js.map +1 -1
  14. package/node_modules/@integration-app/sdk/integrations/accessors.d.ts +0 -6
  15. package/node_modules/@integration-app/sdk/integrations/accessors.js +1 -87
  16. package/node_modules/@integration-app/sdk/integrations/accessors.js.map +1 -1
  17. package/node_modules/@integration-app/sdk/json-schema/index.d.ts +1 -1
  18. package/node_modules/@integration-app/sdk/src/client.ts +3 -3
  19. package/node_modules/@integration-app/sdk/src/data-builder/formulas/case.test.ts +11 -113
  20. package/node_modules/@integration-app/sdk/src/data-builder/formulas/case.ts +22 -46
  21. package/node_modules/@integration-app/sdk/src/integrations/accessors.ts +2 -122
  22. package/node_modules/@sinclair/typebox/package.json +40 -0
  23. package/node_modules/@sinclair/typebox/readme.md +740 -0
  24. package/node_modules/@sinclair/typebox/typebox.d.ts +351 -0
  25. package/node_modules/@sinclair/typebox/typebox.js +345 -0
  26. package/node_modules/@types/node/README.md +16 -0
  27. package/node_modules/@types/node/assert.d.ts +128 -0
  28. package/node_modules/@types/node/async_hooks.d.ts +229 -0
  29. package/node_modules/@types/node/buffer.d.ts +89 -0
  30. package/node_modules/@types/node/child_process.d.ts +514 -0
  31. package/node_modules/@types/node/cluster.d.ts +265 -0
  32. package/node_modules/@types/node/console.d.ts +142 -0
  33. package/node_modules/@types/node/constants.d.ts +18 -0
  34. package/node_modules/@types/node/crypto.d.ts +1283 -0
  35. package/node_modules/@types/node/dgram.d.ts +144 -0
  36. package/node_modules/@types/node/dns.d.ts +387 -0
  37. package/node_modules/@types/node/domain.d.ts +27 -0
  38. package/node_modules/@types/node/events.d.ts +82 -0
  39. package/node_modules/@types/node/fs/promises.d.ts +572 -0
  40. package/node_modules/@types/node/fs.d.ts +2281 -0
  41. package/node_modules/@types/node/globals.d.ts +747 -0
  42. package/node_modules/@types/node/globals.global.d.ts +1 -0
  43. package/node_modules/@types/node/http.d.ts +580 -0
  44. package/node_modules/@types/node/http2.d.ts +962 -0
  45. package/node_modules/@types/node/https.d.ts +271 -0
  46. package/node_modules/@types/node/index.d.ts +98 -0
  47. package/node_modules/@types/node/inspector.d.ts +3051 -0
  48. package/node_modules/@types/node/module.d.ts +56 -0
  49. package/node_modules/@types/node/net.d.ts +308 -0
  50. package/node_modules/@types/node/os.d.ts +243 -0
  51. package/node_modules/@types/node/package.json +232 -0
  52. package/node_modules/@types/node/path.d.ts +168 -0
  53. package/node_modules/@types/node/perf_hooks.d.ts +274 -0
  54. package/node_modules/@types/node/process.d.ts +413 -0
  55. package/node_modules/@types/node/punycode.d.ts +78 -0
  56. package/node_modules/@types/node/querystring.d.ts +31 -0
  57. package/node_modules/@types/node/readline.d.ts +174 -0
  58. package/node_modules/@types/node/repl.d.ts +398 -0
  59. package/node_modules/@types/node/stream.d.ts +359 -0
  60. package/node_modules/@types/node/string_decoder.d.ts +10 -0
  61. package/node_modules/@types/node/timers.d.ts +19 -0
  62. package/node_modules/@types/node/tls.d.ts +784 -0
  63. package/node_modules/@types/node/trace_events.d.ts +64 -0
  64. package/node_modules/@types/node/ts4.8/assert.d.ts +128 -0
  65. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +229 -0
  66. package/node_modules/@types/node/ts4.8/buffer.d.ts +89 -0
  67. package/node_modules/@types/node/ts4.8/child_process.d.ts +514 -0
  68. package/node_modules/@types/node/ts4.8/cluster.d.ts +265 -0
  69. package/node_modules/@types/node/ts4.8/console.d.ts +142 -0
  70. package/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  71. package/node_modules/@types/node/ts4.8/crypto.d.ts +1283 -0
  72. package/node_modules/@types/node/ts4.8/dgram.d.ts +144 -0
  73. package/node_modules/@types/node/ts4.8/dns.d.ts +387 -0
  74. package/node_modules/@types/node/ts4.8/domain.d.ts +27 -0
  75. package/node_modules/@types/node/ts4.8/events.d.ts +82 -0
  76. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +572 -0
  77. package/node_modules/@types/node/ts4.8/fs.d.ts +2281 -0
  78. package/node_modules/@types/node/ts4.8/globals.d.ts +746 -0
  79. package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  80. package/node_modules/@types/node/ts4.8/http.d.ts +580 -0
  81. package/node_modules/@types/node/ts4.8/http2.d.ts +962 -0
  82. package/node_modules/@types/node/ts4.8/https.d.ts +271 -0
  83. package/node_modules/@types/node/ts4.8/index.d.ts +53 -0
  84. package/node_modules/@types/node/ts4.8/inspector.d.ts +3051 -0
  85. package/node_modules/@types/node/ts4.8/module.d.ts +56 -0
  86. package/node_modules/@types/node/ts4.8/net.d.ts +308 -0
  87. package/node_modules/@types/node/ts4.8/os.d.ts +243 -0
  88. package/node_modules/@types/node/ts4.8/path.d.ts +168 -0
  89. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +274 -0
  90. package/node_modules/@types/node/ts4.8/process.d.ts +413 -0
  91. package/node_modules/@types/node/ts4.8/punycode.d.ts +78 -0
  92. package/node_modules/@types/node/ts4.8/querystring.d.ts +31 -0
  93. package/node_modules/@types/node/ts4.8/readline.d.ts +174 -0
  94. package/node_modules/@types/node/ts4.8/repl.d.ts +398 -0
  95. package/node_modules/@types/node/ts4.8/stream.d.ts +359 -0
  96. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +10 -0
  97. package/node_modules/@types/node/ts4.8/timers.d.ts +19 -0
  98. package/node_modules/@types/node/ts4.8/tls.d.ts +784 -0
  99. package/node_modules/@types/node/ts4.8/trace_events.d.ts +64 -0
  100. package/node_modules/@types/node/ts4.8/tty.d.ts +69 -0
  101. package/node_modules/@types/node/ts4.8/url.d.ts +149 -0
  102. package/node_modules/@types/node/ts4.8/util.d.ts +216 -0
  103. package/node_modules/@types/node/ts4.8/v8.d.ts +190 -0
  104. package/node_modules/@types/node/ts4.8/vm.d.ts +155 -0
  105. package/node_modules/@types/node/ts4.8/wasi.d.ts +89 -0
  106. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +241 -0
  107. package/node_modules/@types/node/ts4.8/zlib.d.ts +364 -0
  108. package/node_modules/@types/node/tty.d.ts +69 -0
  109. package/node_modules/@types/node/url.d.ts +149 -0
  110. package/node_modules/@types/node/util.d.ts +216 -0
  111. package/node_modules/@types/node/v8.d.ts +190 -0
  112. package/node_modules/@types/node/vm.d.ts +155 -0
  113. package/node_modules/@types/node/wasi.d.ts +89 -0
  114. package/node_modules/@types/node/worker_threads.d.ts +241 -0
  115. package/node_modules/@types/node/zlib.d.ts +364 -0
  116. package/package.json +2 -5
  117. package/node_modules/@integration-app/sdk/.DS_Store +0 -0
  118. package/node_modules/@integration-app/sdk/.gitignore +0 -11
  119. package/node_modules/@integration-app/sdk/.npmignore +0 -0
  120. package/node_modules/@integration-app/sdk/app-data-collections/app-data-collections.d.ts +0 -23
  121. package/node_modules/@integration-app/sdk/app-data-collections/app-data-collections.js.map +0 -1
  122. package/node_modules/@integration-app/sdk/app-data-schemas/app-data-schemas.d.ts +0 -20
  123. package/node_modules/@integration-app/sdk/app-data-schemas/app-data-schemas.js.map +0 -1
  124. package/node_modules/@integration-app/sdk/app-events/app-events.d.ts +0 -44
  125. package/node_modules/@integration-app/sdk/app-events/app-events.js.map +0 -1
  126. package/node_modules/@integration-app/sdk/connection-client.d.ts +0 -12
  127. package/node_modules/@integration-app/sdk/connection-client.js +0 -31
  128. package/node_modules/@integration-app/sdk/connection-client.js.map +0 -1
  129. package/node_modules/@integration-app/sdk/connections/connections.d.ts +0 -46
  130. package/node_modules/@integration-app/sdk/connections/connections.js.map +0 -1
  131. package/node_modules/@integration-app/sdk/connector-api/connector-api.d.ts +0 -157
  132. package/node_modules/@integration-app/sdk/connector-api/connector-api.js.map +0 -1
  133. package/node_modules/@integration-app/sdk/data-builder/findExternalRecordId.d.ts +0 -0
  134. package/node_modules/@integration-app/sdk/data-builder/findExternalRecordId.js.map +0 -1
  135. package/node_modules/@integration-app/sdk/data-builder/first-name.test.d.ts +0 -0
  136. package/node_modules/@integration-app/sdk/data-builder/first-name.test.js +0 -2
  137. package/node_modules/@integration-app/sdk/data-builder/first-name.test.js.map +0 -1
  138. package/node_modules/@integration-app/sdk/data-builder/formulas/anyOfOption.d.ts +0 -10
  139. package/node_modules/@integration-app/sdk/data-builder/formulas/anyOfOption.js.map +0 -1
  140. package/node_modules/@integration-app/sdk/data-builder/formulas/base.test.d.ts +0 -1
  141. package/node_modules/@integration-app/sdk/data-builder/formulas/base.test.js +0 -26
  142. package/node_modules/@integration-app/sdk/data-builder/formulas/base.test.js.map +0 -1
  143. package/node_modules/@integration-app/sdk/data-builder/formulas/case.test.d.ts +0 -1
  144. package/node_modules/@integration-app/sdk/data-builder/formulas/case.test.js +0 -246
  145. package/node_modules/@integration-app/sdk/data-builder/formulas/case.test.js.map +0 -1
  146. package/node_modules/@integration-app/sdk/data-builder/formulas/concat.test.d.ts +0 -1
  147. package/node_modules/@integration-app/sdk/data-builder/formulas/concat.test.js +0 -85
  148. package/node_modules/@integration-app/sdk/data-builder/formulas/concat.test.js.map +0 -1
  149. package/node_modules/@integration-app/sdk/data-builder/formulas/copy.test.d.ts +0 -1
  150. package/node_modules/@integration-app/sdk/data-builder/formulas/copy.test.js +0 -64
  151. package/node_modules/@integration-app/sdk/data-builder/formulas/copy.test.js.map +0 -1
  152. package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.test.d.ts +0 -1
  153. package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.test.js +0 -44
  154. package/node_modules/@integration-app/sdk/data-builder/formulas/extractDate.test.js.map +0 -1
  155. package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.test.d.ts +0 -1
  156. package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.test.js +0 -44
  157. package/node_modules/@integration-app/sdk/data-builder/formulas/extractTime.test.js.map +0 -1
  158. package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.test.d.ts +0 -1
  159. package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.test.js +0 -26
  160. package/node_modules/@integration-app/sdk/data-builder/formulas/findAppRecordId.test.js.map +0 -1
  161. package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.test.d.ts +0 -1
  162. package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.test.js +0 -26
  163. package/node_modules/@integration-app/sdk/data-builder/formulas/findExternalRecordId.test.js.map +0 -1
  164. package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.test.d.ts +0 -1
  165. package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.test.js +0 -14
  166. package/node_modules/@integration-app/sdk/data-builder/formulas/first-name.test.js.map +0 -1
  167. package/node_modules/@integration-app/sdk/data-builder/formulas/index.test.d.ts +0 -1
  168. package/node_modules/@integration-app/sdk/data-builder/formulas/index.test.js +0 -63
  169. package/node_modules/@integration-app/sdk/data-builder/formulas/index.test.js.map +0 -1
  170. package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.test.d.ts +0 -1
  171. package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.test.js +0 -112
  172. package/node_modules/@integration-app/sdk/data-builder/formulas/iterate.test.js.map +0 -1
  173. package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.test.d.ts +0 -1
  174. package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.test.js +0 -18
  175. package/node_modules/@integration-app/sdk/data-builder/formulas/lookup.test.js.map +0 -1
  176. package/node_modules/@integration-app/sdk/data-builder/formulas/map.test.d.ts +0 -1
  177. package/node_modules/@integration-app/sdk/data-builder/formulas/map.test.js +0 -114
  178. package/node_modules/@integration-app/sdk/data-builder/formulas/map.test.js.map +0 -1
  179. package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.test.d.ts +0 -1
  180. package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.test.js +0 -49
  181. package/node_modules/@integration-app/sdk/data-builder/formulas/tpl.test.js.map +0 -1
  182. package/node_modules/@integration-app/sdk/data-builder/formulas/types.d.ts +0 -0
  183. package/node_modules/@integration-app/sdk/data-builder/formulas/types.js.map +0 -1
  184. package/node_modules/@integration-app/sdk/data-builder/index.test.d.ts +0 -1
  185. package/node_modules/@integration-app/sdk/data-builder/index.test.js +0 -295
  186. package/node_modules/@integration-app/sdk/data-builder/index.test.js.map +0 -1
  187. package/node_modules/@integration-app/sdk/data-builder/locators.test.d.ts +0 -1
  188. package/node_modules/@integration-app/sdk/data-builder/locators.test.js +0 -775
  189. package/node_modules/@integration-app/sdk/data-builder/locators.test.js.map +0 -1
  190. package/node_modules/@integration-app/sdk/data-filter/conditions.d.ts +0 -0
  191. package/node_modules/@integration-app/sdk/data-filter/conditions.js.map +0 -1
  192. package/node_modules/@integration-app/sdk/data-filter/data-filter.test.d.ts +0 -1
  193. package/node_modules/@integration-app/sdk/data-filter/data-filter.test.js.map +0 -1
  194. package/node_modules/@integration-app/sdk/data-filter/index.test.d.ts +0 -1
  195. package/node_modules/@integration-app/sdk/data-filter/index.test.js +0 -43
  196. package/node_modules/@integration-app/sdk/data-filter/index.test.js.map +0 -1
  197. package/node_modules/@integration-app/sdk/data-filter/operators.test.d.ts +0 -1
  198. package/node_modules/@integration-app/sdk/data-filter/operators.test.js +0 -490
  199. package/node_modules/@integration-app/sdk/data-filter/operators.test.js.map +0 -1
  200. package/node_modules/@integration-app/sdk/data-links/data-links.d.ts +0 -58
  201. package/node_modules/@integration-app/sdk/data-links/data-links.js.map +0 -1
  202. package/node_modules/@integration-app/sdk/data-schema/index.test.d.ts +0 -1
  203. package/node_modules/@integration-app/sdk/data-schema/index.test.js +0 -86
  204. package/node_modules/@integration-app/sdk/data-schema/index.test.js.map +0 -1
  205. package/node_modules/@integration-app/sdk/data-sources/data-sources.d.ts +0 -41
  206. package/node_modules/@integration-app/sdk/data-sources/data-sources.js.map +0 -1
  207. package/node_modules/@integration-app/sdk/endpoints/endpoint-spec.d.ts +0 -30
  208. package/node_modules/@integration-app/sdk/endpoints/endpoint-spec.js.map +0 -1
  209. package/node_modules/@integration-app/sdk/field-mappings/field-mappings.d.ts +0 -29
  210. package/node_modules/@integration-app/sdk/field-mappings/field-mappings.js.map +0 -1
  211. package/node_modules/@integration-app/sdk/flow-runs/flow-runs.d.ts +0 -51
  212. package/node_modules/@integration-app/sdk/flow-runs/flow-runs.js.map +0 -1
  213. package/node_modules/@integration-app/sdk/flows/flows.d.ts +0 -156
  214. package/node_modules/@integration-app/sdk/flows/flows.js.map +0 -1
  215. package/node_modules/@integration-app/sdk/flows/nodes/data-record-delete-trigger.d.ts +0 -3
  216. package/node_modules/@integration-app/sdk/flows/nodes/data-record-delete-trigger.js.map +0 -1
  217. package/node_modules/@integration-app/sdk/flows/nodes/nodes.d.ts +0 -25
  218. package/node_modules/@integration-app/sdk/flows/nodes/nodes.js.map +0 -1
  219. package/node_modules/@integration-app/sdk/flows/utils.test.d.ts +0 -1
  220. package/node_modules/@integration-app/sdk/flows/utils.test.js +0 -62
  221. package/node_modules/@integration-app/sdk/flows/utils.test.js.map +0 -1
  222. package/node_modules/@integration-app/sdk/integration-elements/integration-elements.d.ts +0 -21
  223. package/node_modules/@integration-app/sdk/integration-elements/integration-elements.js.map +0 -1
  224. package/node_modules/@integration-app/sdk/integrations/integrations.d.ts +0 -48
  225. package/node_modules/@integration-app/sdk/integrations/integrations.js.map +0 -1
  226. package/node_modules/@integration-app/sdk/json-schema/json-schema.test.d.ts +0 -1
  227. package/node_modules/@integration-app/sdk/json-schema/json-schema.test.js +0 -194
  228. package/node_modules/@integration-app/sdk/json-schema/json-schema.test.js.map +0 -1
  229. package/node_modules/@integration-app/sdk/json-schema/schema-builder.test.d.ts +0 -1
  230. package/node_modules/@integration-app/sdk/json-schema/schema-builder.test.js +0 -352
  231. package/node_modules/@integration-app/sdk/json-schema/schema-builder.test.js.map +0 -1
  232. package/node_modules/@integration-app/sdk/jwt.test.d.ts +0 -1
  233. package/node_modules/@integration-app/sdk/jwt.test.js +0 -9
  234. package/node_modules/@integration-app/sdk/jwt.test.js.map +0 -1
  235. package/node_modules/@integration-app/sdk/package-lock.json +0 -3834
  236. package/node_modules/@integration-app/sdk/udm/activities.test.d.ts +0 -1
  237. package/node_modules/@integration-app/sdk/udm/activities.test.js +0 -40
  238. package/node_modules/@integration-app/sdk/udm/activities.test.js.map +0 -1
  239. package/node_modules/@integration-app/sdk/udm/campaign-members.d.ts +0 -45
  240. package/node_modules/@integration-app/sdk/udm/campaign-members.js +0 -99
  241. package/node_modules/@integration-app/sdk/udm/campaign-members.js.map +0 -1
  242. package/node_modules/@integration-app/sdk/udm/contacts.test.d.ts +0 -1
  243. package/node_modules/@integration-app/sdk/udm/contacts.test.js +0 -136
  244. package/node_modules/@integration-app/sdk/udm/contacts.test.js.map +0 -1
  245. package/node_modules/@integration-app/sdk/udm/crm-activities.d.ts +0 -17
  246. package/node_modules/@integration-app/sdk/udm/crm-activities.js.map +0 -1
  247. package/node_modules/@integration-app/sdk/udm/crm-activity.d.ts +0 -11
  248. package/node_modules/@integration-app/sdk/udm/crm-activity.js.map +0 -1
  249. package/node_modules/@integration-app/sdk/udm/crm-companies.d.ts +0 -14
  250. package/node_modules/@integration-app/sdk/udm/crm-companies.js.map +0 -1
  251. package/node_modules/@integration-app/sdk/udm/crm-contact.d.ts +0 -10
  252. package/node_modules/@integration-app/sdk/udm/crm-contact.js.map +0 -1
  253. package/node_modules/@integration-app/sdk/udm/crm-contacts.d.ts +0 -16
  254. package/node_modules/@integration-app/sdk/udm/crm-contacts.js.map +0 -1
  255. package/node_modules/@integration-app/sdk/udm/crm-deals.d.ts +0 -15
  256. package/node_modules/@integration-app/sdk/udm/crm-deals.js.map +0 -1
  257. package/node_modules/@integration-app/sdk/udm/crm-leads.d.ts +0 -16
  258. package/node_modules/@integration-app/sdk/udm/crm-leads.js.map +0 -1
  259. package/node_modules/@integration-app/sdk/udm/members.d.ts +0 -45
  260. package/node_modules/@integration-app/sdk/udm/members.js.map +0 -1
  261. package/node_modules/@integration-app/sdk/users/users.d.ts +0 -5
  262. package/node_modules/@integration-app/sdk/users/users.js.map +0 -1
@@ -0,0 +1,2281 @@
1
+ declare module 'fs' {
2
+ import * as stream from 'stream';
3
+ import EventEmitter = require('events');
4
+ import { URL } from 'url';
5
+ import * as promises from 'fs/promises';
6
+
7
+ export { promises };
8
+ /**
9
+ * Valid types for path values in "fs".
10
+ */
11
+ export type PathLike = string | Buffer | URL;
12
+
13
+ export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
14
+
15
+ export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' };
16
+
17
+ export interface BaseEncodingOptions {
18
+ encoding?: BufferEncoding | null | undefined;
19
+ }
20
+
21
+ export type OpenMode = number | string;
22
+
23
+ export type Mode = number | string;
24
+
25
+ export interface StatsBase<T> {
26
+ isFile(): boolean;
27
+ isDirectory(): boolean;
28
+ isBlockDevice(): boolean;
29
+ isCharacterDevice(): boolean;
30
+ isSymbolicLink(): boolean;
31
+ isFIFO(): boolean;
32
+ isSocket(): boolean;
33
+
34
+ dev: T;
35
+ ino: T;
36
+ mode: T;
37
+ nlink: T;
38
+ uid: T;
39
+ gid: T;
40
+ rdev: T;
41
+ size: T;
42
+ blksize: T;
43
+ blocks: T;
44
+ atimeMs: T;
45
+ mtimeMs: T;
46
+ ctimeMs: T;
47
+ birthtimeMs: T;
48
+ atime: Date;
49
+ mtime: Date;
50
+ ctime: Date;
51
+ birthtime: Date;
52
+ }
53
+
54
+ export interface Stats extends StatsBase<number> {
55
+ }
56
+
57
+ export class Stats {
58
+ }
59
+
60
+ export class Dirent {
61
+ isFile(): boolean;
62
+ isDirectory(): boolean;
63
+ isBlockDevice(): boolean;
64
+ isCharacterDevice(): boolean;
65
+ isSymbolicLink(): boolean;
66
+ isFIFO(): boolean;
67
+ isSocket(): boolean;
68
+ name: string;
69
+ }
70
+
71
+ /**
72
+ * A class representing a directory stream.
73
+ */
74
+ export class Dir {
75
+ readonly path: string;
76
+
77
+ /**
78
+ * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
79
+ */
80
+ [Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
81
+
82
+ /**
83
+ * Asynchronously close the directory's underlying resource handle.
84
+ * Subsequent reads will result in errors.
85
+ */
86
+ close(): Promise<void>;
87
+ close(cb: NoParamCallback): void;
88
+
89
+ /**
90
+ * Synchronously close the directory's underlying resource handle.
91
+ * Subsequent reads will result in errors.
92
+ */
93
+ closeSync(): void;
94
+
95
+ /**
96
+ * Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`.
97
+ * After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read.
98
+ * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
99
+ */
100
+ read(): Promise<Dirent | null>;
101
+ read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
102
+
103
+ /**
104
+ * Synchronously read the next directory entry via `readdir(3)` as a `Dirent`.
105
+ * If there are no more directory entries to read, null will be returned.
106
+ * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
107
+ */
108
+ readSync(): Dirent | null;
109
+ }
110
+
111
+ export interface FSWatcher extends EventEmitter {
112
+ close(): void;
113
+
114
+ /**
115
+ * events.EventEmitter
116
+ * 1. change
117
+ * 2. error
118
+ */
119
+ addListener(event: string, listener: (...args: any[]) => void): this;
120
+ addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
121
+ addListener(event: "error", listener: (error: Error) => void): this;
122
+ addListener(event: "close", listener: () => void): this;
123
+
124
+ on(event: string, listener: (...args: any[]) => void): this;
125
+ on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
126
+ on(event: "error", listener: (error: Error) => void): this;
127
+ on(event: "close", listener: () => void): this;
128
+
129
+ once(event: string, listener: (...args: any[]) => void): this;
130
+ once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
131
+ once(event: "error", listener: (error: Error) => void): this;
132
+ once(event: "close", listener: () => void): this;
133
+
134
+ prependListener(event: string, listener: (...args: any[]) => void): this;
135
+ prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
136
+ prependListener(event: "error", listener: (error: Error) => void): this;
137
+ prependListener(event: "close", listener: () => void): this;
138
+
139
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
140
+ prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
141
+ prependOnceListener(event: "error", listener: (error: Error) => void): this;
142
+ prependOnceListener(event: "close", listener: () => void): this;
143
+ }
144
+
145
+ export class ReadStream extends stream.Readable {
146
+ close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
147
+ bytesRead: number;
148
+ path: string | Buffer;
149
+ pending: boolean;
150
+
151
+ /**
152
+ * events.EventEmitter
153
+ * 1. open
154
+ * 2. close
155
+ * 3. ready
156
+ */
157
+ addListener(event: "close", listener: () => void): this;
158
+ addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
159
+ addListener(event: "end", listener: () => void): this;
160
+ addListener(event: "error", listener: (err: Error) => void): this;
161
+ addListener(event: "open", listener: (fd: number) => void): this;
162
+ addListener(event: "pause", listener: () => void): this;
163
+ addListener(event: "readable", listener: () => void): this;
164
+ addListener(event: "ready", listener: () => void): this;
165
+ addListener(event: "resume", listener: () => void): this;
166
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
167
+
168
+ on(event: "close", listener: () => void): this;
169
+ on(event: "data", listener: (chunk: Buffer | string) => void): this;
170
+ on(event: "end", listener: () => void): this;
171
+ on(event: "error", listener: (err: Error) => void): this;
172
+ on(event: "open", listener: (fd: number) => void): this;
173
+ on(event: "pause", listener: () => void): this;
174
+ on(event: "readable", listener: () => void): this;
175
+ on(event: "ready", listener: () => void): this;
176
+ on(event: "resume", listener: () => void): this;
177
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
178
+
179
+ once(event: "close", listener: () => void): this;
180
+ once(event: "data", listener: (chunk: Buffer | string) => void): this;
181
+ once(event: "end", listener: () => void): this;
182
+ once(event: "error", listener: (err: Error) => void): this;
183
+ once(event: "open", listener: (fd: number) => void): this;
184
+ once(event: "pause", listener: () => void): this;
185
+ once(event: "readable", listener: () => void): this;
186
+ once(event: "ready", listener: () => void): this;
187
+ once(event: "resume", listener: () => void): this;
188
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
189
+
190
+ prependListener(event: "close", listener: () => void): this;
191
+ prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
192
+ prependListener(event: "end", listener: () => void): this;
193
+ prependListener(event: "error", listener: (err: Error) => void): this;
194
+ prependListener(event: "open", listener: (fd: number) => void): this;
195
+ prependListener(event: "pause", listener: () => void): this;
196
+ prependListener(event: "readable", listener: () => void): this;
197
+ prependListener(event: "ready", listener: () => void): this;
198
+ prependListener(event: "resume", listener: () => void): this;
199
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
200
+
201
+ prependOnceListener(event: "close", listener: () => void): this;
202
+ prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
203
+ prependOnceListener(event: "end", listener: () => void): this;
204
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
205
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
206
+ prependOnceListener(event: "pause", listener: () => void): this;
207
+ prependOnceListener(event: "readable", listener: () => void): this;
208
+ prependOnceListener(event: "ready", listener: () => void): this;
209
+ prependOnceListener(event: "resume", listener: () => void): this;
210
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
211
+ }
212
+
213
+ export class WriteStream extends stream.Writable {
214
+ close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
215
+ bytesWritten: number;
216
+ path: string | Buffer;
217
+ pending: boolean;
218
+
219
+ /**
220
+ * events.EventEmitter
221
+ * 1. open
222
+ * 2. close
223
+ * 3. ready
224
+ */
225
+ addListener(event: "close", listener: () => void): this;
226
+ addListener(event: "drain", listener: () => void): this;
227
+ addListener(event: "error", listener: (err: Error) => void): this;
228
+ addListener(event: "finish", listener: () => void): this;
229
+ addListener(event: "open", listener: (fd: number) => void): this;
230
+ addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
231
+ addListener(event: "ready", listener: () => void): this;
232
+ addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
233
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
234
+
235
+ on(event: "close", listener: () => void): this;
236
+ on(event: "drain", listener: () => void): this;
237
+ on(event: "error", listener: (err: Error) => void): this;
238
+ on(event: "finish", listener: () => void): this;
239
+ on(event: "open", listener: (fd: number) => void): this;
240
+ on(event: "pipe", listener: (src: stream.Readable) => void): this;
241
+ on(event: "ready", listener: () => void): this;
242
+ on(event: "unpipe", listener: (src: stream.Readable) => void): this;
243
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
244
+
245
+ once(event: "close", listener: () => void): this;
246
+ once(event: "drain", listener: () => void): this;
247
+ once(event: "error", listener: (err: Error) => void): this;
248
+ once(event: "finish", listener: () => void): this;
249
+ once(event: "open", listener: (fd: number) => void): this;
250
+ once(event: "pipe", listener: (src: stream.Readable) => void): this;
251
+ once(event: "ready", listener: () => void): this;
252
+ once(event: "unpipe", listener: (src: stream.Readable) => void): this;
253
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
254
+
255
+ prependListener(event: "close", listener: () => void): this;
256
+ prependListener(event: "drain", listener: () => void): this;
257
+ prependListener(event: "error", listener: (err: Error) => void): this;
258
+ prependListener(event: "finish", listener: () => void): this;
259
+ prependListener(event: "open", listener: (fd: number) => void): this;
260
+ prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
261
+ prependListener(event: "ready", listener: () => void): this;
262
+ prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
263
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
264
+
265
+ prependOnceListener(event: "close", listener: () => void): this;
266
+ prependOnceListener(event: "drain", listener: () => void): this;
267
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
268
+ prependOnceListener(event: "finish", listener: () => void): this;
269
+ prependOnceListener(event: "open", listener: (fd: number) => void): this;
270
+ prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
271
+ prependOnceListener(event: "ready", listener: () => void): this;
272
+ prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
273
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
274
+ }
275
+
276
+ /**
277
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
278
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
279
+ * URL support is _experimental_.
280
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
281
+ * URL support is _experimental_.
282
+ */
283
+ export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
284
+
285
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
286
+ export namespace rename {
287
+ /**
288
+ * Asynchronous rename(2) - Change the name or location of a file or directory.
289
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
290
+ * URL support is _experimental_.
291
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
292
+ * URL support is _experimental_.
293
+ */
294
+ function __promisify__(oldPath: PathLike, newPath: PathLike): Promise<void>;
295
+ }
296
+
297
+ /**
298
+ * Synchronous rename(2) - Change the name or location of a file or directory.
299
+ * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
300
+ * URL support is _experimental_.
301
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
302
+ * URL support is _experimental_.
303
+ */
304
+ export function renameSync(oldPath: PathLike, newPath: PathLike): void;
305
+
306
+ /**
307
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
308
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
309
+ * @param len If not specified, defaults to `0`.
310
+ */
311
+ export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
312
+
313
+ /**
314
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
315
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
316
+ * URL support is _experimental_.
317
+ */
318
+ export function truncate(path: PathLike, callback: NoParamCallback): void;
319
+
320
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
321
+ export namespace truncate {
322
+ /**
323
+ * Asynchronous truncate(2) - Truncate a file to a specified length.
324
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
325
+ * @param len If not specified, defaults to `0`.
326
+ */
327
+ function __promisify__(path: PathLike, len?: number | null): Promise<void>;
328
+ }
329
+
330
+ /**
331
+ * Synchronous truncate(2) - Truncate a file to a specified length.
332
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
333
+ * @param len If not specified, defaults to `0`.
334
+ */
335
+ export function truncateSync(path: PathLike, len?: number | null): void;
336
+
337
+ /**
338
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
339
+ * @param fd A file descriptor.
340
+ * @param len If not specified, defaults to `0`.
341
+ */
342
+ export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
343
+
344
+ /**
345
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
346
+ * @param fd A file descriptor.
347
+ */
348
+ export function ftruncate(fd: number, callback: NoParamCallback): void;
349
+
350
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
351
+ export namespace ftruncate {
352
+ /**
353
+ * Asynchronous ftruncate(2) - Truncate a file to a specified length.
354
+ * @param fd A file descriptor.
355
+ * @param len If not specified, defaults to `0`.
356
+ */
357
+ function __promisify__(fd: number, len?: number | null): Promise<void>;
358
+ }
359
+
360
+ /**
361
+ * Synchronous ftruncate(2) - Truncate a file to a specified length.
362
+ * @param fd A file descriptor.
363
+ * @param len If not specified, defaults to `0`.
364
+ */
365
+ export function ftruncateSync(fd: number, len?: number | null): void;
366
+
367
+ /**
368
+ * Asynchronous chown(2) - Change ownership of a file.
369
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
370
+ */
371
+ export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
372
+
373
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
374
+ export namespace chown {
375
+ /**
376
+ * Asynchronous chown(2) - Change ownership of a file.
377
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
378
+ */
379
+ function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
380
+ }
381
+
382
+ /**
383
+ * Synchronous chown(2) - Change ownership of a file.
384
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
385
+ */
386
+ export function chownSync(path: PathLike, uid: number, gid: number): void;
387
+
388
+ /**
389
+ * Asynchronous fchown(2) - Change ownership of a file.
390
+ * @param fd A file descriptor.
391
+ */
392
+ export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
393
+
394
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
395
+ export namespace fchown {
396
+ /**
397
+ * Asynchronous fchown(2) - Change ownership of a file.
398
+ * @param fd A file descriptor.
399
+ */
400
+ function __promisify__(fd: number, uid: number, gid: number): Promise<void>;
401
+ }
402
+
403
+ /**
404
+ * Synchronous fchown(2) - Change ownership of a file.
405
+ * @param fd A file descriptor.
406
+ */
407
+ export function fchownSync(fd: number, uid: number, gid: number): void;
408
+
409
+ /**
410
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
411
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
412
+ */
413
+ export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
414
+
415
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
416
+ export namespace lchown {
417
+ /**
418
+ * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
419
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
420
+ */
421
+ function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
422
+ }
423
+
424
+ /**
425
+ * Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
426
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
427
+ */
428
+ export function lchownSync(path: PathLike, uid: number, gid: number): void;
429
+
430
+ /**
431
+ * Changes the access and modification times of a file in the same way as `fs.utimes()`,
432
+ * with the difference that if the path refers to a symbolic link, then the link is not
433
+ * dereferenced: instead, the timestamps of the symbolic link itself are changed.
434
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
435
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
436
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
437
+ */
438
+ export function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
439
+
440
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
441
+ export namespace lutimes {
442
+ /**
443
+ * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
444
+ * with the difference that if the path refers to a symbolic link, then the link is not
445
+ * dereferenced: instead, the timestamps of the symbolic link itself are changed.
446
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
447
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
448
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
449
+ */
450
+ function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
451
+ }
452
+
453
+ /**
454
+ * Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
455
+ * or throws an exception when parameters are incorrect or the operation fails.
456
+ * This is the synchronous version of `fs.lutimes()`.
457
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
458
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
459
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
460
+ */
461
+ export function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
462
+
463
+ /**
464
+ * Asynchronous chmod(2) - Change permissions of a file.
465
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
466
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
467
+ */
468
+ export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
469
+
470
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
471
+ export namespace chmod {
472
+ /**
473
+ * Asynchronous chmod(2) - Change permissions of a file.
474
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
475
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
476
+ */
477
+ function __promisify__(path: PathLike, mode: Mode): Promise<void>;
478
+ }
479
+
480
+ /**
481
+ * Synchronous chmod(2) - Change permissions of a file.
482
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
483
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
484
+ */
485
+ export function chmodSync(path: PathLike, mode: Mode): void;
486
+
487
+ /**
488
+ * Asynchronous fchmod(2) - Change permissions of a file.
489
+ * @param fd A file descriptor.
490
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
491
+ */
492
+ export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
493
+
494
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
495
+ export namespace fchmod {
496
+ /**
497
+ * Asynchronous fchmod(2) - Change permissions of a file.
498
+ * @param fd A file descriptor.
499
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
500
+ */
501
+ function __promisify__(fd: number, mode: Mode): Promise<void>;
502
+ }
503
+
504
+ /**
505
+ * Synchronous fchmod(2) - Change permissions of a file.
506
+ * @param fd A file descriptor.
507
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
508
+ */
509
+ export function fchmodSync(fd: number, mode: Mode): void;
510
+
511
+ /**
512
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
513
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
514
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
515
+ */
516
+ export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
517
+
518
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
519
+ export namespace lchmod {
520
+ /**
521
+ * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
522
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
523
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
524
+ */
525
+ function __promisify__(path: PathLike, mode: Mode): Promise<void>;
526
+ }
527
+
528
+ /**
529
+ * Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
530
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
531
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
532
+ */
533
+ export function lchmodSync(path: PathLike, mode: Mode): void;
534
+
535
+ /**
536
+ * Asynchronous stat(2) - Get file status.
537
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
538
+ */
539
+ export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
540
+ export function stat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
541
+ export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
542
+ export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
543
+
544
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
545
+ export namespace stat {
546
+ /**
547
+ * Asynchronous stat(2) - Get file status.
548
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
549
+ */
550
+ function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
551
+ function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
552
+ function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
553
+ }
554
+
555
+ /**
556
+ * Synchronous stat(2) - Get file status.
557
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
558
+ */
559
+ export function statSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
560
+ export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
561
+ export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
562
+
563
+ /**
564
+ * Asynchronous fstat(2) - Get file status.
565
+ * @param fd A file descriptor.
566
+ */
567
+ export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
568
+ export function fstat(fd: number, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
569
+ export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
570
+ export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
571
+
572
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
573
+ export namespace fstat {
574
+ /**
575
+ * Asynchronous fstat(2) - Get file status.
576
+ * @param fd A file descriptor.
577
+ */
578
+ function __promisify__(fd: number, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
579
+ function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
580
+ function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
581
+ }
582
+
583
+ /**
584
+ * Synchronous fstat(2) - Get file status.
585
+ * @param fd A file descriptor.
586
+ */
587
+ export function fstatSync(fd: number, options?: StatOptions & { bigint?: false | undefined }): Stats;
588
+ export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
589
+ export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
590
+
591
+ /**
592
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
593
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
594
+ */
595
+ export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
596
+ export function lstat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
597
+ export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
598
+ export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
599
+
600
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
601
+ export namespace lstat {
602
+ /**
603
+ * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
604
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
605
+ */
606
+ function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
607
+ function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
608
+ function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
609
+ }
610
+
611
+ /**
612
+ * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
613
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
614
+ */
615
+ export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
616
+ export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
617
+ export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
618
+
619
+ /**
620
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
621
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
622
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
623
+ */
624
+ export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
625
+
626
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
627
+ export namespace link {
628
+ /**
629
+ * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
630
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
631
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
632
+ */
633
+ function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
634
+ }
635
+
636
+ /**
637
+ * Synchronous link(2) - Create a new link (also known as a hard link) to an existing file.
638
+ * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
639
+ * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
640
+ */
641
+ export function linkSync(existingPath: PathLike, newPath: PathLike): void;
642
+
643
+ /**
644
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
645
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
646
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
647
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
648
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
649
+ */
650
+ export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void;
651
+
652
+ /**
653
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
654
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
655
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
656
+ */
657
+ export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
658
+
659
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
660
+ export namespace symlink {
661
+ /**
662
+ * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
663
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
664
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
665
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
666
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
667
+ */
668
+ function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
669
+
670
+ type Type = "dir" | "file" | "junction";
671
+ }
672
+
673
+ /**
674
+ * Synchronous symlink(2) - Create a new symbolic link to an existing file.
675
+ * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
676
+ * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
677
+ * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
678
+ * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
679
+ */
680
+ export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
681
+
682
+ /**
683
+ * Asynchronous readlink(2) - read value of a symbolic link.
684
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
685
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
686
+ */
687
+ export function readlink(
688
+ path: PathLike,
689
+ options: BaseEncodingOptions | BufferEncoding | undefined | null,
690
+ callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
691
+ ): void;
692
+
693
+ /**
694
+ * Asynchronous readlink(2) - read value of a symbolic link.
695
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
696
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
697
+ */
698
+ export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
699
+
700
+ /**
701
+ * Asynchronous readlink(2) - read value of a symbolic link.
702
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
703
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
704
+ */
705
+ export function readlink(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
706
+
707
+ /**
708
+ * Asynchronous readlink(2) - read value of a symbolic link.
709
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
710
+ */
711
+ export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
712
+
713
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
714
+ export namespace readlink {
715
+ /**
716
+ * Asynchronous readlink(2) - read value of a symbolic link.
717
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
718
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
719
+ */
720
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
721
+
722
+ /**
723
+ * Asynchronous readlink(2) - read value of a symbolic link.
724
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
725
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
726
+ */
727
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
728
+
729
+ /**
730
+ * Asynchronous readlink(2) - read value of a symbolic link.
731
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
732
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
733
+ */
734
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
735
+ }
736
+
737
+ /**
738
+ * Synchronous readlink(2) - read value of a symbolic link.
739
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
740
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
741
+ */
742
+ export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
743
+
744
+ /**
745
+ * Synchronous readlink(2) - read value of a symbolic link.
746
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
747
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
748
+ */
749
+ export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
750
+
751
+ /**
752
+ * Synchronous readlink(2) - read value of a symbolic link.
753
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
754
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
755
+ */
756
+ export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
757
+
758
+ /**
759
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
760
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
761
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
762
+ */
763
+ export function realpath(
764
+ path: PathLike,
765
+ options: BaseEncodingOptions | BufferEncoding | undefined | null,
766
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
767
+ ): void;
768
+
769
+ /**
770
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
771
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
772
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
773
+ */
774
+ export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
775
+
776
+ /**
777
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
778
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
779
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
780
+ */
781
+ export function realpath(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
782
+
783
+ /**
784
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
785
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
786
+ */
787
+ export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
788
+
789
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
790
+ export namespace realpath {
791
+ /**
792
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
793
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
794
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
795
+ */
796
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
797
+
798
+ /**
799
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
800
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
801
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
802
+ */
803
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
804
+
805
+ /**
806
+ * Asynchronous realpath(3) - return the canonicalized absolute pathname.
807
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
808
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
809
+ */
810
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
811
+
812
+ function native(
813
+ path: PathLike,
814
+ options: BaseEncodingOptions | BufferEncoding | undefined | null,
815
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
816
+ ): void;
817
+ function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
818
+ function native(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
819
+ function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
820
+ }
821
+
822
+ /**
823
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
824
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
825
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
826
+ */
827
+ export function realpathSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
828
+
829
+ /**
830
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
831
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
832
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
833
+ */
834
+ export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
835
+
836
+ /**
837
+ * Synchronous realpath(3) - return the canonicalized absolute pathname.
838
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
839
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
840
+ */
841
+ export function realpathSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
842
+
843
+ export namespace realpathSync {
844
+ function native(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
845
+ function native(path: PathLike, options: BufferEncodingOption): Buffer;
846
+ function native(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
847
+ }
848
+
849
+ /**
850
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
851
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
852
+ */
853
+ export function unlink(path: PathLike, callback: NoParamCallback): void;
854
+
855
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
856
+ export namespace unlink {
857
+ /**
858
+ * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
859
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
860
+ */
861
+ function __promisify__(path: PathLike): Promise<void>;
862
+ }
863
+
864
+ /**
865
+ * Synchronous unlink(2) - delete a name and possibly the file it refers to.
866
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
867
+ */
868
+ export function unlinkSync(path: PathLike): void;
869
+
870
+ export interface RmDirOptions {
871
+ /**
872
+ * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
873
+ * `EPERM` error is encountered, Node.js will retry the operation with a linear
874
+ * backoff wait of `retryDelay` ms longer on each try. This option represents the
875
+ * number of retries. This option is ignored if the `recursive` option is not
876
+ * `true`.
877
+ * @default 0
878
+ */
879
+ maxRetries?: number | undefined;
880
+ /**
881
+ * @deprecated since v14.14.0 In future versions of Node.js,
882
+ * `fs.rmdir(path, { recursive: true })` will throw on nonexistent
883
+ * paths, or when given a file as a target.
884
+ * Use `fs.rm(path, { recursive: true, force: true })` instead.
885
+ *
886
+ * If `true`, perform a recursive directory removal. In
887
+ * recursive mode, errors are not reported if `path` does not exist, and
888
+ * operations are retried on failure.
889
+ * @default false
890
+ */
891
+ recursive?: boolean | undefined;
892
+ /**
893
+ * The amount of time in milliseconds to wait between retries.
894
+ * This option is ignored if the `recursive` option is not `true`.
895
+ * @default 100
896
+ */
897
+ retryDelay?: number | undefined;
898
+ }
899
+
900
+ /**
901
+ * Asynchronous rmdir(2) - delete a directory.
902
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
903
+ */
904
+ export function rmdir(path: PathLike, callback: NoParamCallback): void;
905
+ export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
906
+
907
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
908
+ export namespace rmdir {
909
+ /**
910
+ * Asynchronous rmdir(2) - delete a directory.
911
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
912
+ */
913
+ function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
914
+ }
915
+
916
+ /**
917
+ * Synchronous rmdir(2) - delete a directory.
918
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
919
+ */
920
+ export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
921
+
922
+ export interface RmOptions {
923
+ /**
924
+ * When `true`, exceptions will be ignored if `path` does not exist.
925
+ * @default false
926
+ */
927
+ force?: boolean | undefined;
928
+ /**
929
+ * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
930
+ * `EPERM` error is encountered, Node.js will retry the operation with a linear
931
+ * backoff wait of `retryDelay` ms longer on each try. This option represents the
932
+ * number of retries. This option is ignored if the `recursive` option is not
933
+ * `true`.
934
+ * @default 0
935
+ */
936
+ maxRetries?: number | undefined;
937
+ /**
938
+ * If `true`, perform a recursive directory removal. In
939
+ * recursive mode, errors are not reported if `path` does not exist, and
940
+ * operations are retried on failure.
941
+ * @default false
942
+ */
943
+ recursive?: boolean | undefined;
944
+ /**
945
+ * The amount of time in milliseconds to wait between retries.
946
+ * This option is ignored if the `recursive` option is not `true`.
947
+ * @default 100
948
+ */
949
+ retryDelay?: number | undefined;
950
+ }
951
+
952
+ /**
953
+ * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
954
+ */
955
+ export function rm(path: PathLike, callback: NoParamCallback): void;
956
+ export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
957
+
958
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
959
+ export namespace rm {
960
+ /**
961
+ * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
962
+ */
963
+ function __promisify__(path: PathLike, options?: RmOptions): Promise<void>;
964
+ }
965
+
966
+ /**
967
+ * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility).
968
+ */
969
+ export function rmSync(path: PathLike, options?: RmOptions): void;
970
+
971
+ export interface MakeDirectoryOptions {
972
+ /**
973
+ * Indicates whether parent folders should be created.
974
+ * If a folder was created, the path to the first created folder will be returned.
975
+ * @default false
976
+ */
977
+ recursive?: boolean | undefined;
978
+ /**
979
+ * A file mode. If a string is passed, it is parsed as an octal integer. If not specified
980
+ * @default 0o777
981
+ */
982
+ mode?: Mode | undefined;
983
+ }
984
+
985
+ /**
986
+ * Asynchronous mkdir(2) - create a directory.
987
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
988
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
989
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
990
+ */
991
+ export function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;
992
+
993
+ /**
994
+ * Asynchronous mkdir(2) - create a directory.
995
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
996
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
997
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
998
+ */
999
+ export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
1000
+
1001
+ /**
1002
+ * Asynchronous mkdir(2) - create a directory.
1003
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1004
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1005
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1006
+ */
1007
+ export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;
1008
+
1009
+ /**
1010
+ * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
1011
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1012
+ */
1013
+ export function mkdir(path: PathLike, callback: NoParamCallback): void;
1014
+
1015
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1016
+ export namespace mkdir {
1017
+ /**
1018
+ * Asynchronous mkdir(2) - create a directory.
1019
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1020
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1021
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1022
+ */
1023
+ function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;
1024
+
1025
+ /**
1026
+ * Asynchronous mkdir(2) - create a directory.
1027
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1028
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1029
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1030
+ */
1031
+ function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
1032
+
1033
+ /**
1034
+ * Asynchronous mkdir(2) - create a directory.
1035
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1036
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1037
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1038
+ */
1039
+ function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
1040
+ }
1041
+
1042
+ /**
1043
+ * Synchronous mkdir(2) - create a directory.
1044
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1045
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1046
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1047
+ */
1048
+ export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string | undefined;
1049
+
1050
+ /**
1051
+ * Synchronous mkdir(2) - create a directory.
1052
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1053
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1054
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1055
+ */
1056
+ export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): void;
1057
+
1058
+ /**
1059
+ * Synchronous mkdir(2) - create a directory.
1060
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1061
+ * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1062
+ * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1063
+ */
1064
+ export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
1065
+
1066
+ /**
1067
+ * Asynchronously creates a unique temporary directory.
1068
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1069
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1070
+ */
1071
+ export function mkdtemp(prefix: string, options: BaseEncodingOptions | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
1072
+
1073
+ /**
1074
+ * Asynchronously creates a unique temporary directory.
1075
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1076
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1077
+ */
1078
+ export function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void;
1079
+
1080
+ /**
1081
+ * Asynchronously creates a unique temporary directory.
1082
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1083
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1084
+ */
1085
+ export function mkdtemp(prefix: string, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
1086
+
1087
+ /**
1088
+ * Asynchronously creates a unique temporary directory.
1089
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1090
+ */
1091
+ export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
1092
+
1093
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1094
+ export namespace mkdtemp {
1095
+ /**
1096
+ * Asynchronously creates a unique temporary directory.
1097
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1098
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1099
+ */
1100
+ function __promisify__(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
1101
+
1102
+ /**
1103
+ * Asynchronously creates a unique temporary directory.
1104
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1105
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1106
+ */
1107
+ function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
1108
+
1109
+ /**
1110
+ * Asynchronously creates a unique temporary directory.
1111
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1112
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1113
+ */
1114
+ function __promisify__(prefix: string, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
1115
+ }
1116
+
1117
+ /**
1118
+ * Synchronously creates a unique temporary directory.
1119
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1120
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1121
+ */
1122
+ export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): string;
1123
+
1124
+ /**
1125
+ * Synchronously creates a unique temporary directory.
1126
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1127
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1128
+ */
1129
+ export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
1130
+
1131
+ /**
1132
+ * Synchronously creates a unique temporary directory.
1133
+ * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1134
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1135
+ */
1136
+ export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | string | null): string | Buffer;
1137
+
1138
+ /**
1139
+ * Asynchronous readdir(3) - read a directory.
1140
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1141
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1142
+ */
1143
+ export function readdir(
1144
+ path: PathLike,
1145
+ options: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
1146
+ callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
1147
+ ): void;
1148
+
1149
+ /**
1150
+ * Asynchronous readdir(3) - read a directory.
1151
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1152
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1153
+ */
1154
+ export function readdir(
1155
+ path: PathLike,
1156
+ options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
1157
+ callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
1158
+ ): void;
1159
+
1160
+ /**
1161
+ * Asynchronous readdir(3) - read a directory.
1162
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1163
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1164
+ */
1165
+ export function readdir(
1166
+ path: PathLike,
1167
+ options: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
1168
+ callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
1169
+ ): void;
1170
+
1171
+ /**
1172
+ * Asynchronous readdir(3) - read a directory.
1173
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1174
+ */
1175
+ export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
1176
+
1177
+ /**
1178
+ * Asynchronous readdir(3) - read a directory.
1179
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1180
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
1181
+ */
1182
+ export function readdir(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
1183
+
1184
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1185
+ export namespace readdir {
1186
+ /**
1187
+ * Asynchronous readdir(3) - read a directory.
1188
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1189
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1190
+ */
1191
+ function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
1192
+
1193
+ /**
1194
+ * Asynchronous readdir(3) - read a directory.
1195
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1196
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1197
+ */
1198
+ function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined }): Promise<Buffer[]>;
1199
+
1200
+ /**
1201
+ * Asynchronous readdir(3) - read a directory.
1202
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1203
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1204
+ */
1205
+ function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
1206
+
1207
+ /**
1208
+ * Asynchronous readdir(3) - read a directory.
1209
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1210
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent
1211
+ */
1212
+ function __promisify__(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Promise<Dirent[]>;
1213
+ }
1214
+
1215
+ /**
1216
+ * Synchronous readdir(3) - read a directory.
1217
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1218
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1219
+ */
1220
+ export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): string[];
1221
+
1222
+ /**
1223
+ * Synchronous readdir(3) - read a directory.
1224
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1225
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1226
+ */
1227
+ export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Buffer[];
1228
+
1229
+ /**
1230
+ * Synchronous readdir(3) - read a directory.
1231
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1232
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1233
+ */
1234
+ export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): string[] | Buffer[];
1235
+
1236
+ /**
1237
+ * Synchronous readdir(3) - read a directory.
1238
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1239
+ * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
1240
+ */
1241
+ export function readdirSync(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Dirent[];
1242
+
1243
+ /**
1244
+ * Asynchronous close(2) - close a file descriptor.
1245
+ * @param fd A file descriptor.
1246
+ */
1247
+ export function close(fd: number, callback: NoParamCallback): void;
1248
+
1249
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1250
+ export namespace close {
1251
+ /**
1252
+ * Asynchronous close(2) - close a file descriptor.
1253
+ * @param fd A file descriptor.
1254
+ */
1255
+ function __promisify__(fd: number): Promise<void>;
1256
+ }
1257
+
1258
+ /**
1259
+ * Synchronous close(2) - close a file descriptor.
1260
+ * @param fd A file descriptor.
1261
+ */
1262
+ export function closeSync(fd: number): void;
1263
+
1264
+ /**
1265
+ * Asynchronous open(2) - open and possibly create a file.
1266
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1267
+ * @param [flags='r'] See `support of file system `flags``.
1268
+ * @param [mode=0o666]
1269
+ */
1270
+ export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1271
+
1272
+ /**
1273
+ * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
1274
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1275
+ * @param [flags='r'] See `support of file system `flags``.
1276
+ */
1277
+ export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1278
+
1279
+ /**
1280
+ * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
1281
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1282
+ */
1283
+ export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1284
+
1285
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1286
+ export namespace open {
1287
+ /**
1288
+ * Asynchronous open(2) - open and possibly create a file.
1289
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1290
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
1291
+ */
1292
+ function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise<number>;
1293
+ }
1294
+
1295
+ /**
1296
+ * Synchronous open(2) - open and possibly create a file, returning a file descriptor..
1297
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1298
+ * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
1299
+ */
1300
+ export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
1301
+
1302
+ /**
1303
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
1304
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1305
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1306
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1307
+ */
1308
+ export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
1309
+
1310
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1311
+ export namespace utimes {
1312
+ /**
1313
+ * Asynchronously change file timestamps of the file referenced by the supplied path.
1314
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1315
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1316
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1317
+ */
1318
+ function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
1319
+ }
1320
+
1321
+ /**
1322
+ * Synchronously change file timestamps of the file referenced by the supplied path.
1323
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1324
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1325
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1326
+ */
1327
+ export function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
1328
+
1329
+ /**
1330
+ * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
1331
+ * @param fd A file descriptor.
1332
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1333
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1334
+ */
1335
+ export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
1336
+
1337
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1338
+ export namespace futimes {
1339
+ /**
1340
+ * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
1341
+ * @param fd A file descriptor.
1342
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1343
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1344
+ */
1345
+ function __promisify__(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
1346
+ }
1347
+
1348
+ /**
1349
+ * Synchronously change file timestamps of the file referenced by the supplied file descriptor.
1350
+ * @param fd A file descriptor.
1351
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
1352
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
1353
+ */
1354
+ export function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
1355
+
1356
+ /**
1357
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
1358
+ * @param fd A file descriptor.
1359
+ */
1360
+ export function fsync(fd: number, callback: NoParamCallback): void;
1361
+
1362
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1363
+ export namespace fsync {
1364
+ /**
1365
+ * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
1366
+ * @param fd A file descriptor.
1367
+ */
1368
+ function __promisify__(fd: number): Promise<void>;
1369
+ }
1370
+
1371
+ /**
1372
+ * Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
1373
+ * @param fd A file descriptor.
1374
+ */
1375
+ export function fsyncSync(fd: number): void;
1376
+
1377
+ /**
1378
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1379
+ * @param fd A file descriptor.
1380
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1381
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1382
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1383
+ */
1384
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(
1385
+ fd: number,
1386
+ buffer: TBuffer,
1387
+ offset: number | undefined | null,
1388
+ length: number | undefined | null,
1389
+ position: number | undefined | null,
1390
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
1391
+ ): void;
1392
+
1393
+ /**
1394
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1395
+ * @param fd A file descriptor.
1396
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1397
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1398
+ */
1399
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(
1400
+ fd: number,
1401
+ buffer: TBuffer,
1402
+ offset: number | undefined | null,
1403
+ length: number | undefined | null,
1404
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
1405
+ ): void;
1406
+
1407
+ /**
1408
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1409
+ * @param fd A file descriptor.
1410
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1411
+ */
1412
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(
1413
+ fd: number,
1414
+ buffer: TBuffer,
1415
+ offset: number | undefined | null,
1416
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
1417
+ ): void;
1418
+
1419
+ /**
1420
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1421
+ * @param fd A file descriptor.
1422
+ */
1423
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void;
1424
+
1425
+ /**
1426
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
1427
+ * @param fd A file descriptor.
1428
+ * @param string A string to write.
1429
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1430
+ * @param encoding The expected string encoding.
1431
+ */
1432
+ export function write(
1433
+ fd: number,
1434
+ string: string,
1435
+ position: number | undefined | null,
1436
+ encoding: BufferEncoding | undefined | null,
1437
+ callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
1438
+ ): void;
1439
+
1440
+ /**
1441
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
1442
+ * @param fd A file descriptor.
1443
+ * @param string A string to write.
1444
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1445
+ */
1446
+ export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
1447
+
1448
+ /**
1449
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
1450
+ * @param fd A file descriptor.
1451
+ * @param string A string to write.
1452
+ */
1453
+ export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
1454
+
1455
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1456
+ export namespace write {
1457
+ /**
1458
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1459
+ * @param fd A file descriptor.
1460
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1461
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1462
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1463
+ */
1464
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
1465
+ fd: number,
1466
+ buffer?: TBuffer,
1467
+ offset?: number,
1468
+ length?: number,
1469
+ position?: number | null,
1470
+ ): Promise<{ bytesWritten: number, buffer: TBuffer }>;
1471
+
1472
+ /**
1473
+ * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
1474
+ * @param fd A file descriptor.
1475
+ * @param string A string to write.
1476
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1477
+ * @param encoding The expected string encoding.
1478
+ */
1479
+ function __promisify__(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>;
1480
+ }
1481
+
1482
+ /**
1483
+ * Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written.
1484
+ * @param fd A file descriptor.
1485
+ * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1486
+ * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1487
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1488
+ */
1489
+ export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
1490
+
1491
+ /**
1492
+ * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
1493
+ * @param fd A file descriptor.
1494
+ * @param string A string to write.
1495
+ * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1496
+ * @param encoding The expected string encoding.
1497
+ */
1498
+ export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
1499
+
1500
+ /**
1501
+ * Asynchronously reads data from the file referenced by the supplied file descriptor.
1502
+ * @param fd A file descriptor.
1503
+ * @param buffer The buffer that the data will be written to.
1504
+ * @param offset The offset in the buffer at which to start writing.
1505
+ * @param length The number of bytes to read.
1506
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1507
+ */
1508
+ export function read<TBuffer extends NodeJS.ArrayBufferView>(
1509
+ fd: number,
1510
+ buffer: TBuffer,
1511
+ offset: number,
1512
+ length: number,
1513
+ position: number | null,
1514
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
1515
+ ): void;
1516
+
1517
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1518
+ export namespace read {
1519
+ /**
1520
+ * @param fd A file descriptor.
1521
+ * @param buffer The buffer that the data will be written to.
1522
+ * @param offset The offset in the buffer at which to start writing.
1523
+ * @param length The number of bytes to read.
1524
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1525
+ */
1526
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
1527
+ fd: number,
1528
+ buffer: TBuffer,
1529
+ offset: number,
1530
+ length: number,
1531
+ position: number | null
1532
+ ): Promise<{ bytesRead: number, buffer: TBuffer }>;
1533
+ }
1534
+
1535
+ export interface ReadSyncOptions {
1536
+ /**
1537
+ * @default 0
1538
+ */
1539
+ offset?: number | undefined;
1540
+ /**
1541
+ * @default `length of buffer`
1542
+ */
1543
+ length?: number | undefined;
1544
+ /**
1545
+ * @default null
1546
+ */
1547
+ position?: number | null | undefined;
1548
+ }
1549
+
1550
+ /**
1551
+ * Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read.
1552
+ * @param fd A file descriptor.
1553
+ * @param buffer The buffer that the data will be written to.
1554
+ * @param offset The offset in the buffer at which to start writing.
1555
+ * @param length The number of bytes to read.
1556
+ * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1557
+ */
1558
+ export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1559
+
1560
+ /**
1561
+ * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
1562
+ * If no `options` object is specified, it will default with the above values.
1563
+ */
1564
+ export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
1565
+
1566
+ /**
1567
+ * Asynchronously reads the entire contents of a file.
1568
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1569
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1570
+ * @param options An object that may contain an optional flag.
1571
+ * If a flag is not provided, it defaults to `'r'`.
1572
+ */
1573
+ export function readFile(
1574
+ path: PathLike | number,
1575
+ options: { encoding?: null | undefined; flag?: string | undefined; } | undefined | null,
1576
+ callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
1577
+ ): void;
1578
+
1579
+ /**
1580
+ * Asynchronously reads the entire contents of a file.
1581
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1582
+ * URL support is _experimental_.
1583
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1584
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1585
+ * If a flag is not provided, it defaults to `'r'`.
1586
+ */
1587
+ export function readFile(
1588
+ path: PathLike | number,
1589
+ options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding,
1590
+ callback: (err: NodeJS.ErrnoException | null, data: string) => void
1591
+ ): void;
1592
+
1593
+ /**
1594
+ * Asynchronously reads the entire contents of a file.
1595
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1596
+ * URL support is _experimental_.
1597
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1598
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1599
+ * If a flag is not provided, it defaults to `'r'`.
1600
+ */
1601
+ export function readFile(
1602
+ path: PathLike | number,
1603
+ options: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | undefined | null,
1604
+ callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
1605
+ ): void;
1606
+
1607
+ /**
1608
+ * Asynchronously reads the entire contents of a file.
1609
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1610
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1611
+ */
1612
+ export function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
1613
+
1614
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1615
+ export namespace readFile {
1616
+ /**
1617
+ * Asynchronously reads the entire contents of a file.
1618
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1619
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1620
+ * @param options An object that may contain an optional flag.
1621
+ * If a flag is not provided, it defaults to `'r'`.
1622
+ */
1623
+ function __promisify__(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Promise<Buffer>;
1624
+
1625
+ /**
1626
+ * Asynchronously reads the entire contents of a file.
1627
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1628
+ * URL support is _experimental_.
1629
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1630
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1631
+ * If a flag is not provided, it defaults to `'r'`.
1632
+ */
1633
+ function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): Promise<string>;
1634
+
1635
+ /**
1636
+ * Asynchronously reads the entire contents of a file.
1637
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1638
+ * URL support is _experimental_.
1639
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1640
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1641
+ * If a flag is not provided, it defaults to `'r'`.
1642
+ */
1643
+ function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): Promise<string | Buffer>;
1644
+ }
1645
+
1646
+ /**
1647
+ * Synchronously reads the entire contents of a file.
1648
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1649
+ * URL support is _experimental_.
1650
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1651
+ * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
1652
+ */
1653
+ export function readFileSync(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Buffer;
1654
+
1655
+ /**
1656
+ * Synchronously reads the entire contents of a file.
1657
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1658
+ * URL support is _experimental_.
1659
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1660
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1661
+ * If a flag is not provided, it defaults to `'r'`.
1662
+ */
1663
+ export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): string;
1664
+
1665
+ /**
1666
+ * Synchronously reads the entire contents of a file.
1667
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1668
+ * URL support is _experimental_.
1669
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1670
+ * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1671
+ * If a flag is not provided, it defaults to `'r'`.
1672
+ */
1673
+ export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): string | Buffer;
1674
+
1675
+ export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode | undefined; flag?: string | undefined; } | BufferEncoding | null;
1676
+
1677
+ /**
1678
+ * Asynchronously writes data to a file, replacing the file if it already exists.
1679
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1680
+ * URL support is _experimental_.
1681
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1682
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1683
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1684
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1685
+ * If `mode` is not supplied, the default of `0o666` is used.
1686
+ * If `mode` is a string, it is parsed as an octal integer.
1687
+ * If `flag` is not supplied, the default of `'w'` is used.
1688
+ */
1689
+ export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
1690
+
1691
+ /**
1692
+ * Asynchronously writes data to a file, replacing the file if it already exists.
1693
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1694
+ * URL support is _experimental_.
1695
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1696
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1697
+ */
1698
+ export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void;
1699
+
1700
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1701
+ export namespace writeFile {
1702
+ /**
1703
+ * Asynchronously writes data to a file, replacing the file if it already exists.
1704
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1705
+ * URL support is _experimental_.
1706
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1707
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1708
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1709
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1710
+ * If `mode` is not supplied, the default of `0o666` is used.
1711
+ * If `mode` is a string, it is parsed as an octal integer.
1712
+ * If `flag` is not supplied, the default of `'w'` is used.
1713
+ */
1714
+ function __promisify__(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<void>;
1715
+ }
1716
+
1717
+ /**
1718
+ * Synchronously writes data to a file, replacing the file if it already exists.
1719
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1720
+ * URL support is _experimental_.
1721
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1722
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1723
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1724
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1725
+ * If `mode` is not supplied, the default of `0o666` is used.
1726
+ * If `mode` is a string, it is parsed as an octal integer.
1727
+ * If `flag` is not supplied, the default of `'w'` is used.
1728
+ */
1729
+ export function writeFileSync(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void;
1730
+
1731
+ /**
1732
+ * Asynchronously append data to a file, creating the file if it does not exist.
1733
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1734
+ * URL support is _experimental_.
1735
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1736
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1737
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1738
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1739
+ * If `mode` is not supplied, the default of `0o666` is used.
1740
+ * If `mode` is a string, it is parsed as an octal integer.
1741
+ * If `flag` is not supplied, the default of `'a'` is used.
1742
+ */
1743
+ export function appendFile(file: PathLike | number, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void;
1744
+
1745
+ /**
1746
+ * Asynchronously append data to a file, creating the file if it does not exist.
1747
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1748
+ * URL support is _experimental_.
1749
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1750
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1751
+ */
1752
+ export function appendFile(file: PathLike | number, data: string | Uint8Array, callback: NoParamCallback): void;
1753
+
1754
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1755
+ export namespace appendFile {
1756
+ /**
1757
+ * Asynchronously append data to a file, creating the file if it does not exist.
1758
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1759
+ * URL support is _experimental_.
1760
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1761
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1762
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1763
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1764
+ * If `mode` is not supplied, the default of `0o666` is used.
1765
+ * If `mode` is a string, it is parsed as an octal integer.
1766
+ * If `flag` is not supplied, the default of `'a'` is used.
1767
+ */
1768
+ function __promisify__(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): Promise<void>;
1769
+ }
1770
+
1771
+ /**
1772
+ * Synchronously append data to a file, creating the file if it does not exist.
1773
+ * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1774
+ * URL support is _experimental_.
1775
+ * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1776
+ * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1777
+ * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
1778
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1779
+ * If `mode` is not supplied, the default of `0o666` is used.
1780
+ * If `mode` is a string, it is parsed as an octal integer.
1781
+ * If `flag` is not supplied, the default of `'a'` is used.
1782
+ */
1783
+ export function appendFileSync(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): void;
1784
+
1785
+ /**
1786
+ * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
1787
+ */
1788
+ export function watchFile(filename: PathLike, options: { persistent?: boolean | undefined; interval?: number | undefined; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
1789
+
1790
+ /**
1791
+ * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
1792
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1793
+ * URL support is _experimental_.
1794
+ */
1795
+ export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
1796
+
1797
+ /**
1798
+ * Stop watching for changes on `filename`.
1799
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1800
+ * URL support is _experimental_.
1801
+ */
1802
+ export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
1803
+
1804
+ /**
1805
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1806
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1807
+ * URL support is _experimental_.
1808
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1809
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1810
+ * If `persistent` is not supplied, the default of `true` is used.
1811
+ * If `recursive` is not supplied, the default of `false` is used.
1812
+ */
1813
+ export function watch(
1814
+ filename: PathLike,
1815
+ options: { encoding?: BufferEncoding | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null,
1816
+ listener?: (event: "rename" | "change", filename: string) => void,
1817
+ ): FSWatcher;
1818
+
1819
+ /**
1820
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1821
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1822
+ * URL support is _experimental_.
1823
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1824
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1825
+ * If `persistent` is not supplied, the default of `true` is used.
1826
+ * If `recursive` is not supplied, the default of `false` is used.
1827
+ */
1828
+ export function watch(
1829
+ filename: PathLike,
1830
+ options: { encoding: "buffer", persistent?: boolean | undefined, recursive?: boolean | undefined; } | "buffer",
1831
+ listener?: (event: "rename" | "change", filename: Buffer) => void
1832
+ ): FSWatcher;
1833
+
1834
+ /**
1835
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1836
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1837
+ * URL support is _experimental_.
1838
+ * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1839
+ * If `encoding` is not supplied, the default of `'utf8'` is used.
1840
+ * If `persistent` is not supplied, the default of `true` is used.
1841
+ * If `recursive` is not supplied, the default of `false` is used.
1842
+ */
1843
+ export function watch(
1844
+ filename: PathLike,
1845
+ options: { encoding?: BufferEncoding | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | string | null,
1846
+ listener?: (event: "rename" | "change", filename: string | Buffer) => void,
1847
+ ): FSWatcher;
1848
+
1849
+ /**
1850
+ * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1851
+ * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1852
+ * URL support is _experimental_.
1853
+ */
1854
+ export function watch(filename: PathLike, listener?: (event: "rename" | "change", filename: string) => any): FSWatcher;
1855
+
1856
+ /**
1857
+ * Asynchronously tests whether or not the given path exists by checking with the file system.
1858
+ * @deprecated since v1.0.0 Use `fs.stat()` or `fs.access()` instead
1859
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1860
+ * URL support is _experimental_.
1861
+ */
1862
+ export function exists(path: PathLike, callback: (exists: boolean) => void): void;
1863
+
1864
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1865
+ export namespace exists {
1866
+ /**
1867
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1868
+ * URL support is _experimental_.
1869
+ */
1870
+ function __promisify__(path: PathLike): Promise<boolean>;
1871
+ }
1872
+
1873
+ /**
1874
+ * Synchronously tests whether or not the given path exists by checking with the file system.
1875
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1876
+ * URL support is _experimental_.
1877
+ */
1878
+ export function existsSync(path: PathLike): boolean;
1879
+
1880
+ export namespace constants {
1881
+ // File Access Constants
1882
+
1883
+ /** Constant for fs.access(). File is visible to the calling process. */
1884
+ const F_OK: number;
1885
+
1886
+ /** Constant for fs.access(). File can be read by the calling process. */
1887
+ const R_OK: number;
1888
+
1889
+ /** Constant for fs.access(). File can be written by the calling process. */
1890
+ const W_OK: number;
1891
+
1892
+ /** Constant for fs.access(). File can be executed by the calling process. */
1893
+ const X_OK: number;
1894
+
1895
+ // File Copy Constants
1896
+
1897
+ /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */
1898
+ const COPYFILE_EXCL: number;
1899
+
1900
+ /**
1901
+ * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink.
1902
+ * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used.
1903
+ */
1904
+ const COPYFILE_FICLONE: number;
1905
+
1906
+ /**
1907
+ * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink.
1908
+ * If the underlying platform does not support copy-on-write, then the operation will fail with an error.
1909
+ */
1910
+ const COPYFILE_FICLONE_FORCE: number;
1911
+
1912
+ // File Open Constants
1913
+
1914
+ /** Constant for fs.open(). Flag indicating to open a file for read-only access. */
1915
+ const O_RDONLY: number;
1916
+
1917
+ /** Constant for fs.open(). Flag indicating to open a file for write-only access. */
1918
+ const O_WRONLY: number;
1919
+
1920
+ /** Constant for fs.open(). Flag indicating to open a file for read-write access. */
1921
+ const O_RDWR: number;
1922
+
1923
+ /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */
1924
+ const O_CREAT: number;
1925
+
1926
+ /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */
1927
+ const O_EXCL: number;
1928
+
1929
+ /**
1930
+ * Constant for fs.open(). Flag indicating that if path identifies a terminal device,
1931
+ * opening the path shall not cause that terminal to become the controlling terminal for the process
1932
+ * (if the process does not already have one).
1933
+ */
1934
+ const O_NOCTTY: number;
1935
+
1936
+ /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */
1937
+ const O_TRUNC: number;
1938
+
1939
+ /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */
1940
+ const O_APPEND: number;
1941
+
1942
+ /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */
1943
+ const O_DIRECTORY: number;
1944
+
1945
+ /**
1946
+ * constant for fs.open().
1947
+ * Flag indicating reading accesses to the file system will no longer result in
1948
+ * an update to the atime information associated with the file.
1949
+ * This flag is available on Linux operating systems only.
1950
+ */
1951
+ const O_NOATIME: number;
1952
+
1953
+ /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */
1954
+ const O_NOFOLLOW: number;
1955
+
1956
+ /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */
1957
+ const O_SYNC: number;
1958
+
1959
+ /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */
1960
+ const O_DSYNC: number;
1961
+
1962
+ /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */
1963
+ const O_SYMLINK: number;
1964
+
1965
+ /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */
1966
+ const O_DIRECT: number;
1967
+
1968
+ /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */
1969
+ const O_NONBLOCK: number;
1970
+
1971
+ // File Type Constants
1972
+
1973
+ /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */
1974
+ const S_IFMT: number;
1975
+
1976
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */
1977
+ const S_IFREG: number;
1978
+
1979
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */
1980
+ const S_IFDIR: number;
1981
+
1982
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */
1983
+ const S_IFCHR: number;
1984
+
1985
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */
1986
+ const S_IFBLK: number;
1987
+
1988
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */
1989
+ const S_IFIFO: number;
1990
+
1991
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */
1992
+ const S_IFLNK: number;
1993
+
1994
+ /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */
1995
+ const S_IFSOCK: number;
1996
+
1997
+ // File Mode Constants
1998
+
1999
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */
2000
+ const S_IRWXU: number;
2001
+
2002
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */
2003
+ const S_IRUSR: number;
2004
+
2005
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */
2006
+ const S_IWUSR: number;
2007
+
2008
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */
2009
+ const S_IXUSR: number;
2010
+
2011
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */
2012
+ const S_IRWXG: number;
2013
+
2014
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */
2015
+ const S_IRGRP: number;
2016
+
2017
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */
2018
+ const S_IWGRP: number;
2019
+
2020
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */
2021
+ const S_IXGRP: number;
2022
+
2023
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */
2024
+ const S_IRWXO: number;
2025
+
2026
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */
2027
+ const S_IROTH: number;
2028
+
2029
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */
2030
+ const S_IWOTH: number;
2031
+
2032
+ /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
2033
+ const S_IXOTH: number;
2034
+
2035
+ /**
2036
+ * When set, a memory file mapping is used to access the file. This flag
2037
+ * is available on Windows operating systems only. On other operating systems,
2038
+ * this flag is ignored.
2039
+ */
2040
+ const UV_FS_O_FILEMAP: number;
2041
+ }
2042
+
2043
+ /**
2044
+ * Asynchronously tests a user's permissions for the file specified by path.
2045
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2046
+ * URL support is _experimental_.
2047
+ */
2048
+ export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
2049
+
2050
+ /**
2051
+ * Asynchronously tests a user's permissions for the file specified by path.
2052
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2053
+ * URL support is _experimental_.
2054
+ */
2055
+ export function access(path: PathLike, callback: NoParamCallback): void;
2056
+
2057
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
2058
+ export namespace access {
2059
+ /**
2060
+ * Asynchronously tests a user's permissions for the file specified by path.
2061
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2062
+ * URL support is _experimental_.
2063
+ */
2064
+ function __promisify__(path: PathLike, mode?: number): Promise<void>;
2065
+ }
2066
+
2067
+ /**
2068
+ * Synchronously tests a user's permissions for the file specified by path.
2069
+ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2070
+ * URL support is _experimental_.
2071
+ */
2072
+ export function accessSync(path: PathLike, mode?: number): void;
2073
+
2074
+ /**
2075
+ * Returns a new `ReadStream` object.
2076
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2077
+ * URL support is _experimental_.
2078
+ */
2079
+ export function createReadStream(path: PathLike, options?: BufferEncoding | {
2080
+ flags?: string | undefined;
2081
+ encoding?: BufferEncoding | undefined;
2082
+ fd?: number | undefined;
2083
+ mode?: number | undefined;
2084
+ autoClose?: boolean | undefined;
2085
+ /**
2086
+ * @default false
2087
+ */
2088
+ emitClose?: boolean | undefined;
2089
+ start?: number | undefined;
2090
+ end?: number | undefined;
2091
+ highWaterMark?: number | undefined;
2092
+ }): ReadStream;
2093
+
2094
+ /**
2095
+ * Returns a new `WriteStream` object.
2096
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2097
+ * URL support is _experimental_.
2098
+ */
2099
+ export function createWriteStream(path: PathLike, options?: BufferEncoding | {
2100
+ flags?: string | undefined;
2101
+ encoding?: BufferEncoding | undefined;
2102
+ fd?: number | undefined;
2103
+ mode?: number | undefined;
2104
+ autoClose?: boolean | undefined;
2105
+ emitClose?: boolean | undefined;
2106
+ start?: number | undefined;
2107
+ highWaterMark?: number | undefined;
2108
+ }): WriteStream;
2109
+
2110
+ /**
2111
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
2112
+ * @param fd A file descriptor.
2113
+ */
2114
+ export function fdatasync(fd: number, callback: NoParamCallback): void;
2115
+
2116
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
2117
+ export namespace fdatasync {
2118
+ /**
2119
+ * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
2120
+ * @param fd A file descriptor.
2121
+ */
2122
+ function __promisify__(fd: number): Promise<void>;
2123
+ }
2124
+
2125
+ /**
2126
+ * Synchronous fdatasync(2) - synchronize a file's in-core state with storage device.
2127
+ * @param fd A file descriptor.
2128
+ */
2129
+ export function fdatasyncSync(fd: number): void;
2130
+
2131
+ /**
2132
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
2133
+ * No arguments other than a possible exception are given to the callback function.
2134
+ * Node.js makes no guarantees about the atomicity of the copy operation.
2135
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
2136
+ * to remove the destination.
2137
+ * @param src A path to the source file.
2138
+ * @param dest A path to the destination file.
2139
+ */
2140
+ export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
2141
+ /**
2142
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
2143
+ * No arguments other than a possible exception are given to the callback function.
2144
+ * Node.js makes no guarantees about the atomicity of the copy operation.
2145
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
2146
+ * to remove the destination.
2147
+ * @param src A path to the source file.
2148
+ * @param dest A path to the destination file.
2149
+ * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
2150
+ */
2151
+ export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void;
2152
+
2153
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
2154
+ export namespace copyFile {
2155
+ /**
2156
+ * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
2157
+ * No arguments other than a possible exception are given to the callback function.
2158
+ * Node.js makes no guarantees about the atomicity of the copy operation.
2159
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
2160
+ * to remove the destination.
2161
+ * @param src A path to the source file.
2162
+ * @param dest A path to the destination file.
2163
+ * @param flags An optional integer that specifies the behavior of the copy operation.
2164
+ * The only supported flag is fs.constants.COPYFILE_EXCL,
2165
+ * which causes the copy operation to fail if dest already exists.
2166
+ */
2167
+ function __promisify__(src: PathLike, dst: PathLike, flags?: number): Promise<void>;
2168
+ }
2169
+
2170
+ /**
2171
+ * Synchronously copies src to dest. By default, dest is overwritten if it already exists.
2172
+ * Node.js makes no guarantees about the atomicity of the copy operation.
2173
+ * If an error occurs after the destination file has been opened for writing, Node.js will attempt
2174
+ * to remove the destination.
2175
+ * @param src A path to the source file.
2176
+ * @param dest A path to the destination file.
2177
+ * @param flags An optional integer that specifies the behavior of the copy operation.
2178
+ * The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
2179
+ */
2180
+ export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
2181
+
2182
+ /**
2183
+ * Write an array of ArrayBufferViews to the file specified by fd using writev().
2184
+ * position is the offset from the beginning of the file where this data should be written.
2185
+ * It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream().
2186
+ * On Linux, positional writes don't work when the file is opened in append mode.
2187
+ * The kernel ignores the position argument and always appends the data to the end of the file.
2188
+ */
2189
+ export function writev(
2190
+ fd: number,
2191
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2192
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
2193
+ ): void;
2194
+ export function writev(
2195
+ fd: number,
2196
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2197
+ position: number,
2198
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
2199
+ ): void;
2200
+
2201
+ export interface WriteVResult {
2202
+ bytesWritten: number;
2203
+ buffers: NodeJS.ArrayBufferView[];
2204
+ }
2205
+
2206
+ export namespace writev {
2207
+ function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
2208
+ }
2209
+
2210
+ /**
2211
+ * See `writev`.
2212
+ */
2213
+ export function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
2214
+
2215
+ export function readv(
2216
+ fd: number,
2217
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2218
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2219
+ ): void;
2220
+ export function readv(
2221
+ fd: number,
2222
+ buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
2223
+ position: number,
2224
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
2225
+ ): void;
2226
+
2227
+ export interface ReadVResult {
2228
+ bytesRead: number;
2229
+ buffers: NodeJS.ArrayBufferView[];
2230
+ }
2231
+
2232
+ export namespace readv {
2233
+ function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
2234
+ }
2235
+
2236
+ /**
2237
+ * See `readv`.
2238
+ */
2239
+ export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
2240
+
2241
+ export interface OpenDirOptions {
2242
+ encoding?: BufferEncoding | undefined;
2243
+ /**
2244
+ * Number of directory entries that are buffered
2245
+ * internally when reading from the directory. Higher values lead to better
2246
+ * performance but higher memory usage.
2247
+ * @default 32
2248
+ */
2249
+ bufferSize?: number | undefined;
2250
+ }
2251
+
2252
+ export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
2253
+
2254
+ export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
2255
+ export function opendir(path: PathLike, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
2256
+
2257
+ export namespace opendir {
2258
+ function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
2259
+ }
2260
+
2261
+ export interface BigIntStats extends StatsBase<bigint> {
2262
+ }
2263
+
2264
+ export class BigIntStats {
2265
+ atimeNs: bigint;
2266
+ mtimeNs: bigint;
2267
+ ctimeNs: bigint;
2268
+ birthtimeNs: bigint;
2269
+ }
2270
+
2271
+ export interface BigIntOptions {
2272
+ bigint: true;
2273
+ }
2274
+
2275
+ export interface StatOptions {
2276
+ bigint?: boolean | undefined;
2277
+ }
2278
+ }
2279
+ declare module 'node:fs' {
2280
+ export * from 'fs';
2281
+ }