@nshiab/setup-data-project 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (541) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/esm/_dnt.shims.d.ts +6 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +61 -0
  6. package/esm/helpers/createFolderStructure.d.ts +2 -0
  7. package/esm/helpers/createFolderStructure.d.ts.map +1 -0
  8. package/esm/helpers/createFolderStructure.js +49 -0
  9. package/esm/helpers/ensureAgents.d.ts +2 -0
  10. package/esm/helpers/ensureAgents.d.ts.map +1 -0
  11. package/esm/helpers/ensureAgents.js +92 -0
  12. package/esm/helpers/ensureEnvFile.d.ts +2 -0
  13. package/esm/helpers/ensureEnvFile.d.ts.map +1 -0
  14. package/esm/helpers/ensureEnvFile.js +14 -0
  15. package/esm/helpers/ensureGitignore.d.ts +2 -0
  16. package/esm/helpers/ensureGitignore.d.ts.map +1 -0
  17. package/esm/helpers/ensureGitignore.js +29 -0
  18. package/esm/helpers/ensureReadme.d.ts +2 -0
  19. package/esm/helpers/ensureReadme.d.ts.map +1 -0
  20. package/esm/helpers/ensureReadme.js +37 -0
  21. package/esm/helpers/getInstalledPackages.d.ts +2 -0
  22. package/esm/helpers/getInstalledPackages.d.ts.map +1 -0
  23. package/esm/helpers/getInstalledPackages.js +29 -0
  24. package/esm/helpers/getProjectTasks.d.ts +5 -0
  25. package/esm/helpers/getProjectTasks.d.ts.map +1 -0
  26. package/esm/helpers/getProjectTasks.js +12 -0
  27. package/esm/helpers/getRuntime.d.ts +5 -0
  28. package/esm/helpers/getRuntime.d.ts.map +1 -0
  29. package/esm/helpers/getRuntime.js +17 -0
  30. package/esm/helpers/gitignoreEntries.d.ts +2 -0
  31. package/esm/helpers/gitignoreEntries.d.ts.map +1 -0
  32. package/esm/helpers/gitignoreEntries.js +9 -0
  33. package/esm/helpers/handleFileConflict.d.ts +5 -0
  34. package/esm/helpers/handleFileConflict.d.ts.map +1 -0
  35. package/esm/helpers/handleFileConflict.js +51 -0
  36. package/esm/helpers/installPackagesAndFetchDocs.d.ts +8 -0
  37. package/esm/helpers/installPackagesAndFetchDocs.d.ts.map +1 -0
  38. package/esm/helpers/installPackagesAndFetchDocs.js +61 -0
  39. package/esm/helpers/packageOptions.d.ts +5 -0
  40. package/esm/helpers/packageOptions.d.ts.map +1 -0
  41. package/esm/helpers/packageOptions.js +5 -0
  42. package/esm/helpers/packageRegistry.d.ts +7 -0
  43. package/esm/helpers/packageRegistry.d.ts.map +1 -0
  44. package/esm/helpers/packageRegistry.js +62 -0
  45. package/esm/helpers/updateProjectConfig.d.ts +2 -0
  46. package/esm/helpers/updateProjectConfig.d.ts.map +1 -0
  47. package/esm/helpers/updateProjectConfig.js +36 -0
  48. package/esm/main.d.ts +3 -0
  49. package/esm/main.d.ts.map +1 -0
  50. package/esm/main.js +93 -0
  51. package/esm/package.json +3 -0
  52. package/npm/LICENSE +21 -0
  53. package/npm/README.md +25 -0
  54. package/npm/esm/_dnt.shims.d.ts +8 -0
  55. package/npm/esm/_dnt.shims.d.ts.map +1 -0
  56. package/npm/esm/_dnt.shims.js +62 -0
  57. package/npm/esm/_dnt_2.shims.d.ts +6 -0
  58. package/npm/esm/_dnt_2.shims.d.ts.map +1 -0
  59. package/npm/esm/_dnt_2.shims.js +61 -0
  60. package/npm/esm/helpers/createFolderStructure.d.ts +2 -0
  61. package/npm/esm/helpers/createFolderStructure.d.ts.map +1 -0
  62. package/npm/esm/helpers/createFolderStructure.js +49 -0
  63. package/npm/esm/helpers/ensureAgents.d.ts +2 -0
  64. package/npm/esm/helpers/ensureAgents.d.ts.map +1 -0
  65. package/npm/esm/helpers/ensureAgents.js +92 -0
  66. package/npm/esm/helpers/ensureEnvFile.d.ts +2 -0
  67. package/npm/esm/helpers/ensureEnvFile.d.ts.map +1 -0
  68. package/npm/esm/helpers/ensureEnvFile.js +14 -0
  69. package/npm/esm/helpers/ensureGitignore.d.ts +2 -0
  70. package/npm/esm/helpers/ensureGitignore.d.ts.map +1 -0
  71. package/npm/esm/helpers/ensureGitignore.js +29 -0
  72. package/npm/esm/helpers/ensureReadme.d.ts +2 -0
  73. package/npm/esm/helpers/ensureReadme.d.ts.map +1 -0
  74. package/npm/esm/helpers/ensureReadme.js +37 -0
  75. package/npm/esm/helpers/getInstalledPackages.d.ts +2 -0
  76. package/npm/esm/helpers/getInstalledPackages.d.ts.map +1 -0
  77. package/npm/esm/helpers/getInstalledPackages.js +29 -0
  78. package/npm/esm/helpers/getProjectTasks.d.ts +5 -0
  79. package/npm/esm/helpers/getProjectTasks.d.ts.map +1 -0
  80. package/npm/esm/helpers/getProjectTasks.js +12 -0
  81. package/npm/esm/helpers/getRuntime.d.ts +5 -0
  82. package/npm/esm/helpers/getRuntime.d.ts.map +1 -0
  83. package/npm/esm/helpers/getRuntime.js +17 -0
  84. package/npm/esm/helpers/gitignoreEntries.d.ts +2 -0
  85. package/npm/esm/helpers/gitignoreEntries.d.ts.map +1 -0
  86. package/npm/esm/helpers/gitignoreEntries.js +9 -0
  87. package/npm/esm/helpers/handleFileConflict.d.ts +5 -0
  88. package/npm/esm/helpers/handleFileConflict.d.ts.map +1 -0
  89. package/npm/esm/helpers/handleFileConflict.js +51 -0
  90. package/npm/esm/helpers/installPackagesAndFetchDocs.d.ts +8 -0
  91. package/npm/esm/helpers/installPackagesAndFetchDocs.d.ts.map +1 -0
  92. package/npm/esm/helpers/installPackagesAndFetchDocs.js +61 -0
  93. package/npm/esm/helpers/packageOptions.d.ts +5 -0
  94. package/npm/esm/helpers/packageOptions.d.ts.map +1 -0
  95. package/npm/esm/helpers/packageOptions.js +5 -0
  96. package/npm/esm/helpers/packageRegistry.d.ts +7 -0
  97. package/npm/esm/helpers/packageRegistry.d.ts.map +1 -0
  98. package/npm/esm/helpers/packageRegistry.js +62 -0
  99. package/npm/esm/helpers/updateProjectConfig.d.ts +2 -0
  100. package/npm/esm/helpers/updateProjectConfig.d.ts.map +1 -0
  101. package/npm/esm/helpers/updateProjectConfig.js +36 -0
  102. package/npm/esm/main.d.ts +3 -0
  103. package/npm/esm/main.d.ts.map +1 -0
  104. package/npm/esm/main.js +93 -0
  105. package/npm/esm/package.json +3 -0
  106. package/npm/node_modules/.package-lock.json +123 -0
  107. package/npm/node_modules/@clack/core/CHANGELOG.md +348 -0
  108. package/npm/node_modules/@clack/core/LICENSE +9 -0
  109. package/npm/node_modules/@clack/core/README.md +22 -0
  110. package/npm/node_modules/@clack/core/dist/index.d.mts +363 -0
  111. package/npm/node_modules/@clack/core/dist/index.mjs +17 -0
  112. package/npm/node_modules/@clack/core/dist/index.mjs.map +1 -0
  113. package/npm/node_modules/@clack/core/package.json +63 -0
  114. package/npm/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  115. package/npm/node_modules/@clack/prompts/LICENSE +9 -0
  116. package/npm/node_modules/@clack/prompts/README.md +375 -0
  117. package/npm/node_modules/@clack/prompts/dist/index.d.mts +396 -0
  118. package/npm/node_modules/@clack/prompts/dist/index.mjs +144 -0
  119. package/npm/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  120. package/npm/node_modules/@clack/prompts/package.json +68 -0
  121. package/npm/node_modules/@deno/shim-deno/LICENSE +20 -0
  122. package/npm/node_modules/@deno/shim-deno/README.md +30 -0
  123. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/Conn.js +56 -0
  124. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/Listener.js +92 -0
  125. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/consts.js +4 -0
  126. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/errorMap.js +44 -0
  127. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/fs_flags.js +91 -0
  128. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/iterutil.js +37 -0
  129. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/random_id.js +8 -0
  130. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/streams.js +122 -0
  131. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/test.d.ts +1 -0
  132. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/test.js +5 -0
  133. package/npm/node_modules/@deno/shim-deno/dist/deno/internal/version.js +5 -0
  134. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/classes/FsFile.js +143 -0
  135. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/classes/PermissionStatus.js +19 -0
  136. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/classes/Permissions.js +26 -0
  137. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/classes.js +10 -0
  138. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/enums/SeekMode.js +9 -0
  139. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/enums.js +5 -0
  140. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/addSignalListener.js +18 -0
  141. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/chdir.js +22 -0
  142. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/chmod.js +29 -0
  143. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/chmodSync.js +29 -0
  144. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/chown.js +30 -0
  145. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/chownSync.js +30 -0
  146. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/close.js +29 -0
  147. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/connect.js +37 -0
  148. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/connectTls.js +31 -0
  149. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/consoleSize.js +17 -0
  150. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/copy.js +27 -0
  151. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/copyFile.js +45 -0
  152. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/copyFileSync.js +45 -0
  153. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/create.js +9 -0
  154. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/createSync.js +14 -0
  155. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/cwd.js +5 -0
  156. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/execPath.js +10 -0
  157. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/exit.js +8 -0
  158. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fdatasync.js +8 -0
  159. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fdatasyncSync.js +6 -0
  160. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fstat.js +44 -0
  161. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fstatSync.js +19 -0
  162. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fsync.js +10 -0
  163. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/fsyncSync.js +9 -0
  164. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/ftruncate.js +8 -0
  165. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/ftruncateSync.js +6 -0
  166. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/gid.js +10 -0
  167. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/hostname.js +32 -0
  168. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/inspect.js +30 -0
  169. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/kill.js +16 -0
  170. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/link.js +29 -0
  171. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/linkSync.js +29 -0
  172. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/listen.js +51 -0
  173. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/listenTls.js +49 -0
  174. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/loadavg.js +32 -0
  175. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/lstat.js +42 -0
  176. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/lstatSync.js +42 -0
  177. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/makeTempDir.js +11 -0
  178. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/makeTempDirSync.js +11 -0
  179. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/makeTempFile.js +14 -0
  180. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/makeTempFileSync.js +14 -0
  181. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/memoryUsage.js +5 -0
  182. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/mkdir.js +22 -0
  183. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/mkdirSync.js +45 -0
  184. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/open.js +33 -0
  185. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/openSync.js +31 -0
  186. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/osRelease.js +9 -0
  187. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/osUptime.js +9 -0
  188. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/read.js +19 -0
  189. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readDir.js +26 -0
  190. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readDirSync.js +26 -0
  191. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readFile.js +19 -0
  192. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readFileSync.js +19 -0
  193. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readLink.js +29 -0
  194. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readLinkSync.js +29 -0
  195. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readSync.js +34 -0
  196. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readTextFile.js +18 -0
  197. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/readTextFileSync.js +41 -0
  198. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/realPath.js +29 -0
  199. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/realPathSync.js +29 -0
  200. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/remove.js +22 -0
  201. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/removeSignalListener.js +12 -0
  202. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/removeSync.js +45 -0
  203. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/rename.js +9 -0
  204. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/renameSync.js +29 -0
  205. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/resolveDns.js +41 -0
  206. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/run.js +276 -0
  207. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/shutdown.js +9 -0
  208. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/stat.js +68 -0
  209. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/statSync.js +42 -0
  210. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/symlink.js +30 -0
  211. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/symlinkSync.js +30 -0
  212. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/test.js +5 -0
  213. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/truncate.js +45 -0
  214. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/truncateSync.js +45 -0
  215. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/uid.js +10 -0
  216. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/watchFs.js +27 -0
  217. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/write.js +35 -0
  218. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/writeFile.js +46 -0
  219. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/writeFileSync.js +45 -0
  220. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/writeSync.js +29 -0
  221. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/writeTextFile.js +52 -0
  222. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions/writeTextFileSync.js +44 -0
  223. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/functions.js +234 -0
  224. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/main.js +21 -0
  225. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/types.js +3 -0
  226. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/args.js +5 -0
  227. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/build.js +38 -0
  228. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/customInspect.js +4 -0
  229. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/env.js +47 -0
  230. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/errors.js +63 -0
  231. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/mainModule.js +8 -0
  232. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/metrics.js +21 -0
  233. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/noColor.js +5 -0
  234. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/permissions.js +6 -0
  235. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/pid.js +5 -0
  236. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/ppid.js +5 -0
  237. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/resources.js +12 -0
  238. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/std.js +132 -0
  239. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables/version.js +10 -0
  240. package/npm/node_modules/@deno/shim-deno/dist/deno/stable/variables.js +53 -0
  241. package/npm/node_modules/@deno/shim-deno/dist/deno/unstable/main.js +62 -0
  242. package/npm/node_modules/@deno/shim-deno/dist/deno.js +17 -0
  243. package/npm/node_modules/@deno/shim-deno/dist/index.d.ts +4762 -0
  244. package/npm/node_modules/@deno/shim-deno/dist/index.js +27 -0
  245. package/npm/node_modules/@deno/shim-deno/package.json +50 -0
  246. package/npm/node_modules/@deno/shim-deno-test/LICENSE +20 -0
  247. package/npm/node_modules/@deno/shim-deno-test/README.md +28 -0
  248. package/npm/node_modules/@deno/shim-deno-test/dist/definitions.d.ts +3 -0
  249. package/npm/node_modules/@deno/shim-deno-test/dist/definitions.js +5 -0
  250. package/npm/node_modules/@deno/shim-deno-test/dist/deno.types.gen.d.ts +626 -0
  251. package/npm/node_modules/@deno/shim-deno-test/dist/deno.types.gen.js +2 -0
  252. package/npm/node_modules/@deno/shim-deno-test/dist/index.d.ts +3 -0
  253. package/npm/node_modules/@deno/shim-deno-test/dist/index.js +21 -0
  254. package/npm/node_modules/@deno/shim-deno-test/dist/test.d.ts +3 -0
  255. package/npm/node_modules/@deno/shim-deno-test/dist/test.js +87 -0
  256. package/npm/node_modules/@deno/shim-deno-test/package.json +34 -0
  257. package/npm/node_modules/@types/node/LICENSE +21 -0
  258. package/npm/node_modules/@types/node/README.md +15 -0
  259. package/npm/node_modules/@types/node/assert/strict.d.ts +8 -0
  260. package/npm/node_modules/@types/node/assert.d.ts +1062 -0
  261. package/npm/node_modules/@types/node/async_hooks.d.ts +605 -0
  262. package/npm/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  263. package/npm/node_modules/@types/node/buffer.d.ts +1936 -0
  264. package/npm/node_modules/@types/node/child_process.d.ts +1475 -0
  265. package/npm/node_modules/@types/node/cluster.d.ts +577 -0
  266. package/npm/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  267. package/npm/node_modules/@types/node/compatibility/index.d.ts +9 -0
  268. package/npm/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  269. package/npm/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  270. package/npm/node_modules/@types/node/console.d.ts +452 -0
  271. package/npm/node_modules/@types/node/constants.d.ts +21 -0
  272. package/npm/node_modules/@types/node/crypto.d.ts +4590 -0
  273. package/npm/node_modules/@types/node/dgram.d.ts +597 -0
  274. package/npm/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  275. package/npm/node_modules/@types/node/dns/promises.d.ts +479 -0
  276. package/npm/node_modules/@types/node/dns.d.ts +871 -0
  277. package/npm/node_modules/@types/node/domain.d.ts +170 -0
  278. package/npm/node_modules/@types/node/events.d.ts +977 -0
  279. package/npm/node_modules/@types/node/fs/promises.d.ts +1270 -0
  280. package/npm/node_modules/@types/node/fs.d.ts +4375 -0
  281. package/npm/node_modules/@types/node/globals.d.ts +172 -0
  282. package/npm/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  283. package/npm/node_modules/@types/node/http.d.ts +2049 -0
  284. package/npm/node_modules/@types/node/http2.d.ts +2631 -0
  285. package/npm/node_modules/@types/node/https.d.ts +578 -0
  286. package/npm/node_modules/@types/node/index.d.ts +93 -0
  287. package/npm/node_modules/@types/node/inspector.generated.d.ts +3966 -0
  288. package/npm/node_modules/@types/node/module.d.ts +539 -0
  289. package/npm/node_modules/@types/node/net.d.ts +1031 -0
  290. package/npm/node_modules/@types/node/os.d.ts +506 -0
  291. package/npm/node_modules/@types/node/package.json +140 -0
  292. package/npm/node_modules/@types/node/path.d.ts +200 -0
  293. package/npm/node_modules/@types/node/perf_hooks.d.ts +961 -0
  294. package/npm/node_modules/@types/node/process.d.ts +1961 -0
  295. package/npm/node_modules/@types/node/punycode.d.ts +117 -0
  296. package/npm/node_modules/@types/node/querystring.d.ts +152 -0
  297. package/npm/node_modules/@types/node/readline/promises.d.ts +162 -0
  298. package/npm/node_modules/@types/node/readline.d.ts +589 -0
  299. package/npm/node_modules/@types/node/repl.d.ts +430 -0
  300. package/npm/node_modules/@types/node/sea.d.ts +153 -0
  301. package/npm/node_modules/@types/node/stream/consumers.d.ts +38 -0
  302. package/npm/node_modules/@types/node/stream/promises.d.ts +90 -0
  303. package/npm/node_modules/@types/node/stream/web.d.ts +533 -0
  304. package/npm/node_modules/@types/node/stream.d.ts +1698 -0
  305. package/npm/node_modules/@types/node/string_decoder.d.ts +67 -0
  306. package/npm/node_modules/@types/node/test.d.ts +1787 -0
  307. package/npm/node_modules/@types/node/timers/promises.d.ts +108 -0
  308. package/npm/node_modules/@types/node/timers.d.ts +286 -0
  309. package/npm/node_modules/@types/node/tls.d.ts +1259 -0
  310. package/npm/node_modules/@types/node/trace_events.d.ts +197 -0
  311. package/npm/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  312. package/npm/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  313. package/npm/node_modules/@types/node/ts5.6/index.d.ts +93 -0
  314. package/npm/node_modules/@types/node/tty.d.ts +208 -0
  315. package/npm/node_modules/@types/node/url.d.ts +964 -0
  316. package/npm/node_modules/@types/node/util.d.ts +2331 -0
  317. package/npm/node_modules/@types/node/v8.d.ts +809 -0
  318. package/npm/node_modules/@types/node/vm.d.ts +1001 -0
  319. package/npm/node_modules/@types/node/wasi.d.ts +181 -0
  320. package/npm/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  321. package/npm/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  322. package/npm/node_modules/@types/node/web-globals/events.d.ts +97 -0
  323. package/npm/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  324. package/npm/node_modules/@types/node/worker_threads.d.ts +715 -0
  325. package/npm/node_modules/@types/node/zlib.d.ts +598 -0
  326. package/npm/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  327. package/npm/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  328. package/npm/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  329. package/npm/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  330. package/npm/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  331. package/npm/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  332. package/npm/node_modules/fast-string-truncated-width/license +21 -0
  333. package/npm/node_modules/fast-string-truncated-width/package.json +35 -0
  334. package/npm/node_modules/fast-string-truncated-width/readme.md +59 -0
  335. package/npm/node_modules/fast-string-width/dist/index.d.ts +4 -0
  336. package/npm/node_modules/fast-string-width/dist/index.js +14 -0
  337. package/npm/node_modules/fast-string-width/license +21 -0
  338. package/npm/node_modules/fast-string-width/package.json +34 -0
  339. package/npm/node_modules/fast-string-width/readme.md +42 -0
  340. package/npm/node_modules/fast-wrap-ansi/LICENSE +23 -0
  341. package/npm/node_modules/fast-wrap-ansi/README.md +26 -0
  342. package/npm/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  343. package/npm/node_modules/fast-wrap-ansi/lib/main.js +219 -0
  344. package/npm/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
  345. package/npm/node_modules/fast-wrap-ansi/package.json +51 -0
  346. package/npm/node_modules/isexe/LICENSE.md +55 -0
  347. package/npm/node_modules/isexe/README.md +80 -0
  348. package/npm/node_modules/isexe/dist/commonjs/index.d.ts +14 -0
  349. package/npm/node_modules/isexe/dist/commonjs/index.d.ts.map +1 -0
  350. package/npm/node_modules/isexe/dist/commonjs/index.js +56 -0
  351. package/npm/node_modules/isexe/dist/commonjs/index.js.map +1 -0
  352. package/npm/node_modules/isexe/dist/commonjs/index.min.js +2 -0
  353. package/npm/node_modules/isexe/dist/commonjs/index.min.js.map +7 -0
  354. package/npm/node_modules/isexe/dist/commonjs/options.d.ts +32 -0
  355. package/npm/node_modules/isexe/dist/commonjs/options.d.ts.map +1 -0
  356. package/npm/node_modules/isexe/dist/commonjs/options.js +3 -0
  357. package/npm/node_modules/isexe/dist/commonjs/options.js.map +1 -0
  358. package/npm/node_modules/isexe/dist/commonjs/package.json +3 -0
  359. package/npm/node_modules/isexe/dist/commonjs/posix.d.ts +18 -0
  360. package/npm/node_modules/isexe/dist/commonjs/posix.d.ts.map +1 -0
  361. package/npm/node_modules/isexe/dist/commonjs/posix.js +67 -0
  362. package/npm/node_modules/isexe/dist/commonjs/posix.js.map +1 -0
  363. package/npm/node_modules/isexe/dist/commonjs/win32.d.ts +18 -0
  364. package/npm/node_modules/isexe/dist/commonjs/win32.d.ts.map +1 -0
  365. package/npm/node_modules/isexe/dist/commonjs/win32.js +63 -0
  366. package/npm/node_modules/isexe/dist/commonjs/win32.js.map +1 -0
  367. package/npm/node_modules/isexe/dist/esm/index.d.ts +14 -0
  368. package/npm/node_modules/isexe/dist/esm/index.d.ts.map +1 -0
  369. package/npm/node_modules/isexe/dist/esm/index.js +16 -0
  370. package/npm/node_modules/isexe/dist/esm/index.js.map +1 -0
  371. package/npm/node_modules/isexe/dist/esm/index.min.js +2 -0
  372. package/npm/node_modules/isexe/dist/esm/index.min.js.map +7 -0
  373. package/npm/node_modules/isexe/dist/esm/options.d.ts +32 -0
  374. package/npm/node_modules/isexe/dist/esm/options.d.ts.map +1 -0
  375. package/npm/node_modules/isexe/dist/esm/options.js +2 -0
  376. package/npm/node_modules/isexe/dist/esm/options.js.map +1 -0
  377. package/npm/node_modules/isexe/dist/esm/package.json +3 -0
  378. package/npm/node_modules/isexe/dist/esm/posix.d.ts +18 -0
  379. package/npm/node_modules/isexe/dist/esm/posix.d.ts.map +1 -0
  380. package/npm/node_modules/isexe/dist/esm/posix.js +62 -0
  381. package/npm/node_modules/isexe/dist/esm/posix.js.map +1 -0
  382. package/npm/node_modules/isexe/dist/esm/win32.d.ts +18 -0
  383. package/npm/node_modules/isexe/dist/esm/win32.d.ts.map +1 -0
  384. package/npm/node_modules/isexe/dist/esm/win32.js +58 -0
  385. package/npm/node_modules/isexe/dist/esm/win32.js.map +1 -0
  386. package/npm/node_modules/isexe/package.json +78 -0
  387. package/npm/node_modules/sisteransi/license +21 -0
  388. package/npm/node_modules/sisteransi/package.json +34 -0
  389. package/npm/node_modules/sisteransi/readme.md +113 -0
  390. package/npm/node_modules/sisteransi/src/index.js +58 -0
  391. package/npm/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  392. package/npm/node_modules/undici-types/LICENSE +21 -0
  393. package/npm/node_modules/undici-types/README.md +6 -0
  394. package/npm/node_modules/undici-types/agent.d.ts +31 -0
  395. package/npm/node_modules/undici-types/api.d.ts +43 -0
  396. package/npm/node_modules/undici-types/balanced-pool.d.ts +29 -0
  397. package/npm/node_modules/undici-types/cache.d.ts +36 -0
  398. package/npm/node_modules/undici-types/client.d.ts +108 -0
  399. package/npm/node_modules/undici-types/connector.d.ts +34 -0
  400. package/npm/node_modules/undici-types/content-type.d.ts +21 -0
  401. package/npm/node_modules/undici-types/cookies.d.ts +28 -0
  402. package/npm/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  403. package/npm/node_modules/undici-types/dispatcher.d.ts +256 -0
  404. package/npm/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  405. package/npm/node_modules/undici-types/errors.d.ts +149 -0
  406. package/npm/node_modules/undici-types/eventsource.d.ts +61 -0
  407. package/npm/node_modules/undici-types/fetch.d.ts +209 -0
  408. package/npm/node_modules/undici-types/file.d.ts +39 -0
  409. package/npm/node_modules/undici-types/filereader.d.ts +54 -0
  410. package/npm/node_modules/undici-types/formdata.d.ts +108 -0
  411. package/npm/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  412. package/npm/node_modules/undici-types/global-origin.d.ts +7 -0
  413. package/npm/node_modules/undici-types/handlers.d.ts +15 -0
  414. package/npm/node_modules/undici-types/header.d.ts +4 -0
  415. package/npm/node_modules/undici-types/index.d.ts +71 -0
  416. package/npm/node_modules/undici-types/interceptors.d.ts +17 -0
  417. package/npm/node_modules/undici-types/mock-agent.d.ts +50 -0
  418. package/npm/node_modules/undici-types/mock-client.d.ts +25 -0
  419. package/npm/node_modules/undici-types/mock-errors.d.ts +12 -0
  420. package/npm/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  421. package/npm/node_modules/undici-types/mock-pool.d.ts +25 -0
  422. package/npm/node_modules/undici-types/package.json +55 -0
  423. package/npm/node_modules/undici-types/patch.d.ts +33 -0
  424. package/npm/node_modules/undici-types/pool-stats.d.ts +19 -0
  425. package/npm/node_modules/undici-types/pool.d.ts +39 -0
  426. package/npm/node_modules/undici-types/proxy-agent.d.ts +28 -0
  427. package/npm/node_modules/undici-types/readable.d.ts +65 -0
  428. package/npm/node_modules/undici-types/retry-agent.d.ts +8 -0
  429. package/npm/node_modules/undici-types/retry-handler.d.ts +116 -0
  430. package/npm/node_modules/undici-types/util.d.ts +18 -0
  431. package/npm/node_modules/undici-types/webidl.d.ts +228 -0
  432. package/npm/node_modules/undici-types/websocket.d.ts +150 -0
  433. package/npm/node_modules/which/LICENSE +15 -0
  434. package/npm/node_modules/which/README.md +51 -0
  435. package/npm/node_modules/which/bin/which.js +52 -0
  436. package/npm/node_modules/which/lib/index.js +111 -0
  437. package/npm/node_modules/which/package.json +57 -0
  438. package/npm/package-lock.json +135 -0
  439. package/npm/package.json +30 -0
  440. package/npm/script/_dnt.shims.d.ts +8 -0
  441. package/npm/script/_dnt.shims.d.ts.map +1 -0
  442. package/npm/script/_dnt.shims.js +99 -0
  443. package/npm/script/_dnt_2.shims.d.ts +6 -0
  444. package/npm/script/_dnt_2.shims.d.ts.map +1 -0
  445. package/npm/script/_dnt_2.shims.js +65 -0
  446. package/npm/script/helpers/createFolderStructure.d.ts +2 -0
  447. package/npm/script/helpers/createFolderStructure.d.ts.map +1 -0
  448. package/npm/script/helpers/createFolderStructure.js +52 -0
  449. package/npm/script/helpers/ensureAgents.d.ts +2 -0
  450. package/npm/script/helpers/ensureAgents.d.ts.map +1 -0
  451. package/npm/script/helpers/ensureAgents.js +95 -0
  452. package/npm/script/helpers/ensureEnvFile.d.ts +2 -0
  453. package/npm/script/helpers/ensureEnvFile.d.ts.map +1 -0
  454. package/npm/script/helpers/ensureEnvFile.js +17 -0
  455. package/npm/script/helpers/ensureGitignore.d.ts +2 -0
  456. package/npm/script/helpers/ensureGitignore.d.ts.map +1 -0
  457. package/npm/script/helpers/ensureGitignore.js +32 -0
  458. package/npm/script/helpers/ensureReadme.d.ts +2 -0
  459. package/npm/script/helpers/ensureReadme.d.ts.map +1 -0
  460. package/npm/script/helpers/ensureReadme.js +40 -0
  461. package/npm/script/helpers/getInstalledPackages.d.ts +2 -0
  462. package/npm/script/helpers/getInstalledPackages.d.ts.map +1 -0
  463. package/npm/script/helpers/getInstalledPackages.js +32 -0
  464. package/npm/script/helpers/getProjectTasks.d.ts +5 -0
  465. package/npm/script/helpers/getProjectTasks.d.ts.map +1 -0
  466. package/npm/script/helpers/getProjectTasks.js +15 -0
  467. package/npm/script/helpers/getRuntime.d.ts +5 -0
  468. package/npm/script/helpers/getRuntime.d.ts.map +1 -0
  469. package/npm/script/helpers/getRuntime.js +57 -0
  470. package/npm/script/helpers/gitignoreEntries.d.ts +2 -0
  471. package/npm/script/helpers/gitignoreEntries.d.ts.map +1 -0
  472. package/npm/script/helpers/gitignoreEntries.js +12 -0
  473. package/npm/script/helpers/handleFileConflict.d.ts +5 -0
  474. package/npm/script/helpers/handleFileConflict.d.ts.map +1 -0
  475. package/npm/script/helpers/handleFileConflict.js +91 -0
  476. package/npm/script/helpers/installPackagesAndFetchDocs.d.ts +8 -0
  477. package/npm/script/helpers/installPackagesAndFetchDocs.d.ts.map +1 -0
  478. package/npm/script/helpers/installPackagesAndFetchDocs.js +98 -0
  479. package/npm/script/helpers/packageOptions.d.ts +5 -0
  480. package/npm/script/helpers/packageOptions.d.ts.map +1 -0
  481. package/npm/script/helpers/packageOptions.js +8 -0
  482. package/npm/script/helpers/packageRegistry.d.ts +7 -0
  483. package/npm/script/helpers/packageRegistry.d.ts.map +1 -0
  484. package/npm/script/helpers/packageRegistry.js +65 -0
  485. package/npm/script/helpers/updateProjectConfig.d.ts +2 -0
  486. package/npm/script/helpers/updateProjectConfig.d.ts.map +1 -0
  487. package/npm/script/helpers/updateProjectConfig.js +39 -0
  488. package/npm/script/main.d.ts +3 -0
  489. package/npm/script/main.d.ts.map +1 -0
  490. package/npm/script/main.js +98 -0
  491. package/npm/script/package.json +3 -0
  492. package/package.json +27 -0
  493. package/script/_dnt.shims.d.ts +6 -0
  494. package/script/_dnt.shims.d.ts.map +1 -0
  495. package/script/_dnt.shims.js +65 -0
  496. package/script/helpers/createFolderStructure.d.ts +2 -0
  497. package/script/helpers/createFolderStructure.d.ts.map +1 -0
  498. package/script/helpers/createFolderStructure.js +52 -0
  499. package/script/helpers/ensureAgents.d.ts +2 -0
  500. package/script/helpers/ensureAgents.d.ts.map +1 -0
  501. package/script/helpers/ensureAgents.js +95 -0
  502. package/script/helpers/ensureEnvFile.d.ts +2 -0
  503. package/script/helpers/ensureEnvFile.d.ts.map +1 -0
  504. package/script/helpers/ensureEnvFile.js +17 -0
  505. package/script/helpers/ensureGitignore.d.ts +2 -0
  506. package/script/helpers/ensureGitignore.d.ts.map +1 -0
  507. package/script/helpers/ensureGitignore.js +32 -0
  508. package/script/helpers/ensureReadme.d.ts +2 -0
  509. package/script/helpers/ensureReadme.d.ts.map +1 -0
  510. package/script/helpers/ensureReadme.js +40 -0
  511. package/script/helpers/getInstalledPackages.d.ts +2 -0
  512. package/script/helpers/getInstalledPackages.d.ts.map +1 -0
  513. package/script/helpers/getInstalledPackages.js +32 -0
  514. package/script/helpers/getProjectTasks.d.ts +5 -0
  515. package/script/helpers/getProjectTasks.d.ts.map +1 -0
  516. package/script/helpers/getProjectTasks.js +15 -0
  517. package/script/helpers/getRuntime.d.ts +5 -0
  518. package/script/helpers/getRuntime.d.ts.map +1 -0
  519. package/script/helpers/getRuntime.js +57 -0
  520. package/script/helpers/gitignoreEntries.d.ts +2 -0
  521. package/script/helpers/gitignoreEntries.d.ts.map +1 -0
  522. package/script/helpers/gitignoreEntries.js +12 -0
  523. package/script/helpers/handleFileConflict.d.ts +5 -0
  524. package/script/helpers/handleFileConflict.d.ts.map +1 -0
  525. package/script/helpers/handleFileConflict.js +91 -0
  526. package/script/helpers/installPackagesAndFetchDocs.d.ts +8 -0
  527. package/script/helpers/installPackagesAndFetchDocs.d.ts.map +1 -0
  528. package/script/helpers/installPackagesAndFetchDocs.js +98 -0
  529. package/script/helpers/packageOptions.d.ts +5 -0
  530. package/script/helpers/packageOptions.d.ts.map +1 -0
  531. package/script/helpers/packageOptions.js +8 -0
  532. package/script/helpers/packageRegistry.d.ts +7 -0
  533. package/script/helpers/packageRegistry.d.ts.map +1 -0
  534. package/script/helpers/packageRegistry.js +65 -0
  535. package/script/helpers/updateProjectConfig.d.ts +2 -0
  536. package/script/helpers/updateProjectConfig.d.ts.map +1 -0
  537. package/script/helpers/updateProjectConfig.js +39 -0
  538. package/script/main.d.ts +3 -0
  539. package/script/main.d.ts.map +1 -0
  540. package/script/main.js +98 -0
  541. package/script/package.json +3 -0
@@ -0,0 +1,4762 @@
1
+ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
2
+
3
+ /// <reference types="node" />
4
+
5
+ import { URL } from "url";
6
+ import { ReadableStream, WritableStream } from "node:stream/web";
7
+
8
+ /** @category DOM Events */
9
+ declare interface EventListenerOptions {
10
+ capture?: boolean;
11
+ }
12
+
13
+ /** @category DOM Events */
14
+ declare interface AddEventListenerOptions extends EventListenerOptions {
15
+ once?: boolean;
16
+ passive?: boolean;
17
+ signal?: AbortSignal;
18
+ }
19
+
20
+ /** @category DOM Events */
21
+ declare interface EventListener {
22
+ (evt: Event): void | Promise<void>;
23
+ }
24
+
25
+ /** @category DOM Events */
26
+ declare interface EventListenerObject {
27
+ handleEvent(evt: Event): void | Promise<void>;
28
+ }
29
+
30
+ /** @category DOM Events */
31
+ declare type EventListenerOrEventListenerObject = | EventListener
32
+ | EventListenerObject;
33
+
34
+ interface Disposable {
35
+ [Symbol.dispose](): void;
36
+ }
37
+
38
+ interface AsyncDisposable {
39
+ [Symbol.asyncDispose](): PromiseLike<void>;
40
+ }
41
+
42
+ export declare namespace Deno {
43
+ export const File: typeof FsFile;
44
+
45
+ export class FsFile implements Deno.FsFile {
46
+ #private;
47
+ readonly rid: number;
48
+ constructor(rid: number);
49
+ get readable(): ReadableStream<Uint8Array>;
50
+ get writable(): WritableStream<Uint8Array>;
51
+ [Symbol.dispose](): void;
52
+ write(p: Uint8Array): Promise<number>;
53
+ writeSync(p: Uint8Array): number;
54
+ truncate(len?: number): Promise<void>;
55
+ truncateSync(len?: number): void;
56
+ read(p: Uint8Array): Promise<number | null>;
57
+ readSync(p: Uint8Array): number | null;
58
+ seek(_offset: number, _whence: Deno.SeekMode): Promise<number>;
59
+ seekSync(_offset: number, _whence: Deno.SeekMode): number;
60
+ stat(): Promise<Deno.FileInfo>;
61
+ statSync(): Deno.FileInfo;
62
+ sync(): Promise<void>;
63
+ syncSync(): void;
64
+ syncData(): Promise<void>;
65
+ syncDataSync(): void;
66
+ utime(_atime: number | Date, _mtime: number | Date): Promise<void>;
67
+ utimeSync(_atime: number | Date, _mtime: number | Date): void;
68
+ close(): void;
69
+ }
70
+
71
+ export class Permissions implements Deno.Permissions {
72
+ query(desc: Deno.PermissionDescriptor): Promise<PermissionStatus>;
73
+ querySync(_desc: Deno.PermissionDescriptor): PermissionStatus;
74
+ revoke(desc: Deno.PermissionDescriptor): Promise<PermissionStatus>;
75
+ revokeSync(_desc: Deno.PermissionDescriptor): PermissionStatus;
76
+ request(desc: Deno.PermissionDescriptor): Promise<PermissionStatus>;
77
+ requestSync(desc: Deno.PermissionDescriptor): PermissionStatus;
78
+ }
79
+
80
+ export class PermissionStatus extends EventTarget implements Deno.PermissionStatus {
81
+ readonly state: Deno.PermissionState;
82
+ onchange: ((this: PermissionStatus, ev: Event) => any) | null;
83
+ readonly partial: boolean;
84
+ }
85
+
86
+ export enum SeekMode {
87
+ Start = 0,
88
+ Current = 1,
89
+ End = 2
90
+ }
91
+
92
+ /**
93
+ * The `tty.isatty()` method returns `true` if the given `fd` is associated with
94
+ * a TTY and `false` if it is not, including whenever `fd` is not a non-negative
95
+ * integer.
96
+ * @since v0.5.8
97
+ * @param fd A numeric file descriptor
98
+ */
99
+ export function isatty(fd: number): boolean;
100
+ /**
101
+ * Registers the given function as a listener of the given signal event.
102
+ *
103
+ * ```ts
104
+ * Deno.addSignalListener(
105
+ * "SIGTERM",
106
+ * () => {
107
+ * console.log("SIGTERM!")
108
+ * }
109
+ * );
110
+ * ```
111
+ *
112
+ * _Note_: On Windows only `"SIGINT"` (CTRL+C) and `"SIGBREAK"` (CTRL+Break)
113
+ * are supported.
114
+ *
115
+ * @category Runtime Environment
116
+ */
117
+ export function addSignalListener(signal: Signal, handler: () => void): void;
118
+ /**
119
+ * Change the current working directory to the specified path.
120
+ *
121
+ * ```ts
122
+ * Deno.chdir("/home/userA");
123
+ * Deno.chdir("../userB");
124
+ * Deno.chdir("C:\\Program Files (x86)\\Java");
125
+ * ```
126
+ *
127
+ * Throws {@linkcode Deno.errors.NotFound} if directory not found.
128
+ *
129
+ * Throws {@linkcode Deno.errors.PermissionDenied} if the user does not have
130
+ * operating system file access rights.
131
+ *
132
+ * Requires `allow-read` permission.
133
+ *
134
+ * @tags allow-read
135
+ * @category Runtime Environment
136
+ */
137
+ export function chdir(directory: string | URL): void;
138
+ /**
139
+ * Changes the permission of a specific file/directory of specified path.
140
+ * Ignores the process's umask.
141
+ *
142
+ * ```ts
143
+ * await Deno.chmod("/path/to/file", 0o666);
144
+ * ```
145
+ *
146
+ * The mode is a sequence of 3 octal numbers. The first/left-most number
147
+ * specifies the permissions for the owner. The second number specifies the
148
+ * permissions for the group. The last/right-most number specifies the
149
+ * permissions for others. For example, with a mode of 0o764, the owner (7)
150
+ * can read/write/execute, the group (6) can read/write and everyone else (4)
151
+ * can read only.
152
+ *
153
+ * | Number | Description |
154
+ * | ------ | ----------- |
155
+ * | 7 | read, write, and execute |
156
+ * | 6 | read and write |
157
+ * | 5 | read and execute |
158
+ * | 4 | read only |
159
+ * | 3 | write and execute |
160
+ * | 2 | write only |
161
+ * | 1 | execute only |
162
+ * | 0 | no permission |
163
+ *
164
+ * NOTE: This API currently throws on Windows
165
+ *
166
+ * Requires `allow-write` permission.
167
+ *
168
+ * @tags allow-write
169
+ * @category File System
170
+ */
171
+ export function chmod(path: string | URL, mode: number): Promise<void>;
172
+ /**
173
+ * Synchronously changes the permission of a specific file/directory of
174
+ * specified path. Ignores the process's umask.
175
+ *
176
+ * ```ts
177
+ * Deno.chmodSync("/path/to/file", 0o666);
178
+ * ```
179
+ *
180
+ * For a full description, see {@linkcode Deno.chmod}.
181
+ *
182
+ * NOTE: This API currently throws on Windows
183
+ *
184
+ * Requires `allow-write` permission.
185
+ *
186
+ * @tags allow-write
187
+ * @category File System
188
+ */
189
+ export function chmodSync(path: string | URL, mode: number): void;
190
+ /**
191
+ * Change owner of a regular file or directory.
192
+ *
193
+ * This functionality is not available on Windows.
194
+ *
195
+ * ```ts
196
+ * await Deno.chown("myFile.txt", 1000, 1002);
197
+ * ```
198
+ *
199
+ * Requires `allow-write` permission.
200
+ *
201
+ * Throws Error (not implemented) if executed on Windows.
202
+ *
203
+ * @tags allow-write
204
+ * @category File System
205
+ * @param path path to the file
206
+ * @param uid user id (UID) of the new owner, or `null` for no change
207
+ * @param gid group id (GID) of the new owner, or `null` for no change
208
+ */
209
+ export function chown(path: string | URL, uid: number | null, gid: number | null): Promise<void>;
210
+ /**
211
+ * Synchronously change owner of a regular file or directory.
212
+ *
213
+ * This functionality is not available on Windows.
214
+ *
215
+ * ```ts
216
+ * Deno.chownSync("myFile.txt", 1000, 1002);
217
+ * ```
218
+ *
219
+ * Requires `allow-write` permission.
220
+ *
221
+ * Throws Error (not implemented) if executed on Windows.
222
+ *
223
+ * @tags allow-write
224
+ * @category File System
225
+ * @param path path to the file
226
+ * @param uid user id (UID) of the new owner, or `null` for no change
227
+ * @param gid group id (GID) of the new owner, or `null` for no change
228
+ */
229
+ export function chownSync(path: string | URL, uid: number | null, gid: number | null): void;
230
+ /**
231
+ * Close the given resource ID (`rid`) which has been previously opened, such
232
+ * as via opening or creating a file. Closing a file when you are finished
233
+ * with it is important to avoid leaking resources.
234
+ *
235
+ * ```ts
236
+ * const file = await Deno.open("my_file.txt");
237
+ * // do work with "file" object
238
+ * Deno.close(file.rid);
239
+ * ```
240
+ *
241
+ * It is recommended to define the variable with the `using` keyword so the
242
+ * runtime will automatically close the resource when it goes out of scope.
243
+ * Doing so negates the need to manually close the resource.
244
+ *
245
+ * ```ts
246
+ * using file = await Deno.open("my_file.txt");
247
+ * // do work with "file" object
248
+ * ```
249
+ *
250
+ * @deprecated Use `.close()` method on the resource instead.
251
+ * {@linkcode Deno.close} will be removed in Deno 2.0.
252
+ * @category I/O
253
+ */
254
+ export function close(rid: number): void;
255
+ /**
256
+ * Connects to the hostname (default is "127.0.0.1") and port on the named
257
+ * transport (default is "tcp"), and resolves to the connection (`Conn`).
258
+ *
259
+ * ```ts
260
+ * const conn1 = await Deno.connect({ port: 80 });
261
+ * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
262
+ * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
263
+ * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
264
+ * ```
265
+ *
266
+ * Requires `allow-net` permission for "tcp".
267
+ *
268
+ * @tags allow-net
269
+ * @category Network
270
+ */
271
+ export function connect(options: ConnectOptions): Promise<TcpConn>;
272
+ /**
273
+ * Connects to the hostname (default is "127.0.0.1") and port on the named
274
+ * transport (default is "tcp"), and resolves to the connection (`Conn`).
275
+ *
276
+ * ```ts
277
+ * const conn1 = await Deno.connect({ port: 80 });
278
+ * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
279
+ * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
280
+ * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
281
+ * const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
282
+ * ```
283
+ *
284
+ * Requires `allow-net` permission for "tcp" and `allow-read` for "unix".
285
+ *
286
+ * @tags allow-net, allow-read
287
+ * @category Network
288
+ */
289
+ export function connect(options: UnixConnectOptions): Promise<UnixConn>;
290
+ /**
291
+ * Establishes a secure connection over TLS (transport layer security) using
292
+ * an optional cert file, hostname (default is "127.0.0.1") and port. The
293
+ * cert file is optional and if not included Mozilla's root certificates will
294
+ * be used (see also https://github.com/ctz/webpki-roots for specifics)
295
+ *
296
+ * ```ts
297
+ * const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
298
+ * const conn1 = await Deno.connectTls({ port: 80 });
299
+ * const conn2 = await Deno.connectTls({ caCerts: [caCert], hostname: "192.0.2.1", port: 80 });
300
+ * const conn3 = await Deno.connectTls({ hostname: "[2001:db8::1]", port: 80 });
301
+ * const conn4 = await Deno.connectTls({ caCerts: [caCert], hostname: "golang.org", port: 80});
302
+ * ```
303
+ *
304
+ * Requires `allow-net` permission.
305
+ *
306
+ * @tags allow-net
307
+ * @category Network
308
+ */
309
+ export function connectTls(options: ConnectTlsOptions): Promise<TlsConn>;
310
+ /**
311
+ * Gets the size of the console as columns/rows.
312
+ *
313
+ * ```ts
314
+ * const { columns, rows } = Deno.consoleSize();
315
+ * ```
316
+ *
317
+ * This returns the size of the console window as reported by the operating
318
+ * system. It's not a reflection of how many characters will fit within the
319
+ * console window, but can be used as part of that calculation.
320
+ *
321
+ * @category I/O
322
+ */
323
+ export function consoleSize(): {
324
+ columns: number;
325
+ rows: number;
326
+ };
327
+ /**
328
+ * Copies from `src` to `dst` until either EOF (`null`) is read from `src` or
329
+ * an error occurs. It resolves to the number of bytes copied or rejects with
330
+ * the first error encountered while copying.
331
+ *
332
+ * @deprecated Use {@linkcode https://deno.land/std/io/copy.ts?s=copy | copy}
333
+ * instead. {@linkcode Deno.copy} will be removed in v2.0.0.
334
+ * @category I/O
335
+ * @param src The source to copy from
336
+ * @param dst The destination to copy to
337
+ * @param options Can be used to tune size of the buffer. Default size is 32kB
338
+ */
339
+ export function copy(src: Reader, dst: Writer, options?: { bufSize?: number }): Promise<number>;
340
+ /**
341
+ * Copies the contents and permissions of one file to another specified path,
342
+ * by default creating a new file if needed, else overwriting. Fails if target
343
+ * path is a directory or is unwritable.
344
+ *
345
+ * ```ts
346
+ * await Deno.copyFile("from.txt", "to.txt");
347
+ * ```
348
+ *
349
+ * Requires `allow-read` permission on `fromPath`.
350
+ *
351
+ * Requires `allow-write` permission on `toPath`.
352
+ *
353
+ * @tags allow-read, allow-write
354
+ * @category File System
355
+ */
356
+ export function copyFile(fromPath: string | URL, toPath: string | URL): Promise<void>;
357
+ /**
358
+ * Synchronously copies the contents and permissions of one file to another
359
+ * specified path, by default creating a new file if needed, else overwriting.
360
+ * Fails if target path is a directory or is unwritable.
361
+ *
362
+ * ```ts
363
+ * Deno.copyFileSync("from.txt", "to.txt");
364
+ * ```
365
+ *
366
+ * Requires `allow-read` permission on `fromPath`.
367
+ *
368
+ * Requires `allow-write` permission on `toPath`.
369
+ *
370
+ * @tags allow-read, allow-write
371
+ * @category File System
372
+ */
373
+ export function copyFileSync(fromPath: string | URL, toPath: string | URL): void;
374
+ /**
375
+ * Creates a file if none exists or truncates an existing file and resolves to
376
+ * an instance of {@linkcode Deno.FsFile}.
377
+ *
378
+ * ```ts
379
+ * const file = await Deno.create("/foo/bar.txt");
380
+ * ```
381
+ *
382
+ * Requires `allow-read` and `allow-write` permissions.
383
+ *
384
+ * @tags allow-read, allow-write
385
+ * @category File System
386
+ */
387
+ export function create(path: string | URL): Promise<FsFile>;
388
+ /**
389
+ * Creates a file if none exists or truncates an existing file and returns
390
+ * an instance of {@linkcode Deno.FsFile}.
391
+ *
392
+ * ```ts
393
+ * const file = Deno.createSync("/foo/bar.txt");
394
+ * ```
395
+ *
396
+ * Requires `allow-read` and `allow-write` permissions.
397
+ *
398
+ * @tags allow-read, allow-write
399
+ * @category File System
400
+ */
401
+ export function createSync(path: string | URL): FsFile;
402
+ /**
403
+ * Return a string representing the current working directory.
404
+ *
405
+ * If the current directory can be reached via multiple paths (due to symbolic
406
+ * links), `cwd()` may return any one of them.
407
+ *
408
+ * ```ts
409
+ * const currentWorkingDirectory = Deno.cwd();
410
+ * ```
411
+ *
412
+ * Throws {@linkcode Deno.errors.NotFound} if directory not available.
413
+ *
414
+ * Requires `allow-read` permission.
415
+ *
416
+ * @tags allow-read
417
+ * @category Runtime Environment
418
+ */
419
+ export function cwd(): string;
420
+ /**
421
+ * Returns the path to the current deno executable.
422
+ *
423
+ * ```ts
424
+ * console.log(Deno.execPath()); // e.g. "/home/alice/.local/bin/deno"
425
+ * ```
426
+ *
427
+ * Requires `allow-read` permission.
428
+ *
429
+ * @tags allow-read
430
+ * @category Runtime Environment
431
+ */
432
+ export function execPath(): string;
433
+ /**
434
+ * Exit the Deno process with optional exit code.
435
+ *
436
+ * If no exit code is supplied then Deno will exit with return code of `0`.
437
+ *
438
+ * In worker contexts this is an alias to `self.close();`.
439
+ *
440
+ * ```ts
441
+ * Deno.exit(5);
442
+ * ```
443
+ *
444
+ * @category Runtime Environment
445
+ */
446
+ export function exit(code?: number): never;
447
+ /**
448
+ * Flushes any pending data operations of the given file stream to disk.
449
+ * ```ts
450
+ * const file = await Deno.open(
451
+ * "my_file.txt",
452
+ * { read: true, write: true, create: true },
453
+ * );
454
+ * await file.write(new TextEncoder().encode("Hello World"));
455
+ * await Deno.fdatasync(file.rid);
456
+ * console.log(await Deno.readTextFile("my_file.txt")); // Hello World
457
+ * ```
458
+ *
459
+ * @category I/O
460
+ */
461
+ export function fdatasync(rid: number): Promise<void>;
462
+ /**
463
+ * Synchronously flushes any pending data operations of the given file stream
464
+ * to disk.
465
+ *
466
+ * ```ts
467
+ * const file = Deno.openSync(
468
+ * "my_file.txt",
469
+ * { read: true, write: true, create: true },
470
+ * );
471
+ * Deno.writeSync(file.rid, new TextEncoder().encode("Hello World"));
472
+ * Deno.fdatasyncSync(file.rid);
473
+ * console.log(Deno.readTextFileSync("my_file.txt")); // Hello World
474
+ * ```
475
+ *
476
+ * @category I/O
477
+ */
478
+ export function fdatasyncSync(rid: number): void;
479
+ /**
480
+ * Returns a `Deno.FileInfo` for the given file stream.
481
+ *
482
+ * ```ts
483
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
484
+ *
485
+ * const file = await Deno.open("file.txt", { read: true });
486
+ * const fileInfo = await Deno.fstat(file.rid);
487
+ * assert(fileInfo.isFile);
488
+ * ```
489
+ *
490
+ * @deprecated Use `file.stat()` instead.
491
+ * {@linkcode Deno.fstat} will be removed in Deno 2.0.
492
+ * @category File System
493
+ */
494
+ export function fstat(rid: number): Promise<FileInfo>;
495
+ /**
496
+ * Synchronously returns a {@linkcode Deno.FileInfo} for the given file
497
+ * stream.
498
+ *
499
+ * ```ts
500
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
501
+ *
502
+ * const file = Deno.openSync("file.txt", { read: true });
503
+ * const fileInfo = Deno.fstatSync(file.rid);
504
+ * assert(fileInfo.isFile);
505
+ * ```
506
+ *
507
+ * @deprecated Use `file.statSync()` instead.
508
+ * {@linkcode Deno.fstatSync} will be removed in Deno 2.0.
509
+ * @category File System
510
+ */
511
+ export function fstatSync(rid: number): FileInfo;
512
+ /**
513
+ * Flushes any pending data and metadata operations of the given file stream
514
+ * to disk.
515
+ *
516
+ * ```ts
517
+ * const file = await Deno.open(
518
+ * "my_file.txt",
519
+ * { read: true, write: true, create: true },
520
+ * );
521
+ * await file.write(new TextEncoder().encode("Hello World"));
522
+ * await file.truncate(1);
523
+ * await Deno.fsync(file.rid);
524
+ * console.log(await Deno.readTextFile("my_file.txt")); // H
525
+ * ```
526
+ *
527
+ * @category I/O
528
+ */
529
+ export function fsync(rid: number): Promise<void>;
530
+ /**
531
+ * Synchronously flushes any pending data and metadata operations of the given
532
+ * file stream to disk.
533
+ *
534
+ * ```ts
535
+ * const file = Deno.openSync(
536
+ * "my_file.txt",
537
+ * { read: true, write: true, create: true },
538
+ * );
539
+ * Deno.writeSync(file.rid, new TextEncoder().encode("Hello World"));
540
+ * file.truncateSync(1);
541
+ * Deno.fsyncSync(file.rid);
542
+ * console.log(Deno.readTextFileSync("my_file.txt")); // H
543
+ * ```
544
+ *
545
+ * @category I/O
546
+ */
547
+ export function fsyncSync(rid: number): void;
548
+ /**
549
+ * Truncates or extends the specified file stream, to reach the specified
550
+ * `len`.
551
+ *
552
+ * If `len` is not specified then the entire file contents are truncated as if
553
+ * `len` was set to `0`.
554
+ *
555
+ * If the file previously was larger than this new length, the extra data is
556
+ * lost.
557
+ *
558
+ * If the file previously was shorter, it is extended, and the extended part
559
+ * reads as null bytes ('\0').
560
+ *
561
+ * ### Truncate the entire file
562
+ *
563
+ * ```ts
564
+ * const file = await Deno.open(
565
+ * "my_file.txt",
566
+ * { read: true, write: true, create: true }
567
+ * );
568
+ * await Deno.ftruncate(file.rid);
569
+ * ```
570
+ *
571
+ * ### Truncate part of the file
572
+ *
573
+ * ```ts
574
+ * const file = await Deno.open(
575
+ * "my_file.txt",
576
+ * { read: true, write: true, create: true }
577
+ * );
578
+ * await file.write(new TextEncoder().encode("Hello World"));
579
+ * await Deno.ftruncate(file.rid, 7);
580
+ * const data = new Uint8Array(32);
581
+ * await Deno.read(file.rid, data);
582
+ * console.log(new TextDecoder().decode(data)); // Hello W
583
+ * ```
584
+ *
585
+ * @deprecated Use {@linkcode Deno.FsFile.truncate} instead.
586
+ * {@linkcode Deno.ftruncate} will be removed in Deno 2.0.
587
+ * @category File System
588
+ */
589
+ export function ftruncate(rid: number, len?: number): Promise<void>;
590
+ /**
591
+ * Synchronously truncates or extends the specified file stream, to reach the
592
+ * specified `len`.
593
+ *
594
+ * If `len` is not specified then the entire file contents are truncated as if
595
+ * `len` was set to `0`.
596
+ *
597
+ * If the file previously was larger than this new length, the extra data is
598
+ * lost.
599
+ *
600
+ * If the file previously was shorter, it is extended, and the extended part
601
+ * reads as null bytes ('\0').
602
+ *
603
+ * ### Truncate the entire file
604
+ *
605
+ * ```ts
606
+ * const file = Deno.openSync(
607
+ * "my_file.txt",
608
+ * { read: true, write: true, truncate: true, create: true }
609
+ * );
610
+ * Deno.ftruncateSync(file.rid);
611
+ * ```
612
+ *
613
+ * ### Truncate part of the file
614
+ *
615
+ * ```ts
616
+ * const file = Deno.openSync(
617
+ * "my_file.txt",
618
+ * { read: true, write: true, create: true }
619
+ * );
620
+ * Deno.writeSync(file.rid, new TextEncoder().encode("Hello World"));
621
+ * Deno.ftruncateSync(file.rid, 7);
622
+ * Deno.seekSync(file.rid, 0, Deno.SeekMode.Start);
623
+ * const data = new Uint8Array(32);
624
+ * Deno.readSync(file.rid, data);
625
+ * console.log(new TextDecoder().decode(data)); // Hello W
626
+ * ```
627
+ *
628
+ * @deprecated Use {@linkcode Deno.FsFile.truncateSync} instead.
629
+ * {@linkcode Deno.ftruncateSync} will be removed in Deno 2.0.
630
+ * @category File System
631
+ */
632
+ export function ftruncateSync(rid: number, len?: number): void;
633
+ /**
634
+ * Returns the group id of the process on POSIX platforms. Returns null on windows.
635
+ *
636
+ * ```ts
637
+ * console.log(Deno.gid());
638
+ * ```
639
+ *
640
+ * Requires `allow-sys` permission.
641
+ *
642
+ * @tags allow-sys
643
+ * @category Runtime Environment
644
+ */
645
+ export function gid(): number | null;
646
+ /**
647
+ * Get the `hostname` of the machine the Deno process is running on.
648
+ *
649
+ * ```ts
650
+ * console.log(Deno.hostname());
651
+ * ```
652
+ *
653
+ * Requires `allow-sys` permission.
654
+ *
655
+ * @tags allow-sys
656
+ * @category Runtime Environment
657
+ */
658
+ export function hostname(): string;
659
+ /**
660
+ * Converts the input into a string that has the same format as printed by
661
+ * `console.log()`.
662
+ *
663
+ * ```ts
664
+ * const obj = {
665
+ * a: 10,
666
+ * b: "hello",
667
+ * };
668
+ * const objAsString = Deno.inspect(obj); // { a: 10, b: "hello" }
669
+ * console.log(obj); // prints same value as objAsString, e.g. { a: 10, b: "hello" }
670
+ * ```
671
+ *
672
+ * A custom inspect functions can be registered on objects, via the symbol
673
+ * `Symbol.for("Deno.customInspect")`, to control and customize the output
674
+ * of `inspect()` or when using `console` logging:
675
+ *
676
+ * ```ts
677
+ * class A {
678
+ * x = 10;
679
+ * y = "hello";
680
+ * [Symbol.for("Deno.customInspect")]() {
681
+ * return `x=${this.x}, y=${this.y}`;
682
+ * }
683
+ * }
684
+ *
685
+ * const inStringFormat = Deno.inspect(new A()); // "x=10, y=hello"
686
+ * console.log(inStringFormat); // prints "x=10, y=hello"
687
+ * ```
688
+ *
689
+ * A depth can be specified by using the `depth` option:
690
+ *
691
+ * ```ts
692
+ * Deno.inspect({a: {b: {c: {d: 'hello'}}}}, {depth: 2}); // { a: { b: [Object] } }
693
+ * ```
694
+ *
695
+ * @category Console and Debugging
696
+ */
697
+ export function inspect(value: unknown, options?: InspectOptions): string;
698
+ /**
699
+ * Send a signal to process under given `pid`. The value and meaning of the
700
+ * `signal` to the process is operating system and process dependant.
701
+ * {@linkcode Signal} provides the most common signals. Default signal
702
+ * is `"SIGTERM"`.
703
+ *
704
+ * The term `kill` is adopted from the UNIX-like command line command `kill`
705
+ * which also signals processes.
706
+ *
707
+ * If `pid` is negative, the signal will be sent to the process group
708
+ * identified by `pid`. An error will be thrown if a negative `pid` is used on
709
+ * Windows.
710
+ *
711
+ * ```ts
712
+ * const p = Deno.run({
713
+ * cmd: ["sleep", "10000"]
714
+ * });
715
+ *
716
+ * Deno.kill(p.pid, "SIGINT");
717
+ * ```
718
+ *
719
+ * Requires `allow-run` permission.
720
+ *
721
+ * @tags allow-run
722
+ * @category Sub Process
723
+ */
724
+ export function kill(pid: number, signo?: Signal): void;
725
+ /**
726
+ * Creates `newpath` as a hard link to `oldpath`.
727
+ *
728
+ * ```ts
729
+ * await Deno.link("old/name", "new/name");
730
+ * ```
731
+ *
732
+ * Requires `allow-read` and `allow-write` permissions.
733
+ *
734
+ * @tags allow-read, allow-write
735
+ * @category File System
736
+ */
737
+ export function link(oldpath: string, newpath: string): Promise<void>;
738
+ /**
739
+ * Synchronously creates `newpath` as a hard link to `oldpath`.
740
+ *
741
+ * ```ts
742
+ * Deno.linkSync("old/name", "new/name");
743
+ * ```
744
+ *
745
+ * Requires `allow-read` and `allow-write` permissions.
746
+ *
747
+ * @tags allow-read, allow-write
748
+ * @category File System
749
+ */
750
+ export function linkSync(oldpath: string, newpath: string): void;
751
+ /**
752
+ * Listen announces on the local transport address.
753
+ *
754
+ * ```ts
755
+ * const listener1 = Deno.listen({ port: 80 })
756
+ * const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
757
+ * const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
758
+ * const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });
759
+ * ```
760
+ *
761
+ * Requires `allow-net` permission.
762
+ *
763
+ * @tags allow-net
764
+ * @category Network
765
+ */
766
+ export function listen(options: TcpListenOptions & { transport?: "tcp" }): Listener;
767
+ /**
768
+ * Listen announces on the local transport address.
769
+ *
770
+ * ```ts
771
+ * const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" })
772
+ * ```
773
+ *
774
+ * Requires `allow-read` and `allow-write` permission.
775
+ *
776
+ * @tags allow-read, allow-write
777
+ * @category Network
778
+ */
779
+ export function listen(options: UnixListenOptions & { transport: "unix" }): Listener;
780
+ /**
781
+ * Listen announces on the local transport address over TLS (transport layer
782
+ * security).
783
+ *
784
+ * ```ts
785
+ * using listener = Deno.listenTls({
786
+ * port: 443,
787
+ * cert: Deno.readTextFileSync("./server.crt"),
788
+ * key: Deno.readTextFileSync("./server.key"),
789
+ * });
790
+ * ```
791
+ *
792
+ * Requires `allow-net` permission.
793
+ *
794
+ * @tags allow-net
795
+ * @category Network
796
+ */
797
+ export function listenTls(options: ListenTlsOptions): TlsListener;
798
+ /**
799
+ * Returns an array containing the 1, 5, and 15 minute load averages. The
800
+ * load average is a measure of CPU and IO utilization of the last one, five,
801
+ * and 15 minute periods expressed as a fractional number. Zero means there
802
+ * is no load. On Windows, the three values are always the same and represent
803
+ * the current load, not the 1, 5 and 15 minute load averages.
804
+ *
805
+ * ```ts
806
+ * console.log(Deno.loadavg()); // e.g. [ 0.71, 0.44, 0.44 ]
807
+ * ```
808
+ *
809
+ * Requires `allow-sys` permission.
810
+ *
811
+ * On Windows there is no API available to retrieve this information and this method returns `[ 0, 0, 0 ]`.
812
+ *
813
+ * @tags allow-sys
814
+ * @category Observability
815
+ */
816
+ export function loadavg(): number[];
817
+ /**
818
+ * Resolves to a {@linkcode Deno.FileInfo} for the specified `path`. If
819
+ * `path` is a symlink, information for the symlink will be returned instead
820
+ * of what it points to.
821
+ *
822
+ * ```ts
823
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
824
+ * const fileInfo = await Deno.lstat("hello.txt");
825
+ * assert(fileInfo.isFile);
826
+ * ```
827
+ *
828
+ * Requires `allow-read` permission.
829
+ *
830
+ * @tags allow-read
831
+ * @category File System
832
+ */
833
+ export function lstat(path: string | URL): Promise<FileInfo>;
834
+ /**
835
+ * Synchronously returns a {@linkcode Deno.FileInfo} for the specified
836
+ * `path`. If `path` is a symlink, information for the symlink will be
837
+ * returned instead of what it points to.
838
+ *
839
+ * ```ts
840
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
841
+ * const fileInfo = Deno.lstatSync("hello.txt");
842
+ * assert(fileInfo.isFile);
843
+ * ```
844
+ *
845
+ * Requires `allow-read` permission.
846
+ *
847
+ * @tags allow-read
848
+ * @category File System
849
+ */
850
+ export function lstatSync(path: string | URL): FileInfo;
851
+ /**
852
+ * Creates a new temporary directory in the default directory for temporary
853
+ * files, unless `dir` is specified. Other optional options include
854
+ * prefixing and suffixing the directory name with `prefix` and `suffix`
855
+ * respectively.
856
+ *
857
+ * This call resolves to the full path to the newly created directory.
858
+ *
859
+ * Multiple programs calling this function simultaneously will create different
860
+ * directories. It is the caller's responsibility to remove the directory when
861
+ * no longer needed.
862
+ *
863
+ * ```ts
864
+ * const tempDirName0 = await Deno.makeTempDir(); // e.g. /tmp/2894ea76
865
+ * const tempDirName1 = await Deno.makeTempDir({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d
866
+ * ```
867
+ *
868
+ * Requires `allow-write` permission.
869
+ *
870
+ * @tags allow-write
871
+ * @category File System
872
+ */
873
+ export function makeTempDir(options?: MakeTempOptions): Promise<string>;
874
+ /**
875
+ * Synchronously creates a new temporary directory in the default directory
876
+ * for temporary files, unless `dir` is specified. Other optional options
877
+ * include prefixing and suffixing the directory name with `prefix` and
878
+ * `suffix` respectively.
879
+ *
880
+ * The full path to the newly created directory is returned.
881
+ *
882
+ * Multiple programs calling this function simultaneously will create different
883
+ * directories. It is the caller's responsibility to remove the directory when
884
+ * no longer needed.
885
+ *
886
+ * ```ts
887
+ * const tempDirName0 = Deno.makeTempDirSync(); // e.g. /tmp/2894ea76
888
+ * const tempDirName1 = Deno.makeTempDirSync({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d
889
+ * ```
890
+ *
891
+ * Requires `allow-write` permission.
892
+ *
893
+ * @tags allow-write
894
+ * @category File System
895
+ */
896
+ export function makeTempDirSync(options?: MakeTempOptions): string;
897
+ /**
898
+ * Creates a new temporary file in the default directory for temporary
899
+ * files, unless `dir` is specified.
900
+ *
901
+ * Other options include prefixing and suffixing the directory name with
902
+ * `prefix` and `suffix` respectively.
903
+ *
904
+ * This call resolves to the full path to the newly created file.
905
+ *
906
+ * Multiple programs calling this function simultaneously will create
907
+ * different files. It is the caller's responsibility to remove the file when
908
+ * no longer needed.
909
+ *
910
+ * ```ts
911
+ * const tmpFileName0 = await Deno.makeTempFile(); // e.g. /tmp/419e0bf2
912
+ * const tmpFileName1 = await Deno.makeTempFile({ prefix: 'my_temp' }); // e.g. /tmp/my_temp754d3098
913
+ * ```
914
+ *
915
+ * Requires `allow-write` permission.
916
+ *
917
+ * @tags allow-write
918
+ * @category File System
919
+ */
920
+ export function makeTempFile(options?: MakeTempOptions): Promise<string>;
921
+ /**
922
+ * Synchronously creates a new temporary file in the default directory for
923
+ * temporary files, unless `dir` is specified.
924
+ *
925
+ * Other options include prefixing and suffixing the directory name with
926
+ * `prefix` and `suffix` respectively.
927
+ *
928
+ * The full path to the newly created file is returned.
929
+ *
930
+ * Multiple programs calling this function simultaneously will create
931
+ * different files. It is the caller's responsibility to remove the file when
932
+ * no longer needed.
933
+ *
934
+ * ```ts
935
+ * const tempFileName0 = Deno.makeTempFileSync(); // e.g. /tmp/419e0bf2
936
+ * const tempFileName1 = Deno.makeTempFileSync({ prefix: 'my_temp' }); // e.g. /tmp/my_temp754d3098
937
+ * ```
938
+ *
939
+ * Requires `allow-write` permission.
940
+ *
941
+ * @tags allow-write
942
+ * @category File System
943
+ */
944
+ export function makeTempFileSync(options?: MakeTempOptions): string;
945
+ /**
946
+ * Returns an object describing the memory usage of the Deno process and the
947
+ * V8 subsystem measured in bytes.
948
+ *
949
+ * @category Runtime Environment
950
+ */
951
+ export function memoryUsage(): MemoryUsage;
952
+ /**
953
+ * Creates a new directory with the specified path.
954
+ *
955
+ * ```ts
956
+ * await Deno.mkdir("new_dir");
957
+ * await Deno.mkdir("nested/directories", { recursive: true });
958
+ * await Deno.mkdir("restricted_access_dir", { mode: 0o700 });
959
+ * ```
960
+ *
961
+ * Defaults to throwing error if the directory already exists.
962
+ *
963
+ * Requires `allow-write` permission.
964
+ *
965
+ * @tags allow-write
966
+ * @category File System
967
+ */
968
+ export function mkdir(path: string | URL, options?: MkdirOptions): Promise<void>;
969
+ /**
970
+ * Synchronously creates a new directory with the specified path.
971
+ *
972
+ * ```ts
973
+ * Deno.mkdirSync("new_dir");
974
+ * Deno.mkdirSync("nested/directories", { recursive: true });
975
+ * Deno.mkdirSync("restricted_access_dir", { mode: 0o700 });
976
+ * ```
977
+ *
978
+ * Defaults to throwing error if the directory already exists.
979
+ *
980
+ * Requires `allow-write` permission.
981
+ *
982
+ * @tags allow-write
983
+ * @category File System
984
+ */
985
+ export function mkdirSync(path: string | URL, options?: MkdirOptions): void;
986
+ /**
987
+ * Open a file and resolve to an instance of {@linkcode Deno.FsFile}. The
988
+ * file does not need to previously exist if using the `create` or `createNew`
989
+ * open options. The caller may have the resulting file automatically closed
990
+ * by the runtime once it's out of scope by declaring the file variable with
991
+ * the `using` keyword.
992
+ *
993
+ * ```ts
994
+ * using file = await Deno.open("/foo/bar.txt", { read: true, write: true });
995
+ * // Do work with file
996
+ * ```
997
+ *
998
+ * Alternatively, the caller may manually close the resource when finished with
999
+ * it.
1000
+ *
1001
+ * ```ts
1002
+ * const file = await Deno.open("/foo/bar.txt", { read: true, write: true });
1003
+ * // Do work with file
1004
+ * file.close();
1005
+ * ```
1006
+ *
1007
+ * Requires `allow-read` and/or `allow-write` permissions depending on
1008
+ * options.
1009
+ *
1010
+ * @tags allow-read, allow-write
1011
+ * @category File System
1012
+ */
1013
+ export function open(path: string | URL, options?: OpenOptions): Promise<FsFile>;
1014
+ /**
1015
+ * Synchronously open a file and return an instance of
1016
+ * {@linkcode Deno.FsFile}. The file does not need to previously exist if
1017
+ * using the `create` or `createNew` open options. The caller may have the
1018
+ * resulting file automatically closed by the runtime once it's out of scope
1019
+ * by declaring the file variable with the `using` keyword.
1020
+ *
1021
+ * ```ts
1022
+ * using file = Deno.openSync("/foo/bar.txt", { read: true, write: true });
1023
+ * // Do work with file
1024
+ * ```
1025
+ *
1026
+ * Alternatively, the caller may manually close the resource when finished with
1027
+ * it.
1028
+ *
1029
+ * ```ts
1030
+ * const file = Deno.openSync("/foo/bar.txt", { read: true, write: true });
1031
+ * // Do work with file
1032
+ * file.close();
1033
+ * ```
1034
+ *
1035
+ * Requires `allow-read` and/or `allow-write` permissions depending on
1036
+ * options.
1037
+ *
1038
+ * @tags allow-read, allow-write
1039
+ * @category File System
1040
+ */
1041
+ export function openSync(path: string | URL, options?: OpenOptions): FsFile;
1042
+ /**
1043
+ * Returns the release version of the Operating System.
1044
+ *
1045
+ * ```ts
1046
+ * console.log(Deno.osRelease());
1047
+ * ```
1048
+ *
1049
+ * Requires `allow-sys` permission.
1050
+ * Under consideration to possibly move to Deno.build or Deno.versions and if
1051
+ * it should depend sys-info, which may not be desirable.
1052
+ *
1053
+ * @tags allow-sys
1054
+ * @category Runtime Environment
1055
+ */
1056
+ export function osRelease(): string;
1057
+ /**
1058
+ * Returns the Operating System uptime in number of seconds.
1059
+ *
1060
+ * ```ts
1061
+ * console.log(Deno.osUptime());
1062
+ * ```
1063
+ *
1064
+ * Requires `allow-sys` permission.
1065
+ *
1066
+ * @tags allow-sys
1067
+ * @category Runtime Environment
1068
+ */
1069
+ export function osUptime(): number;
1070
+ /**
1071
+ * Read from a resource ID (`rid`) into an array buffer (`buffer`).
1072
+ *
1073
+ * Resolves to either the number of bytes read during the operation or EOF
1074
+ * (`null`) if there was nothing more to read.
1075
+ *
1076
+ * It is possible for a read to successfully return with `0` bytes. This does
1077
+ * not indicate EOF.
1078
+ *
1079
+ * This function is one of the lowest level APIs and most users should not
1080
+ * work with this directly, but rather use {@linkcode ReadableStream} and
1081
+ * {@linkcode https://deno.land/std/streams/mod.ts?s=toArrayBuffer|toArrayBuffer}
1082
+ * instead.
1083
+ *
1084
+ * **It is not guaranteed that the full buffer will be read in a single call.**
1085
+ *
1086
+ * ```ts
1087
+ * // if "/foo/bar.txt" contains the text "hello world":
1088
+ * using file = await Deno.open("/foo/bar.txt");
1089
+ * const buf = new Uint8Array(100);
1090
+ * const numberOfBytesRead = await Deno.read(file.rid, buf); // 11 bytes
1091
+ * const text = new TextDecoder().decode(buf); // "hello world"
1092
+ * ```
1093
+ *
1094
+ * @deprecated Use `reader.read()` instead. {@linkcode Deno.read} will be
1095
+ * removed in Deno 2.0.
1096
+ * @category I/O
1097
+ */
1098
+ export function read(rid: number, buffer: Uint8Array): Promise<number | null>;
1099
+ /**
1100
+ * Reads the directory given by `path` and returns an async iterable of
1101
+ * {@linkcode Deno.DirEntry}. The order of entries is not guaranteed.
1102
+ *
1103
+ * ```ts
1104
+ * for await (const dirEntry of Deno.readDir("/")) {
1105
+ * console.log(dirEntry.name);
1106
+ * }
1107
+ * ```
1108
+ *
1109
+ * Throws error if `path` is not a directory.
1110
+ *
1111
+ * Requires `allow-read` permission.
1112
+ *
1113
+ * @tags allow-read
1114
+ * @category File System
1115
+ */
1116
+ export function readDir(path: string | URL): AsyncIterable<DirEntry>;
1117
+ /**
1118
+ * Synchronously reads the directory given by `path` and returns an iterable
1119
+ * of {@linkcode Deno.DirEntry}. The order of entries is not guaranteed.
1120
+ *
1121
+ * ```ts
1122
+ * for (const dirEntry of Deno.readDirSync("/")) {
1123
+ * console.log(dirEntry.name);
1124
+ * }
1125
+ * ```
1126
+ *
1127
+ * Throws error if `path` is not a directory.
1128
+ *
1129
+ * Requires `allow-read` permission.
1130
+ *
1131
+ * @tags allow-read
1132
+ * @category File System
1133
+ */
1134
+ export function readDirSync(path: string | URL): Iterable<DirEntry>;
1135
+ /**
1136
+ * Reads and resolves to the entire contents of a file as an array of bytes.
1137
+ * `TextDecoder` can be used to transform the bytes to string if required.
1138
+ * Reading a directory returns an empty data array.
1139
+ *
1140
+ * ```ts
1141
+ * const decoder = new TextDecoder("utf-8");
1142
+ * const data = await Deno.readFile("hello.txt");
1143
+ * console.log(decoder.decode(data));
1144
+ * ```
1145
+ *
1146
+ * Requires `allow-read` permission.
1147
+ *
1148
+ * @tags allow-read
1149
+ * @category File System
1150
+ */
1151
+ export function readFile(path: string | URL, options?: ReadFileOptions): Promise<Uint8Array>;
1152
+ /**
1153
+ * Synchronously reads and returns the entire contents of a file as an array
1154
+ * of bytes. `TextDecoder` can be used to transform the bytes to string if
1155
+ * required. Reading a directory returns an empty data array.
1156
+ *
1157
+ * ```ts
1158
+ * const decoder = new TextDecoder("utf-8");
1159
+ * const data = Deno.readFileSync("hello.txt");
1160
+ * console.log(decoder.decode(data));
1161
+ * ```
1162
+ *
1163
+ * Requires `allow-read` permission.
1164
+ *
1165
+ * @tags allow-read
1166
+ * @category File System
1167
+ */
1168
+ export function readFileSync(path: string | URL): Uint8Array;
1169
+ /**
1170
+ * Resolves to the full path destination of the named symbolic link.
1171
+ *
1172
+ * ```ts
1173
+ * await Deno.symlink("./test.txt", "./test_link.txt");
1174
+ * const target = await Deno.readLink("./test_link.txt"); // full path of ./test.txt
1175
+ * ```
1176
+ *
1177
+ * Throws TypeError if called with a hard link.
1178
+ *
1179
+ * Requires `allow-read` permission.
1180
+ *
1181
+ * @tags allow-read
1182
+ * @category File System
1183
+ */
1184
+ export function readLink(path: string | URL): Promise<string>;
1185
+ /**
1186
+ * Synchronously returns the full path destination of the named symbolic
1187
+ * link.
1188
+ *
1189
+ * ```ts
1190
+ * Deno.symlinkSync("./test.txt", "./test_link.txt");
1191
+ * const target = Deno.readLinkSync("./test_link.txt"); // full path of ./test.txt
1192
+ * ```
1193
+ *
1194
+ * Throws TypeError if called with a hard link.
1195
+ *
1196
+ * Requires `allow-read` permission.
1197
+ *
1198
+ * @tags allow-read
1199
+ * @category File System
1200
+ */
1201
+ export function readLinkSync(path: string | URL): string;
1202
+ /**
1203
+ * Synchronously read from a resource ID (`rid`) into an array buffer
1204
+ * (`buffer`).
1205
+ *
1206
+ * Returns either the number of bytes read during the operation or EOF
1207
+ * (`null`) if there was nothing more to read.
1208
+ *
1209
+ * It is possible for a read to successfully return with `0` bytes. This does
1210
+ * not indicate EOF.
1211
+ *
1212
+ * This function is one of the lowest level APIs and most users should not
1213
+ * work with this directly, but rather use {@linkcode ReadableStream} and
1214
+ * {@linkcode https://deno.land/std/streams/mod.ts?s=toArrayBuffer|toArrayBuffer}
1215
+ * instead.
1216
+ *
1217
+ * **It is not guaranteed that the full buffer will be read in a single
1218
+ * call.**
1219
+ *
1220
+ * ```ts
1221
+ * // if "/foo/bar.txt" contains the text "hello world":
1222
+ * using file = Deno.openSync("/foo/bar.txt");
1223
+ * const buf = new Uint8Array(100);
1224
+ * const numberOfBytesRead = Deno.readSync(file.rid, buf); // 11 bytes
1225
+ * const text = new TextDecoder().decode(buf); // "hello world"
1226
+ * ```
1227
+ *
1228
+ * @deprecated Use `reader.readSync()` instead. {@linkcode Deno.readSync}
1229
+ * will be removed in Deno 2.0.
1230
+ * @category I/O
1231
+ */
1232
+ export function readSync(rid: number, buffer: Uint8Array): number | null;
1233
+ /**
1234
+ * Asynchronously reads and returns the entire contents of a file as an UTF-8
1235
+ * decoded string. Reading a directory throws an error.
1236
+ *
1237
+ * ```ts
1238
+ * const data = await Deno.readTextFile("hello.txt");
1239
+ * console.log(data);
1240
+ * ```
1241
+ *
1242
+ * Requires `allow-read` permission.
1243
+ *
1244
+ * @tags allow-read
1245
+ * @category File System
1246
+ */
1247
+ export function readTextFile(path: string | URL, options?: ReadFileOptions): Promise<string>;
1248
+ /**
1249
+ * Synchronously reads and returns the entire contents of a file as an UTF-8
1250
+ * decoded string. Reading a directory throws an error.
1251
+ *
1252
+ * ```ts
1253
+ * const data = Deno.readTextFileSync("hello.txt");
1254
+ * console.log(data);
1255
+ * ```
1256
+ *
1257
+ * Requires `allow-read` permission.
1258
+ *
1259
+ * @tags allow-read
1260
+ * @category File System
1261
+ */
1262
+ export function readTextFileSync(path: string | URL): string;
1263
+ /**
1264
+ * Resolves to the absolute normalized path, with symbolic links resolved.
1265
+ *
1266
+ * ```ts
1267
+ * // e.g. given /home/alice/file.txt and current directory /home/alice
1268
+ * await Deno.symlink("file.txt", "symlink_file.txt");
1269
+ * const realPath = await Deno.realPath("./file.txt");
1270
+ * const realSymLinkPath = await Deno.realPath("./symlink_file.txt");
1271
+ * console.log(realPath); // outputs "/home/alice/file.txt"
1272
+ * console.log(realSymLinkPath); // outputs "/home/alice/file.txt"
1273
+ * ```
1274
+ *
1275
+ * Requires `allow-read` permission for the target path.
1276
+ *
1277
+ * Also requires `allow-read` permission for the `CWD` if the target path is
1278
+ * relative.
1279
+ *
1280
+ * @tags allow-read
1281
+ * @category File System
1282
+ */
1283
+ export function realPath(path: string | URL): Promise<string>;
1284
+ /**
1285
+ * Synchronously returns absolute normalized path, with symbolic links
1286
+ * resolved.
1287
+ *
1288
+ * ```ts
1289
+ * // e.g. given /home/alice/file.txt and current directory /home/alice
1290
+ * Deno.symlinkSync("file.txt", "symlink_file.txt");
1291
+ * const realPath = Deno.realPathSync("./file.txt");
1292
+ * const realSymLinkPath = Deno.realPathSync("./symlink_file.txt");
1293
+ * console.log(realPath); // outputs "/home/alice/file.txt"
1294
+ * console.log(realSymLinkPath); // outputs "/home/alice/file.txt"
1295
+ * ```
1296
+ *
1297
+ * Requires `allow-read` permission for the target path.
1298
+ *
1299
+ * Also requires `allow-read` permission for the `CWD` if the target path is
1300
+ * relative.
1301
+ *
1302
+ * @tags allow-read
1303
+ * @category File System
1304
+ */
1305
+ export function realPathSync(path: string | URL): string;
1306
+ /**
1307
+ * Removes the named file or directory.
1308
+ *
1309
+ * ```ts
1310
+ * await Deno.remove("/path/to/empty_dir/or/file");
1311
+ * await Deno.remove("/path/to/populated_dir/or/file", { recursive: true });
1312
+ * ```
1313
+ *
1314
+ * Throws error if permission denied, path not found, or path is a non-empty
1315
+ * directory and the `recursive` option isn't set to `true`.
1316
+ *
1317
+ * Requires `allow-write` permission.
1318
+ *
1319
+ * @tags allow-write
1320
+ * @category File System
1321
+ */
1322
+ export function remove(path: string | URL, options?: RemoveOptions): Promise<void>;
1323
+ /**
1324
+ * Removes the given signal listener that has been registered with
1325
+ * {@linkcode Deno.addSignalListener}.
1326
+ *
1327
+ * ```ts
1328
+ * const listener = () => {
1329
+ * console.log("SIGTERM!")
1330
+ * };
1331
+ * Deno.addSignalListener("SIGTERM", listener);
1332
+ * Deno.removeSignalListener("SIGTERM", listener);
1333
+ * ```
1334
+ *
1335
+ * _Note_: On Windows only `"SIGINT"` (CTRL+C) and `"SIGBREAK"` (CTRL+Break)
1336
+ * are supported.
1337
+ *
1338
+ * @category Runtime Environment
1339
+ */
1340
+ export function removeSignalListener(signal: Signal, handler: () => void): void;
1341
+ /**
1342
+ * Synchronously removes the named file or directory.
1343
+ *
1344
+ * ```ts
1345
+ * Deno.removeSync("/path/to/empty_dir/or/file");
1346
+ * Deno.removeSync("/path/to/populated_dir/or/file", { recursive: true });
1347
+ * ```
1348
+ *
1349
+ * Throws error if permission denied, path not found, or path is a non-empty
1350
+ * directory and the `recursive` option isn't set to `true`.
1351
+ *
1352
+ * Requires `allow-write` permission.
1353
+ *
1354
+ * @tags allow-write
1355
+ * @category File System
1356
+ */
1357
+ export function removeSync(path: string | URL, options?: RemoveOptions): void;
1358
+ /**
1359
+ * Renames (moves) `oldpath` to `newpath`. Paths may be files or directories.
1360
+ * If `newpath` already exists and is not a directory, `rename()` replaces it.
1361
+ * OS-specific restrictions may apply when `oldpath` and `newpath` are in
1362
+ * different directories.
1363
+ *
1364
+ * ```ts
1365
+ * await Deno.rename("old/path", "new/path");
1366
+ * ```
1367
+ *
1368
+ * On Unix-like OSes, this operation does not follow symlinks at either path.
1369
+ *
1370
+ * It varies between platforms when the operation throws errors, and if so
1371
+ * what they are. It's always an error to rename anything to a non-empty
1372
+ * directory.
1373
+ *
1374
+ * Requires `allow-read` and `allow-write` permissions.
1375
+ *
1376
+ * @tags allow-read, allow-write
1377
+ * @category File System
1378
+ */
1379
+ export function rename(oldpath: string | URL, newpath: string | URL): Promise<void>;
1380
+ /**
1381
+ * Synchronously renames (moves) `oldpath` to `newpath`. Paths may be files or
1382
+ * directories. If `newpath` already exists and is not a directory,
1383
+ * `renameSync()` replaces it. OS-specific restrictions may apply when
1384
+ * `oldpath` and `newpath` are in different directories.
1385
+ *
1386
+ * ```ts
1387
+ * Deno.renameSync("old/path", "new/path");
1388
+ * ```
1389
+ *
1390
+ * On Unix-like OSes, this operation does not follow symlinks at either path.
1391
+ *
1392
+ * It varies between platforms when the operation throws errors, and if so what
1393
+ * they are. It's always an error to rename anything to a non-empty directory.
1394
+ *
1395
+ * Requires `allow-read` and `allow-write` permissions.
1396
+ *
1397
+ * @tags allow-read, allow-write
1398
+ * @category File System
1399
+ */
1400
+ export function renameSync(oldpath: string | URL, newpath: string | URL): void;
1401
+ /**
1402
+ * Performs DNS resolution against the given query, returning resolved
1403
+ * records.
1404
+ *
1405
+ * Fails in the cases such as:
1406
+ *
1407
+ * - the query is in invalid format.
1408
+ * - the options have an invalid parameter. For example `nameServer.port` is
1409
+ * beyond the range of 16-bit unsigned integer.
1410
+ * - the request timed out.
1411
+ *
1412
+ * ```ts
1413
+ * const a = await Deno.resolveDns("example.com", "A");
1414
+ *
1415
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1416
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1417
+ * });
1418
+ * ```
1419
+ *
1420
+ * Requires `allow-net` permission.
1421
+ *
1422
+ * @tags allow-net
1423
+ * @category Network
1424
+ */
1425
+ export function resolveDns(query: string, recordType: "A" | "AAAA" | "ANAME" | "CNAME" | "NS" | "PTR", options?: ResolveDnsOptions): Promise<string[]>;
1426
+ /**
1427
+ * Performs DNS resolution against the given query, returning resolved
1428
+ * records.
1429
+ *
1430
+ * Fails in the cases such as:
1431
+ *
1432
+ * - the query is in invalid format.
1433
+ * - the options have an invalid parameter. For example `nameServer.port` is
1434
+ * beyond the range of 16-bit unsigned integer.
1435
+ * - the request timed out.
1436
+ *
1437
+ * ```ts
1438
+ * const a = await Deno.resolveDns("example.com", "A");
1439
+ *
1440
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1441
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1442
+ * });
1443
+ * ```
1444
+ *
1445
+ * Requires `allow-net` permission.
1446
+ *
1447
+ * @tags allow-net
1448
+ * @category Network
1449
+ */
1450
+ export function resolveDns(query: string, recordType: "CAA", options?: ResolveDnsOptions): Promise<CAARecord[]>;
1451
+ /**
1452
+ * Performs DNS resolution against the given query, returning resolved
1453
+ * records.
1454
+ *
1455
+ * Fails in the cases such as:
1456
+ *
1457
+ * - the query is in invalid format.
1458
+ * - the options have an invalid parameter. For example `nameServer.port` is
1459
+ * beyond the range of 16-bit unsigned integer.
1460
+ * - the request timed out.
1461
+ *
1462
+ * ```ts
1463
+ * const a = await Deno.resolveDns("example.com", "A");
1464
+ *
1465
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1466
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1467
+ * });
1468
+ * ```
1469
+ *
1470
+ * Requires `allow-net` permission.
1471
+ *
1472
+ * @tags allow-net
1473
+ * @category Network
1474
+ */
1475
+ export function resolveDns(query: string, recordType: "MX", options?: ResolveDnsOptions): Promise<MXRecord[]>;
1476
+ /**
1477
+ * Performs DNS resolution against the given query, returning resolved
1478
+ * records.
1479
+ *
1480
+ * Fails in the cases such as:
1481
+ *
1482
+ * - the query is in invalid format.
1483
+ * - the options have an invalid parameter. For example `nameServer.port` is
1484
+ * beyond the range of 16-bit unsigned integer.
1485
+ * - the request timed out.
1486
+ *
1487
+ * ```ts
1488
+ * const a = await Deno.resolveDns("example.com", "A");
1489
+ *
1490
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1491
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1492
+ * });
1493
+ * ```
1494
+ *
1495
+ * Requires `allow-net` permission.
1496
+ *
1497
+ * @tags allow-net
1498
+ * @category Network
1499
+ */
1500
+ export function resolveDns(query: string, recordType: "NAPTR", options?: ResolveDnsOptions): Promise<NAPTRRecord[]>;
1501
+ /**
1502
+ * Performs DNS resolution against the given query, returning resolved
1503
+ * records.
1504
+ *
1505
+ * Fails in the cases such as:
1506
+ *
1507
+ * - the query is in invalid format.
1508
+ * - the options have an invalid parameter. For example `nameServer.port` is
1509
+ * beyond the range of 16-bit unsigned integer.
1510
+ * - the request timed out.
1511
+ *
1512
+ * ```ts
1513
+ * const a = await Deno.resolveDns("example.com", "A");
1514
+ *
1515
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1516
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1517
+ * });
1518
+ * ```
1519
+ *
1520
+ * Requires `allow-net` permission.
1521
+ *
1522
+ * @tags allow-net
1523
+ * @category Network
1524
+ */
1525
+ export function resolveDns(query: string, recordType: "SOA", options?: ResolveDnsOptions): Promise<SOARecord[]>;
1526
+ /**
1527
+ * Performs DNS resolution against the given query, returning resolved
1528
+ * records.
1529
+ *
1530
+ * Fails in the cases such as:
1531
+ *
1532
+ * - the query is in invalid format.
1533
+ * - the options have an invalid parameter. For example `nameServer.port` is
1534
+ * beyond the range of 16-bit unsigned integer.
1535
+ * - the request timed out.
1536
+ *
1537
+ * ```ts
1538
+ * const a = await Deno.resolveDns("example.com", "A");
1539
+ *
1540
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1541
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1542
+ * });
1543
+ * ```
1544
+ *
1545
+ * Requires `allow-net` permission.
1546
+ *
1547
+ * @tags allow-net
1548
+ * @category Network
1549
+ */
1550
+ export function resolveDns(query: string, recordType: "SRV", options?: ResolveDnsOptions): Promise<SRVRecord[]>;
1551
+ /**
1552
+ * Performs DNS resolution against the given query, returning resolved
1553
+ * records.
1554
+ *
1555
+ * Fails in the cases such as:
1556
+ *
1557
+ * - the query is in invalid format.
1558
+ * - the options have an invalid parameter. For example `nameServer.port` is
1559
+ * beyond the range of 16-bit unsigned integer.
1560
+ * - the request timed out.
1561
+ *
1562
+ * ```ts
1563
+ * const a = await Deno.resolveDns("example.com", "A");
1564
+ *
1565
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1566
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1567
+ * });
1568
+ * ```
1569
+ *
1570
+ * Requires `allow-net` permission.
1571
+ *
1572
+ * @tags allow-net
1573
+ * @category Network
1574
+ */
1575
+ export function resolveDns(query: string, recordType: "TXT", options?: ResolveDnsOptions): Promise<string[][]>;
1576
+ /**
1577
+ * Performs DNS resolution against the given query, returning resolved
1578
+ * records.
1579
+ *
1580
+ * Fails in the cases such as:
1581
+ *
1582
+ * - the query is in invalid format.
1583
+ * - the options have an invalid parameter. For example `nameServer.port` is
1584
+ * beyond the range of 16-bit unsigned integer.
1585
+ * - the request timed out.
1586
+ *
1587
+ * ```ts
1588
+ * const a = await Deno.resolveDns("example.com", "A");
1589
+ *
1590
+ * const aaaa = await Deno.resolveDns("example.com", "AAAA", {
1591
+ * nameServer: { ipAddr: "8.8.8.8", port: 53 },
1592
+ * });
1593
+ * ```
1594
+ *
1595
+ * Requires `allow-net` permission.
1596
+ *
1597
+ * @tags allow-net
1598
+ * @category Network
1599
+ */
1600
+ export function resolveDns(query: string, recordType: RecordType, options?: ResolveDnsOptions): Promise<
1601
+ | string[]
1602
+ | CAARecord[]
1603
+ | MXRecord[]
1604
+ | NAPTRRecord[]
1605
+ | SOARecord[]
1606
+ | SRVRecord[]
1607
+ | string[][]
1608
+ >;
1609
+
1610
+ export class Process<T extends Deno.RunOptions = Deno.RunOptions> implements Deno.Process<T> {
1611
+ #private;
1612
+ get rid(): number;
1613
+ get pid(): number;
1614
+ get stdin(): T["stdin"] extends "piped" ? Deno.Writer & Deno.Closer & {
1615
+ writable: import("stream/web").WritableStream<Uint8Array>;
1616
+ } : (Deno.Writer & Deno.Closer & {
1617
+ writable: import("stream/web").WritableStream<Uint8Array>;
1618
+ }) | null;
1619
+ get stdout(): T["stdout"] extends "piped" ? Deno.Reader & Deno.Closer & {
1620
+ readable: import("stream/web").ReadableStream<Uint8Array>;
1621
+ } : (Deno.Reader & Deno.Closer & {
1622
+ readable: import("stream/web").ReadableStream<Uint8Array>;
1623
+ }) | null;
1624
+ get stderr(): T["stderr"] extends "piped" ? Deno.Reader & Deno.Closer & {
1625
+ readable: import("stream/web").ReadableStream<Uint8Array>;
1626
+ } : (Deno.Reader & Deno.Closer & {
1627
+ readable: import("stream/web").ReadableStream<Uint8Array>;
1628
+ }) | null;
1629
+ status(): Promise<Deno.ProcessStatus>;
1630
+ output(): Promise<Uint8Array>;
1631
+ stderrOutput(): Promise<Uint8Array>;
1632
+ close(): void;
1633
+ kill(signo?: string): void;
1634
+ }
1635
+
1636
+ /**
1637
+ * Spawns new subprocess. RunOptions must contain at a minimum the `opt.cmd`,
1638
+ * an array of program arguments, the first of which is the binary.
1639
+ *
1640
+ * ```ts
1641
+ * const p = Deno.run({
1642
+ * cmd: ["curl", "https://example.com"],
1643
+ * });
1644
+ * const status = await p.status();
1645
+ * ```
1646
+ *
1647
+ * Subprocess uses same working directory as parent process unless `opt.cwd`
1648
+ * is specified.
1649
+ *
1650
+ * Environmental variables from parent process can be cleared using `opt.clearEnv`.
1651
+ * Doesn't guarantee that only `opt.env` variables are present,
1652
+ * as the OS may set environmental variables for processes.
1653
+ *
1654
+ * Environmental variables for subprocess can be specified using `opt.env`
1655
+ * mapping.
1656
+ *
1657
+ * `opt.uid` sets the child process’s user ID. This translates to a setuid call
1658
+ * in the child process. Failure in the setuid call will cause the spawn to fail.
1659
+ *
1660
+ * `opt.gid` is similar to `opt.uid`, but sets the group ID of the child process.
1661
+ * This has the same semantics as the uid field.
1662
+ *
1663
+ * By default subprocess inherits stdio of parent process. To change
1664
+ * this this, `opt.stdin`, `opt.stdout`, and `opt.stderr` can be set
1665
+ * independently to a resource ID (_rid_) of an open file, `"inherit"`,
1666
+ * `"piped"`, or `"null"`:
1667
+ *
1668
+ * - _number_: the resource ID of an open file/resource. This allows you to
1669
+ * read or write to a file.
1670
+ * - `"inherit"`: The default if unspecified. The subprocess inherits from the
1671
+ * parent.
1672
+ * - `"piped"`: A new pipe should be arranged to connect the parent and child
1673
+ * sub-process.
1674
+ * - `"null"`: This stream will be ignored. This is the equivalent of attaching
1675
+ * the stream to `/dev/null`.
1676
+ *
1677
+ * Details of the spawned process are returned as an instance of
1678
+ * {@linkcode Deno.Process}.
1679
+ *
1680
+ * Requires `allow-run` permission.
1681
+ *
1682
+ * @deprecated Use {@linkcode Deno.Command} instead. {@linkcode Deno.run}
1683
+ * will be removed in v2.0.0.
1684
+ * @tags allow-run
1685
+ * @category Sub Process
1686
+ */
1687
+ export function run<T extends RunOptions = RunOptions>(opt: T): Process<T>;
1688
+ /**
1689
+ * *UNSTABLE**: New API, yet to be vetted.
1690
+ *
1691
+ * Spawns new subprocess. RunOptions must contain at a minimum the `opt.cmd`,
1692
+ * an array of program arguments, the first of which is the binary.
1693
+ *
1694
+ * ```ts
1695
+ * const p = Deno.run({
1696
+ * cmd: ["curl", "https://example.com"],
1697
+ * });
1698
+ * const status = await p.status();
1699
+ * ```
1700
+ *
1701
+ * Subprocess uses same working directory as parent process unless `opt.cwd`
1702
+ * is specified.
1703
+ *
1704
+ * Environmental variables from parent process can be cleared using `opt.clearEnv`.
1705
+ * Doesn't guarantee that only `opt.env` variables are present,
1706
+ * as the OS may set environmental variables for processes.
1707
+ *
1708
+ * Environmental variables for subprocess can be specified using `opt.env`
1709
+ * mapping.
1710
+ *
1711
+ * `opt.uid` sets the child process’s user ID. This translates to a setuid call
1712
+ * in the child process. Failure in the setuid call will cause the spawn to fail.
1713
+ *
1714
+ * `opt.gid` is similar to `opt.uid`, but sets the group ID of the child process.
1715
+ * This has the same semantics as the uid field.
1716
+ *
1717
+ * By default subprocess inherits stdio of parent process. To change
1718
+ * this this, `opt.stdin`, `opt.stdout`, and `opt.stderr` can be set
1719
+ * independently to a resource ID (_rid_) of an open file, `"inherit"`,
1720
+ * `"piped"`, or `"null"`:
1721
+ *
1722
+ * - _number_: the resource ID of an open file/resource. This allows you to
1723
+ * read or write to a file.
1724
+ * - `"inherit"`: The default if unspecified. The subprocess inherits from the
1725
+ * parent.
1726
+ * - `"piped"`: A new pipe should be arranged to connect the parent and child
1727
+ * sub-process.
1728
+ * - `"null"`: This stream will be ignored. This is the equivalent of attaching
1729
+ * the stream to `/dev/null`.
1730
+ *
1731
+ * Details of the spawned process are returned as an instance of
1732
+ * {@linkcode Deno.Process}.
1733
+ *
1734
+ * Requires `allow-run` permission.
1735
+ *
1736
+ * @tags allow-run
1737
+ * @category Sub Process
1738
+ */
1739
+ export function run<T extends UnstableRunOptions = UnstableRunOptions>(opt: T): Process<T>;
1740
+ export type UnstableRunOptions = RunOptions & {
1741
+ clearEnv?: boolean;
1742
+ gid?: number;
1743
+ uid?: number;
1744
+ };
1745
+ /**
1746
+ * Shutdown socket send operations.
1747
+ *
1748
+ * Matches behavior of POSIX shutdown(3).
1749
+ *
1750
+ * ```ts
1751
+ * const listener = Deno.listen({ port: 80 });
1752
+ * const conn = await listener.accept();
1753
+ * Deno.shutdown(conn.rid);
1754
+ * ```
1755
+ *
1756
+ * @deprecated Use {@linkcode Deno.Conn.closeWrite} instead.
1757
+ * {@linkcode Deno.shutdown} will be removed in Deno 2.0.
1758
+ * @category Network
1759
+ */
1760
+ export function shutdown(rid: number): Promise<void>;
1761
+ /**
1762
+ * Resolves to a {@linkcode Deno.FileInfo} for the specified `path`. Will
1763
+ * always follow symlinks.
1764
+ *
1765
+ * ```ts
1766
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
1767
+ * const fileInfo = await Deno.stat("hello.txt");
1768
+ * assert(fileInfo.isFile);
1769
+ * ```
1770
+ *
1771
+ * Requires `allow-read` permission.
1772
+ *
1773
+ * @tags allow-read
1774
+ * @category File System
1775
+ */
1776
+ export function stat(path: string | URL): Promise<FileInfo>;
1777
+ /**
1778
+ * Synchronously returns a {@linkcode Deno.FileInfo} for the specified
1779
+ * `path`. Will always follow symlinks.
1780
+ *
1781
+ * ```ts
1782
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
1783
+ * const fileInfo = Deno.statSync("hello.txt");
1784
+ * assert(fileInfo.isFile);
1785
+ * ```
1786
+ *
1787
+ * Requires `allow-read` permission.
1788
+ *
1789
+ * @tags allow-read
1790
+ * @category File System
1791
+ */
1792
+ export function statSync(path: string | URL): FileInfo;
1793
+ /**
1794
+ * Creates `newpath` as a symbolic link to `oldpath`.
1795
+ *
1796
+ * The `options.type` parameter can be set to `"file"` or `"dir"`. This
1797
+ * argument is only available on Windows and ignored on other platforms.
1798
+ *
1799
+ * ```ts
1800
+ * await Deno.symlink("old/name", "new/name");
1801
+ * ```
1802
+ *
1803
+ * Requires full `allow-read` and `allow-write` permissions.
1804
+ *
1805
+ * @tags allow-read, allow-write
1806
+ * @category File System
1807
+ */
1808
+ export function symlink(oldpath: string | URL, newpath: string | URL, options?: SymlinkOptions): Promise<void>;
1809
+ /**
1810
+ * Creates `newpath` as a symbolic link to `oldpath`.
1811
+ *
1812
+ * The `options.type` parameter can be set to `"file"` or `"dir"`. This
1813
+ * argument is only available on Windows and ignored on other platforms.
1814
+ *
1815
+ * ```ts
1816
+ * Deno.symlinkSync("old/name", "new/name");
1817
+ * ```
1818
+ *
1819
+ * Requires full `allow-read` and `allow-write` permissions.
1820
+ *
1821
+ * @tags allow-read, allow-write
1822
+ * @category File System
1823
+ */
1824
+ export function symlinkSync(oldpath: string | URL, newpath: string | URL, options?: SymlinkOptions): void;
1825
+ /**
1826
+ * Register a test which will be run when `deno test` is used on the command
1827
+ * line and the containing module looks like a test module.
1828
+ *
1829
+ * `fn` can be async if required.
1830
+ *
1831
+ * ```ts
1832
+ * import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
1833
+ *
1834
+ * Deno.test({
1835
+ * name: "example test",
1836
+ * fn() {
1837
+ * assertEquals("world", "world");
1838
+ * },
1839
+ * });
1840
+ *
1841
+ * Deno.test({
1842
+ * name: "example ignored test",
1843
+ * ignore: Deno.build.os === "windows",
1844
+ * fn() {
1845
+ * // This test is ignored only on Windows machines
1846
+ * },
1847
+ * });
1848
+ *
1849
+ * Deno.test({
1850
+ * name: "example async test",
1851
+ * async fn() {
1852
+ * const decoder = new TextDecoder("utf-8");
1853
+ * const data = await Deno.readFile("hello_world.txt");
1854
+ * assertEquals(decoder.decode(data), "Hello world");
1855
+ * }
1856
+ * });
1857
+ * ```
1858
+ *
1859
+ * @category Testing
1860
+ */
1861
+ export const test: DenoTest;
1862
+ /**
1863
+ * Truncates (or extends) the specified file, to reach the specified `len`.
1864
+ * If `len` is not specified then the entire file contents are truncated.
1865
+ *
1866
+ * ### Truncate the entire file
1867
+ * ```ts
1868
+ * await Deno.truncate("my_file.txt");
1869
+ * ```
1870
+ *
1871
+ * ### Truncate part of the file
1872
+ *
1873
+ * ```ts
1874
+ * const file = await Deno.makeTempFile();
1875
+ * await Deno.writeTextFile(file, "Hello World");
1876
+ * await Deno.truncate(file, 7);
1877
+ * const data = await Deno.readFile(file);
1878
+ * console.log(new TextDecoder().decode(data)); // "Hello W"
1879
+ * ```
1880
+ *
1881
+ * Requires `allow-write` permission.
1882
+ *
1883
+ * @tags allow-write
1884
+ * @category File System
1885
+ */
1886
+ export function truncate(name: string, len?: number): Promise<void>;
1887
+ /**
1888
+ * Synchronously truncates (or extends) the specified file, to reach the
1889
+ * specified `len`. If `len` is not specified then the entire file contents
1890
+ * are truncated.
1891
+ *
1892
+ * ### Truncate the entire file
1893
+ *
1894
+ * ```ts
1895
+ * Deno.truncateSync("my_file.txt");
1896
+ * ```
1897
+ *
1898
+ * ### Truncate part of the file
1899
+ *
1900
+ * ```ts
1901
+ * const file = Deno.makeTempFileSync();
1902
+ * Deno.writeFileSync(file, new TextEncoder().encode("Hello World"));
1903
+ * Deno.truncateSync(file, 7);
1904
+ * const data = Deno.readFileSync(file);
1905
+ * console.log(new TextDecoder().decode(data));
1906
+ * ```
1907
+ *
1908
+ * Requires `allow-write` permission.
1909
+ *
1910
+ * @tags allow-write
1911
+ * @category File System
1912
+ */
1913
+ export function truncateSync(name: string, len?: number): void;
1914
+ /**
1915
+ * Returns the user id of the process on POSIX platforms. Returns null on Windows.
1916
+ *
1917
+ * ```ts
1918
+ * console.log(Deno.uid());
1919
+ * ```
1920
+ *
1921
+ * Requires `allow-sys` permission.
1922
+ *
1923
+ * @tags allow-sys
1924
+ * @category Runtime Environment
1925
+ */
1926
+ export function uid(): number | null;
1927
+ /**
1928
+ * Watch for file system events against one or more `paths`, which can be
1929
+ * files or directories. These paths must exist already. One user action (e.g.
1930
+ * `touch test.file`) can generate multiple file system events. Likewise,
1931
+ * one user action can result in multiple file paths in one event (e.g. `mv
1932
+ * old_name.txt new_name.txt`).
1933
+ *
1934
+ * The recursive option is `true` by default and, for directories, will watch
1935
+ * the specified directory and all sub directories.
1936
+ *
1937
+ * Note that the exact ordering of the events can vary between operating
1938
+ * systems.
1939
+ *
1940
+ * ```ts
1941
+ * const watcher = Deno.watchFs("/");
1942
+ * for await (const event of watcher) {
1943
+ * console.log(">>>> event", event);
1944
+ * // { kind: "create", paths: [ "/foo.txt" ] }
1945
+ * }
1946
+ * ```
1947
+ *
1948
+ * Call `watcher.close()` to stop watching.
1949
+ *
1950
+ * ```ts
1951
+ * const watcher = Deno.watchFs("/");
1952
+ *
1953
+ * setTimeout(() => {
1954
+ * watcher.close();
1955
+ * }, 5000);
1956
+ *
1957
+ * for await (const event of watcher) {
1958
+ * console.log(">>>> event", event);
1959
+ * }
1960
+ * ```
1961
+ *
1962
+ * Requires `allow-read` permission.
1963
+ *
1964
+ * @tags allow-read
1965
+ * @category File System
1966
+ */
1967
+ export function watchFs(paths: string | string[], options?: { recursive: boolean }): FsWatcher;
1968
+ /**
1969
+ * Write to the resource ID (`rid`) the contents of the array buffer (`data`).
1970
+ *
1971
+ * Resolves to the number of bytes written. This function is one of the lowest
1972
+ * level APIs and most users should not work with this directly, but rather
1973
+ * use {@linkcode WritableStream}, {@linkcode ReadableStream.from} and
1974
+ * {@linkcode ReadableStream.pipeTo}.
1975
+ *
1976
+ * **It is not guaranteed that the full buffer will be written in a single
1977
+ * call.**
1978
+ *
1979
+ * ```ts
1980
+ * const encoder = new TextEncoder();
1981
+ * const data = encoder.encode("Hello world");
1982
+ * using file = await Deno.open("/foo/bar.txt", { write: true });
1983
+ * const bytesWritten = await Deno.write(file.rid, data); // 11
1984
+ * ```
1985
+ *
1986
+ * @deprecated Use `writer.write()` instead. {@linkcode Deno.write} will be
1987
+ * removed in Deno 2.0.
1988
+ * @category I/O
1989
+ */
1990
+ export function write(rid: number, data: Uint8Array): Promise<number>;
1991
+ /**
1992
+ * Write `data` to the given `path`, by default creating a new file if
1993
+ * needed, else overwriting.
1994
+ *
1995
+ * ```ts
1996
+ * const encoder = new TextEncoder();
1997
+ * const data = encoder.encode("Hello world\n");
1998
+ * await Deno.writeFile("hello1.txt", data); // overwrite "hello1.txt" or create it
1999
+ * await Deno.writeFile("hello2.txt", data, { create: false }); // only works if "hello2.txt" exists
2000
+ * await Deno.writeFile("hello3.txt", data, { mode: 0o777 }); // set permissions on new file
2001
+ * await Deno.writeFile("hello4.txt", data, { append: true }); // add data to the end of the file
2002
+ * ```
2003
+ *
2004
+ * Requires `allow-write` permission, and `allow-read` if `options.create` is
2005
+ * `false`.
2006
+ *
2007
+ * @tags allow-read, allow-write
2008
+ * @category File System
2009
+ */
2010
+ export function writeFile(path: string | URL, data: Uint8Array | ReadableStream<Uint8Array>, options?: WriteFileOptions): Promise<void>;
2011
+ /**
2012
+ * Synchronously write `data` to the given `path`, by default creating a new
2013
+ * file if needed, else overwriting.
2014
+ *
2015
+ * ```ts
2016
+ * const encoder = new TextEncoder();
2017
+ * const data = encoder.encode("Hello world\n");
2018
+ * Deno.writeFileSync("hello1.txt", data); // overwrite "hello1.txt" or create it
2019
+ * Deno.writeFileSync("hello2.txt", data, { create: false }); // only works if "hello2.txt" exists
2020
+ * Deno.writeFileSync("hello3.txt", data, { mode: 0o777 }); // set permissions on new file
2021
+ * Deno.writeFileSync("hello4.txt", data, { append: true }); // add data to the end of the file
2022
+ * ```
2023
+ *
2024
+ * Requires `allow-write` permission, and `allow-read` if `options.create` is
2025
+ * `false`.
2026
+ *
2027
+ * @tags allow-read, allow-write
2028
+ * @category File System
2029
+ */
2030
+ export function writeFileSync(path: string | URL, data: Uint8Array, options?: WriteFileOptions): void;
2031
+ /**
2032
+ * Synchronously write to the resource ID (`rid`) the contents of the array
2033
+ * buffer (`data`).
2034
+ *
2035
+ * Returns the number of bytes written. This function is one of the lowest
2036
+ * level APIs and most users should not work with this directly, but rather
2037
+ * use {@linkcode WritableStream}, {@linkcode ReadableStream.from} and
2038
+ * {@linkcode ReadableStream.pipeTo}.
2039
+ *
2040
+ * **It is not guaranteed that the full buffer will be written in a single
2041
+ * call.**
2042
+ *
2043
+ * ```ts
2044
+ * const encoder = new TextEncoder();
2045
+ * const data = encoder.encode("Hello world");
2046
+ * using file = Deno.openSync("/foo/bar.txt", { write: true });
2047
+ * const bytesWritten = Deno.writeSync(file.rid, data); // 11
2048
+ * ```
2049
+ *
2050
+ * @deprecated Use `writer.writeSync()` instead. {@linkcode Deno.writeSync}
2051
+ * will be removed in Deno 2.0.
2052
+ * @category I/O
2053
+ */
2054
+ export function writeSync(rid: number, data: Uint8Array): number;
2055
+ /**
2056
+ * Write string `data` to the given `path`, by default creating a new file if
2057
+ * needed, else overwriting.
2058
+ *
2059
+ * ```ts
2060
+ * await Deno.writeTextFile("hello1.txt", "Hello world\n"); // overwrite "hello1.txt" or create it
2061
+ * ```
2062
+ *
2063
+ * Requires `allow-write` permission, and `allow-read` if `options.create` is
2064
+ * `false`.
2065
+ *
2066
+ * @tags allow-read, allow-write
2067
+ * @category File System
2068
+ */
2069
+ export function writeTextFile(path: string | URL, data: string | ReadableStream<string>, options?: WriteFileOptions): Promise<void>;
2070
+ /**
2071
+ * Synchronously write string `data` to the given `path`, by default creating
2072
+ * a new file if needed, else overwriting.
2073
+ *
2074
+ * ```ts
2075
+ * Deno.writeTextFileSync("hello1.txt", "Hello world\n"); // overwrite "hello1.txt" or create it
2076
+ * ```
2077
+ *
2078
+ * Requires `allow-write` permission, and `allow-read` if `options.create` is
2079
+ * `false`.
2080
+ *
2081
+ * @tags allow-read, allow-write
2082
+ * @category File System
2083
+ */
2084
+ export function writeTextFileSync(path: string | URL, data: string, options?: WriteFileOptions): void;
2085
+ /**
2086
+ * Returns the script arguments to the program.
2087
+ *
2088
+ * Give the following command line invocation of Deno:
2089
+ *
2090
+ * ```sh
2091
+ * deno run --allow-read https://examples.deno.land/command-line-arguments.ts Sushi
2092
+ * ```
2093
+ *
2094
+ * Then `Deno.args` will contain:
2095
+ *
2096
+ * ```ts
2097
+ * [ "Sushi" ]
2098
+ * ```
2099
+ *
2100
+ * If you are looking for a structured way to parse arguments, there is the
2101
+ * [`std/flags`](https://deno.land/std/flags) module as part of the Deno
2102
+ * standard library.
2103
+ *
2104
+ * @category Runtime Environment
2105
+ */
2106
+ export const args: string[];
2107
+ /**
2108
+ * Changes the access (`atime`) and modification (`mtime`) times of a file
2109
+ * stream resource referenced by `rid`. Given times are either in seconds
2110
+ * (UNIX epoch time) or as `Date` objects.
2111
+ *
2112
+ * ```ts
2113
+ * const file = await Deno.open("file.txt", { create: true, write: true });
2114
+ * await Deno.futime(file.rid, 1556495550, new Date());
2115
+ * ```
2116
+ *
2117
+ * @deprecated Use {@linkcode Deno.FsFile.utime} instead.
2118
+ * {@linkcode Deno.futime} will be removed in Deno 2.0.
2119
+ * @category File System
2120
+ */
2121
+ export function futime(rid: number, atime: number | Date, mtime: number | Date): Promise<void>;
2122
+ /**
2123
+ * Synchronously changes the access (`atime`) and modification (`mtime`) times
2124
+ * of a file stream resource referenced by `rid`. Given times are either in
2125
+ * seconds (UNIX epoch time) or as `Date` objects.
2126
+ *
2127
+ * ```ts
2128
+ * const file = Deno.openSync("file.txt", { create: true, write: true });
2129
+ * Deno.futimeSync(file.rid, 1556495550, new Date());
2130
+ * ```
2131
+ *
2132
+ * @deprecated Use {@linkcode Deno.FsFile.utimeSync} instead.
2133
+ * {@linkcode Deno.futimeSync} will be removed in Deno 2.0.
2134
+ * @category File System
2135
+ */
2136
+ export function futimeSync(rid: number, atime: number | Date, mtime: number | Date): void;
2137
+ /**
2138
+ * Changes the access (`atime`) and modification (`mtime`) times of a file
2139
+ * system object referenced by `path`. Given times are either in seconds
2140
+ * (UNIX epoch time) or as `Date` objects.
2141
+ *
2142
+ * ```ts
2143
+ * await Deno.utime("myfile.txt", 1556495550, new Date());
2144
+ * ```
2145
+ *
2146
+ * Requires `allow-write` permission.
2147
+ *
2148
+ * @tags allow-write
2149
+ * @category File System
2150
+ */
2151
+ export function utime(path: string | URL, atime: number | Date, mtime: number | Date): Promise<void>;
2152
+ /**
2153
+ * Synchronously changes the access (`atime`) and modification (`mtime`) times
2154
+ * of a file system object referenced by `path`. Given times are either in
2155
+ * seconds (UNIX epoch time) or as `Date` objects.
2156
+ *
2157
+ * ```ts
2158
+ * Deno.utimeSync("myfile.txt", 1556495550, new Date());
2159
+ * ```
2160
+ *
2161
+ * Requires `allow-write` permission.
2162
+ *
2163
+ * @tags allow-write
2164
+ * @category File System
2165
+ */
2166
+ export function utimeSync(path: string | URL, atime: number | Date, mtime: number | Date): void;
2167
+ /** @category Network */
2168
+ export type Addr = NetAddr | UnixAddr;
2169
+
2170
+ /**
2171
+ * An abstract interface which when implemented provides an interface to close
2172
+ * files/resources that were previously opened.
2173
+ *
2174
+ * @deprecated Use {@linkcode ReadableStream} and {@linkcode WritableStream}
2175
+ * instead. {@linkcode Closer} will be removed in v2.0.0.
2176
+ * @category I/O
2177
+ */
2178
+ export interface Closer {
2179
+ /** Closes the resource, "freeing" the backing file/resource. */
2180
+ close(): void;
2181
+ }
2182
+
2183
+ /** @category Network */
2184
+ export interface Conn extends Reader, Writer, Closer, Disposable {
2185
+ /** The local address of the connection. */
2186
+ readonly localAddr: Addr;
2187
+ /** The remote address of the connection. */
2188
+ readonly remoteAddr: Addr;
2189
+ /**
2190
+ * The resource ID of the connection.
2191
+ *
2192
+ * @deprecated Use {@linkcode Deno.Conn} instance methods instead.
2193
+ * {@linkcode Deno.Conn.rid} will be removed in Deno 2.0.
2194
+ */
2195
+ readonly rid: number;
2196
+ readonly readable: ReadableStream<Uint8Array>;
2197
+ readonly writable: WritableStream<Uint8Array>;
2198
+ /**
2199
+ * Shuts down (`shutdown(2)`) the write side of the connection. Most
2200
+ * callers should just use `close()`.
2201
+ */
2202
+ closeWrite(): Promise<void>;
2203
+ /**
2204
+ * Make the connection block the event loop from finishing.
2205
+ *
2206
+ * Note: the connection blocks the event loop from finishing by default.
2207
+ * This method is only meaningful after `.unref()` is called.
2208
+ */
2209
+ ref(): void;
2210
+ /** Make the connection not block the event loop from finishing. */
2211
+ unref(): void;
2212
+ }
2213
+
2214
+ /** @category Network */
2215
+ export interface ConnectOptions {
2216
+ /** The port to connect to. */
2217
+ port: number;
2218
+ /**
2219
+ * A literal IP address or host name that can be resolved to an IP address.
2220
+ * If not specified,
2221
+ *
2222
+ * @default {"127.0.0.1"}
2223
+ */
2224
+ hostname?: string;
2225
+ transport?: "tcp";
2226
+ }
2227
+
2228
+ /** @category Network */
2229
+ export interface ConnectTlsOptions {
2230
+ /** The port to connect to. */
2231
+ port: number;
2232
+ /**
2233
+ * A literal IP address or host name that can be resolved to an IP address.
2234
+ *
2235
+ * @default {"127.0.0.1"}
2236
+ */
2237
+ hostname?: string;
2238
+ /**
2239
+ * Server certificate file.
2240
+ *
2241
+ * @deprecated Pass the cert file contents directly to the
2242
+ * {@linkcode Deno.ConnectTlsOptions.caCerts} option instead. This option
2243
+ * will be removed in Deno 2.0.
2244
+ */
2245
+ certFile?: string;
2246
+ /**
2247
+ * A list of root certificates that will be used in addition to the
2248
+ * default root certificates to verify the peer's certificate.
2249
+ *
2250
+ * Must be in PEM format.
2251
+ */
2252
+ caCerts?: string[];
2253
+ /**
2254
+ * Application-Layer Protocol Negotiation (ALPN) protocols supported by
2255
+ * the client. If not specified, no ALPN extension will be included in the
2256
+ * TLS handshake.
2257
+ */
2258
+ alpnProtocols?: string[];
2259
+ /** PEM formatted client certificate chain. */
2260
+ certChain?: string;
2261
+ /** PEM formatted (RSA or PKCS8) private key of client certificate. */
2262
+ privateKey?: string;
2263
+ }
2264
+
2265
+ /** @category Testing */
2266
+ export interface DenoTest {
2267
+ /**
2268
+ * Register a test which will be run when `deno test` is used on the command
2269
+ * line and the containing module looks like a test module.
2270
+ *
2271
+ * `fn` can be async if required.
2272
+ *
2273
+ * ```ts
2274
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
2275
+ *
2276
+ * Deno.test({
2277
+ * name: "example test",
2278
+ * fn() {
2279
+ * assertEquals("world", "world");
2280
+ * },
2281
+ * });
2282
+ *
2283
+ * Deno.test({
2284
+ * name: "example ignored test",
2285
+ * ignore: Deno.build.os === "windows",
2286
+ * fn() {
2287
+ * // This test is ignored only on Windows machines
2288
+ * },
2289
+ * });
2290
+ *
2291
+ * Deno.test({
2292
+ * name: "example async test",
2293
+ * async fn() {
2294
+ * const decoder = new TextDecoder("utf-8");
2295
+ * const data = await Deno.readFile("hello_world.txt");
2296
+ * assertEquals(decoder.decode(data), "Hello world");
2297
+ * }
2298
+ * });
2299
+ * ```
2300
+ *
2301
+ * @category Testing
2302
+ */
2303
+ (t: TestDefinition): void;
2304
+ /**
2305
+ * Register a test which will be run when `deno test` is used on the command
2306
+ * line and the containing module looks like a test module.
2307
+ *
2308
+ * `fn` can be async if required.
2309
+ *
2310
+ * ```ts
2311
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
2312
+ *
2313
+ * Deno.test("My test description", () => {
2314
+ * assertEquals("hello", "hello");
2315
+ * });
2316
+ *
2317
+ * Deno.test("My async test description", async () => {
2318
+ * const decoder = new TextDecoder("utf-8");
2319
+ * const data = await Deno.readFile("hello_world.txt");
2320
+ * assertEquals(decoder.decode(data), "Hello world");
2321
+ * });
2322
+ * ```
2323
+ *
2324
+ * @category Testing
2325
+ */
2326
+ (name: string, fn: (t: TestContext) => void | Promise<void>): void;
2327
+ /**
2328
+ * Register a test which will be run when `deno test` is used on the command
2329
+ * line and the containing module looks like a test module.
2330
+ *
2331
+ * `fn` can be async if required. Declared function must have a name.
2332
+ *
2333
+ * ```ts
2334
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
2335
+ *
2336
+ * Deno.test(function myTestName() {
2337
+ * assertEquals("hello", "hello");
2338
+ * });
2339
+ *
2340
+ * Deno.test(async function myOtherTestName() {
2341
+ * const decoder = new TextDecoder("utf-8");
2342
+ * const data = await Deno.readFile("hello_world.txt");
2343
+ * assertEquals(decoder.decode(data), "Hello world");
2344
+ * });
2345
+ * ```
2346
+ *
2347
+ * @category Testing
2348
+ */
2349
+ (fn: (t: TestContext) => void | Promise<void>): void;
2350
+ /**
2351
+ * Register a test which will be run when `deno test` is used on the command
2352
+ * line and the containing module looks like a test module.
2353
+ *
2354
+ * `fn` can be async if required.
2355
+ *
2356
+ * ```ts
2357
+ * import {assert, fail, assertEquals} from "https://deno.land/std/assert/mod.ts";
2358
+ *
2359
+ * Deno.test("My test description", { permissions: { read: true } }, (): void => {
2360
+ * assertEquals("hello", "hello");
2361
+ * });
2362
+ *
2363
+ * Deno.test("My async test description", { permissions: { read: false } }, async (): Promise<void> => {
2364
+ * const decoder = new TextDecoder("utf-8");
2365
+ * const data = await Deno.readFile("hello_world.txt");
2366
+ * assertEquals(decoder.decode(data), "Hello world");
2367
+ * });
2368
+ * ```
2369
+ *
2370
+ * @category Testing
2371
+ */
2372
+ (name: string, options: Omit<TestDefinition, "fn" | "name">, fn: (t: TestContext) => void | Promise<void>): void;
2373
+ /**
2374
+ * Register a test which will be run when `deno test` is used on the command
2375
+ * line and the containing module looks like a test module.
2376
+ *
2377
+ * `fn` can be async if required.
2378
+ *
2379
+ * ```ts
2380
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
2381
+ *
2382
+ * Deno.test(
2383
+ * {
2384
+ * name: "My test description",
2385
+ * permissions: { read: true },
2386
+ * },
2387
+ * () => {
2388
+ * assertEquals("hello", "hello");
2389
+ * },
2390
+ * );
2391
+ *
2392
+ * Deno.test(
2393
+ * {
2394
+ * name: "My async test description",
2395
+ * permissions: { read: false },
2396
+ * },
2397
+ * async () => {
2398
+ * const decoder = new TextDecoder("utf-8");
2399
+ * const data = await Deno.readFile("hello_world.txt");
2400
+ * assertEquals(decoder.decode(data), "Hello world");
2401
+ * },
2402
+ * );
2403
+ * ```
2404
+ *
2405
+ * @category Testing
2406
+ */
2407
+ (options: Omit<TestDefinition, "fn" | "name">, fn: (t: TestContext) => void | Promise<void>): void;
2408
+ /**
2409
+ * Register a test which will be run when `deno test` is used on the command
2410
+ * line and the containing module looks like a test module.
2411
+ *
2412
+ * `fn` can be async if required. Declared function must have a name.
2413
+ *
2414
+ * ```ts
2415
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
2416
+ *
2417
+ * Deno.test(
2418
+ * { permissions: { read: true } },
2419
+ * function myTestName() {
2420
+ * assertEquals("hello", "hello");
2421
+ * },
2422
+ * );
2423
+ *
2424
+ * Deno.test(
2425
+ * { permissions: { read: false } },
2426
+ * async function myOtherTestName() {
2427
+ * const decoder = new TextDecoder("utf-8");
2428
+ * const data = await Deno.readFile("hello_world.txt");
2429
+ * assertEquals(decoder.decode(data), "Hello world");
2430
+ * },
2431
+ * );
2432
+ * ```
2433
+ *
2434
+ * @category Testing
2435
+ */
2436
+ (options: Omit<TestDefinition, "fn">, fn: (t: TestContext) => void | Promise<void>): void;
2437
+ /**
2438
+ * Shorthand property for ignoring a particular test case.
2439
+ *
2440
+ * @category Testing
2441
+ */
2442
+ ignore(t: Omit<TestDefinition, "ignore">): void;
2443
+ /**
2444
+ * Shorthand property for ignoring a particular test case.
2445
+ *
2446
+ * @category Testing
2447
+ */
2448
+ ignore(name: string, fn: (t: TestContext) => void | Promise<void>): void;
2449
+ /**
2450
+ * Shorthand property for ignoring a particular test case.
2451
+ *
2452
+ * @category Testing
2453
+ */
2454
+ ignore(fn: (t: TestContext) => void | Promise<void>): void;
2455
+ /**
2456
+ * Shorthand property for ignoring a particular test case.
2457
+ *
2458
+ * @category Testing
2459
+ */
2460
+ ignore(name: string, options: Omit<TestDefinition, "fn" | "name" | "ignore">, fn: (t: TestContext) => void | Promise<void>): void;
2461
+ /**
2462
+ * Shorthand property for ignoring a particular test case.
2463
+ *
2464
+ * @category Testing
2465
+ */
2466
+ ignore(options: Omit<TestDefinition, "fn" | "name" | "ignore">, fn: (t: TestContext) => void | Promise<void>): void;
2467
+ /**
2468
+ * Shorthand property for ignoring a particular test case.
2469
+ *
2470
+ * @category Testing
2471
+ */
2472
+ ignore(options: Omit<TestDefinition, "fn" | "ignore">, fn: (t: TestContext) => void | Promise<void>): void;
2473
+ /**
2474
+ * Shorthand property for focusing a particular test case.
2475
+ *
2476
+ * @category Testing
2477
+ */
2478
+ only(t: Omit<TestDefinition, "only">): void;
2479
+ /**
2480
+ * Shorthand property for focusing a particular test case.
2481
+ *
2482
+ * @category Testing
2483
+ */
2484
+ only(name: string, fn: (t: TestContext) => void | Promise<void>): void;
2485
+ /**
2486
+ * Shorthand property for focusing a particular test case.
2487
+ *
2488
+ * @category Testing
2489
+ */
2490
+ only(fn: (t: TestContext) => void | Promise<void>): void;
2491
+ /**
2492
+ * Shorthand property for focusing a particular test case.
2493
+ *
2494
+ * @category Testing
2495
+ */
2496
+ only(name: string, options: Omit<TestDefinition, "fn" | "name" | "only">, fn: (t: TestContext) => void | Promise<void>): void;
2497
+ /**
2498
+ * Shorthand property for focusing a particular test case.
2499
+ *
2500
+ * @category Testing
2501
+ */
2502
+ only(options: Omit<TestDefinition, "fn" | "name" | "only">, fn: (t: TestContext) => void | Promise<void>): void;
2503
+ /**
2504
+ * Shorthand property for focusing a particular test case.
2505
+ *
2506
+ * @category Testing
2507
+ */
2508
+ only(options: Omit<TestDefinition, "fn" | "only">, fn: (t: TestContext) => void | Promise<void>): void;
2509
+ }
2510
+
2511
+ /**
2512
+ * Information about a directory entry returned from {@linkcode Deno.readDir}
2513
+ * and {@linkcode Deno.readDirSync}.
2514
+ *
2515
+ * @category File System
2516
+ */
2517
+ export interface DirEntry {
2518
+ /**
2519
+ * The file name of the entry. It is just the entity name and does not
2520
+ * include the full path.
2521
+ */
2522
+ name: string;
2523
+ /**
2524
+ * True if this is info for a regular file. Mutually exclusive to
2525
+ * `DirEntry.isDirectory` and `DirEntry.isSymlink`.
2526
+ */
2527
+ isFile: boolean;
2528
+ /**
2529
+ * True if this is info for a regular directory. Mutually exclusive to
2530
+ * `DirEntry.isFile` and `DirEntry.isSymlink`.
2531
+ */
2532
+ isDirectory: boolean;
2533
+ /**
2534
+ * True if this is info for a symlink. Mutually exclusive to
2535
+ * `DirEntry.isFile` and `DirEntry.isDirectory`.
2536
+ */
2537
+ isSymlink: boolean;
2538
+ }
2539
+
2540
+ /**
2541
+ * The permission descriptor for the `allow-env` and `deny-env` permissions, which controls
2542
+ * access to being able to read and write to the process environment variables
2543
+ * as well as access other information about the environment. The option
2544
+ * `variable` allows scoping the permission to a specific environment
2545
+ * variable.
2546
+ *
2547
+ * @category Permissions
2548
+ */
2549
+ export interface EnvPermissionDescriptor {
2550
+ name: "env";
2551
+ /** Optional environment variable name (e.g. `PATH`). */
2552
+ variable?: string;
2553
+ }
2554
+
2555
+ /**
2556
+ * The permission descriptor for the `allow-ffi` and `deny-ffi` permissions, which controls
2557
+ * access to loading _foreign_ code and interfacing with it via the
2558
+ * [Foreign Function Interface API](https://deno.land/manual/runtime/ffi_api)
2559
+ * available in Deno. The option `path` allows scoping the permission to a
2560
+ * specific path on the host.
2561
+ *
2562
+ * @category Permissions
2563
+ */
2564
+ export interface FfiPermissionDescriptor {
2565
+ name: "ffi";
2566
+ /** Optional path on the local host to scope the permission to. */
2567
+ path?: string | URL;
2568
+ }
2569
+
2570
+ /**
2571
+ * The permission descriptor for the `allow-sys` and `deny-sys` permissions, which controls
2572
+ * access to sensitive host system information, which malicious code might
2573
+ * attempt to exploit. The option `kind` allows scoping the permission to a
2574
+ * specific piece of information.
2575
+ *
2576
+ * @category Permissions
2577
+ */
2578
+ export interface SysPermissionDescriptor {
2579
+ name: "sys";
2580
+ /** The specific information to scope the permission to. */
2581
+ kind?: | "loadavg"
2582
+ | "hostname"
2583
+ | "systemMemoryInfo"
2584
+ | "networkInterfaces"
2585
+ | "osRelease"
2586
+ | "osUptime"
2587
+ | "uid"
2588
+ | "gid";
2589
+ }
2590
+
2591
+ /**
2592
+ * An interface containing methods to interact with the process environment
2593
+ * variables.
2594
+ *
2595
+ * @tags allow-env
2596
+ * @category Runtime Environment
2597
+ */
2598
+ export interface Env {
2599
+ /**
2600
+ * Retrieve the value of an environment variable.
2601
+ *
2602
+ * Returns `undefined` if the supplied environment variable is not defined.
2603
+ *
2604
+ * ```ts
2605
+ * console.log(Deno.env.get("HOME")); // e.g. outputs "/home/alice"
2606
+ * console.log(Deno.env.get("MADE_UP_VAR")); // outputs "undefined"
2607
+ * ```
2608
+ *
2609
+ * Requires `allow-env` permission.
2610
+ *
2611
+ * @tags allow-env
2612
+ */
2613
+ get(key: string): string | undefined;
2614
+ /**
2615
+ * Set the value of an environment variable.
2616
+ *
2617
+ * ```ts
2618
+ * Deno.env.set("SOME_VAR", "Value");
2619
+ * Deno.env.get("SOME_VAR"); // outputs "Value"
2620
+ * ```
2621
+ *
2622
+ * Requires `allow-env` permission.
2623
+ *
2624
+ * @tags allow-env
2625
+ */
2626
+ set(key: string, value: string): void;
2627
+ /**
2628
+ * Delete the value of an environment variable.
2629
+ *
2630
+ * ```ts
2631
+ * Deno.env.set("SOME_VAR", "Value");
2632
+ * Deno.env.delete("SOME_VAR"); // outputs "undefined"
2633
+ * ```
2634
+ *
2635
+ * Requires `allow-env` permission.
2636
+ *
2637
+ * @tags allow-env
2638
+ */
2639
+ delete(key: string): void;
2640
+ /**
2641
+ * Check whether an environment variable is present or not.
2642
+ *
2643
+ * ```ts
2644
+ * Deno.env.set("SOME_VAR", "Value");
2645
+ * Deno.env.has("SOME_VAR"); // outputs true
2646
+ * ```
2647
+ *
2648
+ * Requires `allow-env` permission.
2649
+ *
2650
+ * @tags allow-env
2651
+ */
2652
+ has(key: string): boolean;
2653
+ /**
2654
+ * Returns a snapshot of the environment variables at invocation as a
2655
+ * simple object of keys and values.
2656
+ *
2657
+ * ```ts
2658
+ * Deno.env.set("TEST_VAR", "A");
2659
+ * const myEnv = Deno.env.toObject();
2660
+ * console.log(myEnv.SHELL);
2661
+ * Deno.env.set("TEST_VAR", "B");
2662
+ * console.log(myEnv.TEST_VAR); // outputs "A"
2663
+ * ```
2664
+ *
2665
+ * Requires `allow-env` permission.
2666
+ *
2667
+ * @tags allow-env
2668
+ */
2669
+ toObject(): { [index: string]: string };
2670
+ }
2671
+
2672
+ /**
2673
+ * Provides information about a file and is returned by
2674
+ * {@linkcode Deno.stat}, {@linkcode Deno.lstat}, {@linkcode Deno.statSync},
2675
+ * and {@linkcode Deno.lstatSync} or from calling `stat()` and `statSync()`
2676
+ * on an {@linkcode Deno.FsFile} instance.
2677
+ *
2678
+ * @category File System
2679
+ */
2680
+ export interface FileInfo {
2681
+ /**
2682
+ * True if this is info for a regular file. Mutually exclusive to
2683
+ * `FileInfo.isDirectory` and `FileInfo.isSymlink`.
2684
+ */
2685
+ isFile: boolean;
2686
+ /**
2687
+ * True if this is info for a regular directory. Mutually exclusive to
2688
+ * `FileInfo.isFile` and `FileInfo.isSymlink`.
2689
+ */
2690
+ isDirectory: boolean;
2691
+ /**
2692
+ * True if this is info for a symlink. Mutually exclusive to
2693
+ * `FileInfo.isFile` and `FileInfo.isDirectory`.
2694
+ */
2695
+ isSymlink: boolean;
2696
+ /** The size of the file, in bytes. */
2697
+ size: number;
2698
+ /**
2699
+ * The last modification time of the file. This corresponds to the `mtime`
2700
+ * field from `stat` on Linux/Mac OS and `ftLastWriteTime` on Windows. This
2701
+ * may not be available on all platforms.
2702
+ */
2703
+ mtime: Date | null;
2704
+ /**
2705
+ * The last access time of the file. This corresponds to the `atime`
2706
+ * field from `stat` on Unix and `ftLastAccessTime` on Windows. This may not
2707
+ * be available on all platforms.
2708
+ */
2709
+ atime: Date | null;
2710
+ /**
2711
+ * The creation time of the file. This corresponds to the `birthtime`
2712
+ * field from `stat` on Mac/BSD and `ftCreationTime` on Windows. This may
2713
+ * not be available on all platforms.
2714
+ */
2715
+ birthtime: Date | null;
2716
+ /** ID of the device containing the file. */
2717
+ dev: number;
2718
+ /**
2719
+ * Inode number.
2720
+ *
2721
+ * _Linux/Mac OS only._
2722
+ */
2723
+ ino: number | null;
2724
+ /**
2725
+ * The underlying raw `st_mode` bits that contain the standard Unix
2726
+ * permissions for this file/directory.
2727
+ *
2728
+ * _Linux/Mac OS only._
2729
+ */
2730
+ mode: number | null;
2731
+ /**
2732
+ * Number of hard links pointing to this file.
2733
+ *
2734
+ * _Linux/Mac OS only._
2735
+ */
2736
+ nlink: number | null;
2737
+ /**
2738
+ * User ID of the owner of this file.
2739
+ *
2740
+ * _Linux/Mac OS only._
2741
+ */
2742
+ uid: number | null;
2743
+ /**
2744
+ * Group ID of the owner of this file.
2745
+ *
2746
+ * _Linux/Mac OS only._
2747
+ */
2748
+ gid: number | null;
2749
+ /**
2750
+ * Device ID of this file.
2751
+ *
2752
+ * _Linux/Mac OS only._
2753
+ */
2754
+ rdev: number | null;
2755
+ /**
2756
+ * Blocksize for filesystem I/O.
2757
+ *
2758
+ * _Linux/Mac OS only._
2759
+ */
2760
+ blksize: number | null;
2761
+ /**
2762
+ * Number of blocks allocated to the file, in 512-byte units.
2763
+ *
2764
+ * _Linux/Mac OS only._
2765
+ */
2766
+ blocks: number | null;
2767
+ /**
2768
+ * True if this is info for a block device.
2769
+ *
2770
+ * _Linux/Mac OS only._
2771
+ */
2772
+ isBlockDevice: boolean | null;
2773
+ /**
2774
+ * True if this is info for a char device.
2775
+ *
2776
+ * _Linux/Mac OS only._
2777
+ */
2778
+ isCharDevice: boolean | null;
2779
+ /**
2780
+ * True if this is info for a fifo.
2781
+ *
2782
+ * _Linux/Mac OS only._
2783
+ */
2784
+ isFifo: boolean | null;
2785
+ /**
2786
+ * True if this is info for a socket.
2787
+ *
2788
+ * _Linux/Mac OS only._
2789
+ */
2790
+ isSocket: boolean | null;
2791
+ }
2792
+
2793
+ /**
2794
+ * Represents a unique file system event yielded by a
2795
+ * {@linkcode Deno.FsWatcher}.
2796
+ *
2797
+ * @category File System
2798
+ */
2799
+ export interface FsEvent {
2800
+ /** The kind/type of the file system event. */
2801
+ kind: "any" | "access" | "create" | "modify" | "remove" | "other";
2802
+ /** An array of paths that are associated with the file system event. */
2803
+ paths: string[];
2804
+ /** Any additional flags associated with the event. */
2805
+ flag?: FsEventFlag;
2806
+ }
2807
+
2808
+ /**
2809
+ * Additional information for FsEvent objects with the "other" kind.
2810
+ *
2811
+ * - `"rescan"`: rescan notices indicate either a lapse in the events or a
2812
+ * change in the filesystem such that events received so far can no longer
2813
+ * be relied on to represent the state of the filesystem now. An
2814
+ * application that simply reacts to file changes may not care about this.
2815
+ * An application that keeps an in-memory representation of the filesystem
2816
+ * will need to care, and will need to refresh that representation directly
2817
+ * from the filesystem.
2818
+ *
2819
+ * @category File System
2820
+ */
2821
+ export type FsEventFlag = "rescan";
2822
+
2823
+ /**
2824
+ * Returned by {@linkcode Deno.watchFs}. It is an async iterator yielding up
2825
+ * system events. To stop watching the file system by calling `.close()`
2826
+ * method.
2827
+ *
2828
+ * @category File System
2829
+ */
2830
+ export interface FsWatcher extends AsyncIterable<FsEvent>, Disposable {
2831
+ /**
2832
+ * The resource id.
2833
+ *
2834
+ * @deprecated Use {@linkcode Deno.FsWatcher} instance methods instead.
2835
+ * {@linkcode Deno.FsWatcher.rid} will be removed in Deno 2.0.
2836
+ */
2837
+ readonly rid: number;
2838
+ /** Stops watching the file system and closes the watcher resource. */
2839
+ close(): void;
2840
+ /**
2841
+ * Stops watching the file system and closes the watcher resource.
2842
+ *
2843
+ * @deprecated {@linkcode Deno.FsWatcher.return} will be removed in Deno 2.0.
2844
+ */
2845
+ return?(value?: any): Promise<IteratorResult<FsEvent>>;
2846
+ [Symbol.asyncIterator](): AsyncIterableIterator<FsEvent>;
2847
+ }
2848
+
2849
+ /**
2850
+ * The permission descriptor for the `allow-hrtime` and `deny-hrtime` permissions, which
2851
+ * controls if the runtime code has access to high resolution time. High
2852
+ * resolution time is considered sensitive information, because it can be used
2853
+ * by malicious code to gain information about the host that it might not
2854
+ * otherwise have access to.
2855
+ *
2856
+ * @category Permissions
2857
+ */
2858
+ export interface HrtimePermissionDescriptor {
2859
+ name: "hrtime";
2860
+ }
2861
+
2862
+ /**
2863
+ * Option which can be specified when performing {@linkcode Deno.inspect}.
2864
+ *
2865
+ * @category Console and Debugging
2866
+ */
2867
+ export interface InspectOptions {
2868
+ /**
2869
+ * Stylize output with ANSI colors.
2870
+ *
2871
+ * @default {false}
2872
+ */
2873
+ colors?: boolean;
2874
+ /**
2875
+ * Try to fit more than one entry of a collection on the same line.
2876
+ *
2877
+ * @default {true}
2878
+ */
2879
+ compact?: boolean;
2880
+ /**
2881
+ * Traversal depth for nested objects.
2882
+ *
2883
+ * @default {4}
2884
+ */
2885
+ depth?: number;
2886
+ /**
2887
+ * The maximum length for an inspection to take up a single line.
2888
+ *
2889
+ * @default {80}
2890
+ */
2891
+ breakLength?: number;
2892
+ /**
2893
+ * Whether or not to escape sequences.
2894
+ *
2895
+ * @default {true}
2896
+ */
2897
+ escapeSequences?: boolean;
2898
+ /**
2899
+ * The maximum number of iterable entries to print.
2900
+ *
2901
+ * @default {100}
2902
+ */
2903
+ iterableLimit?: number;
2904
+ /**
2905
+ * Show a Proxy's target and handler.
2906
+ *
2907
+ * @default {false}
2908
+ */
2909
+ showProxy?: boolean;
2910
+ /**
2911
+ * Sort Object, Set and Map entries by key.
2912
+ *
2913
+ * @default {false}
2914
+ */
2915
+ sorted?: boolean;
2916
+ /**
2917
+ * Add a trailing comma for multiline collections.
2918
+ *
2919
+ * @default {false}
2920
+ */
2921
+ trailingComma?: boolean;
2922
+ /**
2923
+ * Evaluate the result of calling getters.
2924
+ *
2925
+ * @default {false}
2926
+ */
2927
+ getters?: boolean;
2928
+ /**
2929
+ * Show an object's non-enumerable properties.
2930
+ *
2931
+ * @default {false}
2932
+ */
2933
+ showHidden?: boolean;
2934
+ /**
2935
+ * The maximum length of a string before it is truncated with an
2936
+ * ellipsis.
2937
+ */
2938
+ strAbbreviateSize?: number;
2939
+ }
2940
+
2941
+ /**
2942
+ * A generic network listener for stream-oriented protocols.
2943
+ *
2944
+ * @category Network
2945
+ */
2946
+ export interface Listener<T extends Conn = Conn> extends AsyncIterable<T>, Disposable {
2947
+ /** Return the address of the `Listener`. */
2948
+ readonly addr: Addr;
2949
+ /**
2950
+ * Return the rid of the `Listener`.
2951
+ *
2952
+ * @deprecated Use {@linkcode Deno.Listener} instance methods instead.
2953
+ * {@linkcode Deno.Listener.rid} will be removed in Deno 2.0.
2954
+ */
2955
+ readonly rid: number;
2956
+ /** Waits for and resolves to the next connection to the `Listener`. */
2957
+ accept(): Promise<T>;
2958
+ /**
2959
+ * Close closes the listener. Any pending accept promises will be rejected
2960
+ * with errors.
2961
+ */
2962
+ close(): void;
2963
+ [Symbol.asyncIterator](): AsyncIterableIterator<T>;
2964
+ /**
2965
+ * Make the listener block the event loop from finishing.
2966
+ *
2967
+ * Note: the listener blocks the event loop from finishing by default.
2968
+ * This method is only meaningful after `.unref()` is called.
2969
+ */
2970
+ ref(): void;
2971
+ /** Make the listener not block the event loop from finishing. */
2972
+ unref(): void;
2973
+ }
2974
+
2975
+ /** @category Network */
2976
+ export interface ListenOptions {
2977
+ /** The port to listen on. */
2978
+ port: number;
2979
+ /**
2980
+ * A literal IP address or host name that can be resolved to an IP address.
2981
+ *
2982
+ * __Note about `0.0.0.0`__ While listening `0.0.0.0` works on all platforms,
2983
+ * the browsers on Windows don't work with the address `0.0.0.0`.
2984
+ * You should show the message like `server running on localhost:8080` instead of
2985
+ * `server running on 0.0.0.0:8080` if your program supports Windows.
2986
+ *
2987
+ * @default {"0.0.0.0"}
2988
+ */
2989
+ hostname?: string;
2990
+ }
2991
+
2992
+ /** @category Network */
2993
+ export interface ListenTlsOptions extends TcpListenOptions {
2994
+ /** Server private key in PEM format */
2995
+ key?: string;
2996
+ /** Cert chain in PEM format */
2997
+ cert?: string;
2998
+ /**
2999
+ * Path to a file containing a PEM formatted CA certificate. Requires
3000
+ * `--allow-read`.
3001
+ *
3002
+ * @tags allow-read
3003
+ * @deprecated Pass the certificate file contents directly to the
3004
+ * {@linkcode Deno.ListenTlsOptions.cert} option instead. This option will
3005
+ * be removed in Deno 2.0.
3006
+ */
3007
+ certFile?: string;
3008
+ /**
3009
+ * Server private key file. Requires `--allow-read`.
3010
+ *
3011
+ * @tags allow-read
3012
+ * @deprecated Pass the key file contents directly to the
3013
+ * {@linkcode Deno.ListenTlsOptions.key} option instead. This option will
3014
+ * be removed in Deno 2.0.
3015
+ */
3016
+ keyFile?: string;
3017
+ transport?: "tcp";
3018
+ /**
3019
+ * Application-Layer Protocol Negotiation (ALPN) protocols to announce to
3020
+ * the client. If not specified, no ALPN extension will be included in the
3021
+ * TLS handshake.
3022
+ */
3023
+ alpnProtocols?: string[];
3024
+ }
3025
+
3026
+ /**
3027
+ * Options which can be set when using {@linkcode Deno.makeTempDir},
3028
+ * {@linkcode Deno.makeTempDirSync}, {@linkcode Deno.makeTempFile}, and
3029
+ * {@linkcode Deno.makeTempFileSync}.
3030
+ *
3031
+ * @category File System
3032
+ */
3033
+ export interface MakeTempOptions {
3034
+ /**
3035
+ * Directory where the temporary directory should be created (defaults to
3036
+ * the env variable `TMPDIR`, or the system's default, usually `/tmp`).
3037
+ *
3038
+ * Note that if the passed `dir` is relative, the path returned by
3039
+ * `makeTempFile()` and `makeTempDir()` will also be relative. Be mindful of
3040
+ * this when changing working directory.
3041
+ */
3042
+ dir?: string;
3043
+ /**
3044
+ * String that should precede the random portion of the temporary
3045
+ * directory's name.
3046
+ */
3047
+ prefix?: string;
3048
+ /**
3049
+ * String that should follow the random portion of the temporary
3050
+ * directory's name.
3051
+ */
3052
+ suffix?: string;
3053
+ }
3054
+
3055
+ /** @category Runtime Environment */
3056
+ export interface MemoryUsage {
3057
+ /**
3058
+ * The number of bytes of the current Deno's process resident set size,
3059
+ * which is the amount of memory occupied in main memory (RAM).
3060
+ */
3061
+ rss: number;
3062
+ /** The total size of the heap for V8, in bytes. */
3063
+ heapTotal: number;
3064
+ /** The amount of the heap used for V8, in bytes. */
3065
+ heapUsed: number;
3066
+ /**
3067
+ * Memory, in bytes, associated with JavaScript objects outside of the
3068
+ * JavaScript isolate.
3069
+ */
3070
+ external: number;
3071
+ }
3072
+
3073
+ /**
3074
+ * @category Observability
3075
+ * @deprecated {@linkcode Deno.metrics} will be removed in v2.0.0.
3076
+ */
3077
+ export interface Metrics extends OpMetrics {
3078
+ ops: Record<string, OpMetrics>;
3079
+ }
3080
+
3081
+ /**
3082
+ * Options which can be set when using {@linkcode Deno.mkdir} and
3083
+ * {@linkcode Deno.mkdirSync}.
3084
+ *
3085
+ * @category File System
3086
+ */
3087
+ export interface MkdirOptions {
3088
+ /**
3089
+ * If set to `true`, means that any intermediate directories will also be
3090
+ * created (as with the shell command `mkdir -p`).
3091
+ *
3092
+ * Intermediate directories are created with the same permissions.
3093
+ *
3094
+ * When recursive is set to `true`, succeeds silently (without changing any
3095
+ * permissions) if a directory already exists at the path, or if the path
3096
+ * is a symlink to an existing directory.
3097
+ *
3098
+ * @default {false}
3099
+ */
3100
+ recursive?: boolean;
3101
+ /**
3102
+ * Permissions to use when creating the directory (defaults to `0o777`,
3103
+ * before the process's umask).
3104
+ *
3105
+ * Ignored on Windows.
3106
+ */
3107
+ mode?: number;
3108
+ }
3109
+
3110
+ /** @category Network */
3111
+ export interface NetAddr {
3112
+ transport: "tcp" | "udp";
3113
+ hostname: string;
3114
+ port: number;
3115
+ }
3116
+
3117
+ /**
3118
+ * The permission descriptor for the `allow-net` and `deny-net` permissions, which controls
3119
+ * access to opening network ports and connecting to remote hosts via the
3120
+ * network. The option `host` allows scoping the permission for outbound
3121
+ * connection to a specific host and port.
3122
+ *
3123
+ * @category Permissions
3124
+ */
3125
+ export interface NetPermissionDescriptor {
3126
+ name: "net";
3127
+ /**
3128
+ * Optional host string of the form `"<hostname>[:<port>]"`. Examples:
3129
+ *
3130
+ * "github.com"
3131
+ * "deno.land:8080"
3132
+ */
3133
+ host?: string;
3134
+ }
3135
+
3136
+ /**
3137
+ * Options which can be set when doing {@linkcode Deno.open} and
3138
+ * {@linkcode Deno.openSync}.
3139
+ *
3140
+ * @category File System
3141
+ */
3142
+ export interface OpenOptions {
3143
+ /**
3144
+ * Sets the option for read access. This option, when `true`, means that
3145
+ * the file should be read-able if opened.
3146
+ *
3147
+ * @default {true}
3148
+ */
3149
+ read?: boolean;
3150
+ /**
3151
+ * Sets the option for write access. This option, when `true`, means that
3152
+ * the file should be write-able if opened. If the file already exists,
3153
+ * any write calls on it will overwrite its contents, by default without
3154
+ * truncating it.
3155
+ *
3156
+ * @default {false}
3157
+ */
3158
+ write?: boolean;
3159
+ /**
3160
+ * Sets the option for the append mode. This option, when `true`, means
3161
+ * that writes will append to a file instead of overwriting previous
3162
+ * contents.
3163
+ *
3164
+ * Note that setting `{ write: true, append: true }` has the same effect as
3165
+ * setting only `{ append: true }`.
3166
+ *
3167
+ * @default {false}
3168
+ */
3169
+ append?: boolean;
3170
+ /**
3171
+ * Sets the option for truncating a previous file. If a file is
3172
+ * successfully opened with this option set it will truncate the file to `0`
3173
+ * size if it already exists. The file must be opened with write access
3174
+ * for truncate to work.
3175
+ *
3176
+ * @default {false}
3177
+ */
3178
+ truncate?: boolean;
3179
+ /**
3180
+ * Sets the option to allow creating a new file, if one doesn't already
3181
+ * exist at the specified path. Requires write or append access to be
3182
+ * used.
3183
+ *
3184
+ * @default {false}
3185
+ */
3186
+ create?: boolean;
3187
+ /**
3188
+ * If set to `true`, no file, directory, or symlink is allowed to exist at
3189
+ * the target location. Requires write or append access to be used. When
3190
+ * createNew is set to `true`, create and truncate are ignored.
3191
+ *
3192
+ * @default {false}
3193
+ */
3194
+ createNew?: boolean;
3195
+ /**
3196
+ * Permissions to use if creating the file (defaults to `0o666`, before
3197
+ * the process's umask).
3198
+ *
3199
+ * Ignored on Windows.
3200
+ */
3201
+ mode?: number;
3202
+ }
3203
+
3204
+ /**
3205
+ * @category Observability
3206
+ * @deprecated {@linkcode Deno.metrics} will be removed in v2.0.0.
3207
+ */
3208
+ export interface OpMetrics {
3209
+ opsDispatched: number;
3210
+ opsDispatchedSync: number;
3211
+ opsDispatchedAsync: number;
3212
+ opsDispatchedAsyncUnref: number;
3213
+ opsCompleted: number;
3214
+ opsCompletedSync: number;
3215
+ opsCompletedAsync: number;
3216
+ opsCompletedAsyncUnref: number;
3217
+ bytesSentControl: number;
3218
+ bytesSentData: number;
3219
+ bytesReceived: number;
3220
+ }
3221
+
3222
+ /**
3223
+ * Permission descriptors which define a permission and can be queried,
3224
+ * requested, or revoked.
3225
+ *
3226
+ * View the specifics of the individual descriptors for more information about
3227
+ * each permission kind.
3228
+ *
3229
+ * @category Permissions
3230
+ */
3231
+ export type PermissionDescriptor = | RunPermissionDescriptor
3232
+ | ReadPermissionDescriptor
3233
+ | WritePermissionDescriptor
3234
+ | NetPermissionDescriptor
3235
+ | EnvPermissionDescriptor
3236
+ | SysPermissionDescriptor
3237
+ | FfiPermissionDescriptor
3238
+ | HrtimePermissionDescriptor;
3239
+ /**
3240
+ * The name of a privileged feature which needs permission.
3241
+ *
3242
+ * @category Permissions
3243
+ */
3244
+ export type PermissionName = | "run"
3245
+ | "read"
3246
+ | "write"
3247
+ | "net"
3248
+ | "env"
3249
+ | "sys"
3250
+ | "ffi"
3251
+ | "hrtime";
3252
+ /**
3253
+ * Options which define the permissions within a test or worker context.
3254
+ *
3255
+ * `"inherit"` ensures that all permissions of the parent process will be
3256
+ * applied to the test context. `"none"` ensures the test context has no
3257
+ * permissions. A `PermissionOptionsObject` provides a more specific
3258
+ * set of permissions to the test context.
3259
+ *
3260
+ * @category Permissions
3261
+ */
3262
+ export type PermissionOptions = | "inherit"
3263
+ | "none"
3264
+ | PermissionOptionsObject;
3265
+
3266
+ /**
3267
+ * A set of options which can define the permissions within a test or worker
3268
+ * context at a highly specific level.
3269
+ *
3270
+ * @category Permissions
3271
+ */
3272
+ export interface PermissionOptionsObject {
3273
+ /**
3274
+ * Specifies if the `env` permission should be requested or revoked.
3275
+ * If set to `"inherit"`, the current `env` permission will be inherited.
3276
+ * If set to `true`, the global `env` permission will be requested.
3277
+ * If set to `false`, the global `env` permission will be revoked.
3278
+ *
3279
+ * @default {false}
3280
+ */
3281
+ env?: "inherit" | boolean | string[];
3282
+ /**
3283
+ * Specifies if the `sys` permission should be requested or revoked.
3284
+ * If set to `"inherit"`, the current `sys` permission will be inherited.
3285
+ * If set to `true`, the global `sys` permission will be requested.
3286
+ * If set to `false`, the global `sys` permission will be revoked.
3287
+ *
3288
+ * @default {false}
3289
+ */
3290
+ sys?: "inherit" | boolean | string[];
3291
+ /**
3292
+ * Specifies if the `hrtime` permission should be requested or revoked.
3293
+ * If set to `"inherit"`, the current `hrtime` permission will be inherited.
3294
+ * If set to `true`, the global `hrtime` permission will be requested.
3295
+ * If set to `false`, the global `hrtime` permission will be revoked.
3296
+ *
3297
+ * @default {false}
3298
+ */
3299
+ hrtime?: "inherit" | boolean;
3300
+ /**
3301
+ * Specifies if the `net` permission should be requested or revoked.
3302
+ * if set to `"inherit"`, the current `net` permission will be inherited.
3303
+ * if set to `true`, the global `net` permission will be requested.
3304
+ * if set to `false`, the global `net` permission will be revoked.
3305
+ * if set to `string[]`, the `net` permission will be requested with the
3306
+ * specified host strings with the format `"<host>[:<port>]`.
3307
+ *
3308
+ * @default {false}
3309
+ *
3310
+ * Examples:
3311
+ *
3312
+ * ```ts
3313
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
3314
+ *
3315
+ * Deno.test({
3316
+ * name: "inherit",
3317
+ * permissions: {
3318
+ * net: "inherit",
3319
+ * },
3320
+ * async fn() {
3321
+ * const status = await Deno.permissions.query({ name: "net" })
3322
+ * assertEquals(status.state, "granted");
3323
+ * },
3324
+ * });
3325
+ * ```
3326
+ *
3327
+ * ```ts
3328
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
3329
+ *
3330
+ * Deno.test({
3331
+ * name: "true",
3332
+ * permissions: {
3333
+ * net: true,
3334
+ * },
3335
+ * async fn() {
3336
+ * const status = await Deno.permissions.query({ name: "net" });
3337
+ * assertEquals(status.state, "granted");
3338
+ * },
3339
+ * });
3340
+ * ```
3341
+ *
3342
+ * ```ts
3343
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
3344
+ *
3345
+ * Deno.test({
3346
+ * name: "false",
3347
+ * permissions: {
3348
+ * net: false,
3349
+ * },
3350
+ * async fn() {
3351
+ * const status = await Deno.permissions.query({ name: "net" });
3352
+ * assertEquals(status.state, "denied");
3353
+ * },
3354
+ * });
3355
+ * ```
3356
+ *
3357
+ * ```ts
3358
+ * import { assertEquals } from "https://deno.land/std/assert/mod.ts";
3359
+ *
3360
+ * Deno.test({
3361
+ * name: "localhost:8080",
3362
+ * permissions: {
3363
+ * net: ["localhost:8080"],
3364
+ * },
3365
+ * async fn() {
3366
+ * const status = await Deno.permissions.query({ name: "net", host: "localhost:8080" });
3367
+ * assertEquals(status.state, "granted");
3368
+ * },
3369
+ * });
3370
+ * ```
3371
+ */
3372
+ net?: "inherit" | boolean | string[];
3373
+ /**
3374
+ * Specifies if the `ffi` permission should be requested or revoked.
3375
+ * If set to `"inherit"`, the current `ffi` permission will be inherited.
3376
+ * If set to `true`, the global `ffi` permission will be requested.
3377
+ * If set to `false`, the global `ffi` permission will be revoked.
3378
+ *
3379
+ * @default {false}
3380
+ */
3381
+ ffi?: "inherit" | boolean | Array<string | URL>;
3382
+ /**
3383
+ * Specifies if the `read` permission should be requested or revoked.
3384
+ * If set to `"inherit"`, the current `read` permission will be inherited.
3385
+ * If set to `true`, the global `read` permission will be requested.
3386
+ * If set to `false`, the global `read` permission will be revoked.
3387
+ * If set to `Array<string | URL>`, the `read` permission will be requested with the
3388
+ * specified file paths.
3389
+ *
3390
+ * @default {false}
3391
+ */
3392
+ read?: "inherit" | boolean | Array<string | URL>;
3393
+ /**
3394
+ * Specifies if the `run` permission should be requested or revoked.
3395
+ * If set to `"inherit"`, the current `run` permission will be inherited.
3396
+ * If set to `true`, the global `run` permission will be requested.
3397
+ * If set to `false`, the global `run` permission will be revoked.
3398
+ *
3399
+ * @default {false}
3400
+ */
3401
+ run?: "inherit" | boolean | Array<string | URL>;
3402
+ /**
3403
+ * Specifies if the `write` permission should be requested or revoked.
3404
+ * If set to `"inherit"`, the current `write` permission will be inherited.
3405
+ * If set to `true`, the global `write` permission will be requested.
3406
+ * If set to `false`, the global `write` permission will be revoked.
3407
+ * If set to `Array<string | URL>`, the `write` permission will be requested with the
3408
+ * specified file paths.
3409
+ *
3410
+ * @default {false}
3411
+ */
3412
+ write?: "inherit" | boolean | Array<string | URL>;
3413
+ }
3414
+
3415
+ /**
3416
+ * The current status of the permission:
3417
+ *
3418
+ * - `"granted"` - the permission has been granted.
3419
+ * - `"denied"` - the permission has been explicitly denied.
3420
+ * - `"prompt"` - the permission has not explicitly granted nor denied.
3421
+ *
3422
+ * @category Permissions
3423
+ */
3424
+ export type PermissionState = | "granted"
3425
+ | "denied"
3426
+ | "prompt";
3427
+
3428
+ /**
3429
+ * The interface which defines what event types are supported by
3430
+ * {@linkcode PermissionStatus} instances.
3431
+ *
3432
+ * @category Permissions
3433
+ */
3434
+ export interface PermissionStatusEventMap {
3435
+ "change": Event;
3436
+ }
3437
+
3438
+ /**
3439
+ * The status resolved from the `.status()` method of a
3440
+ * {@linkcode Deno.Process} instance.
3441
+ *
3442
+ * If `success` is `true`, then `code` will be `0`, but if `success` is
3443
+ * `false`, the sub-process exit code will be set in `code`.
3444
+ *
3445
+ * @deprecated Use {@linkcode Deno.Command} instead. {@linkcode Deno.run}
3446
+ * will be removed in v2.0.0.
3447
+ * @category Sub Process
3448
+ */
3449
+ export type ProcessStatus = | {
3450
+ success: true;
3451
+ code: 0;
3452
+ signal?: undefined;
3453
+ }
3454
+ | {
3455
+ success: false;
3456
+ code: number;
3457
+ signal?: number;
3458
+ };
3459
+
3460
+ /**
3461
+ * An abstract interface which when implemented provides an interface to read
3462
+ * bytes into an array buffer asynchronously.
3463
+ *
3464
+ * @deprecated Use {@linkcode ReadableStream} instead. {@linkcode Reader}
3465
+ * will be removed in v2.0.0.
3466
+ * @category I/O
3467
+ */
3468
+ export interface Reader {
3469
+ /**
3470
+ * Reads up to `p.byteLength` bytes into `p`. It resolves to the number of
3471
+ * bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
3472
+ * encountered. Even if `read()` resolves to `n` < `p.byteLength`, it may
3473
+ * use all of `p` as scratch space during the call. If some data is
3474
+ * available but not `p.byteLength` bytes, `read()` conventionally resolves
3475
+ * to what is available instead of waiting for more.
3476
+ *
3477
+ * When `read()` encounters end-of-file condition, it resolves to EOF
3478
+ * (`null`).
3479
+ *
3480
+ * When `read()` encounters an error, it rejects with an error.
3481
+ *
3482
+ * Callers should always process the `n` > `0` bytes returned before
3483
+ * considering the EOF (`null`). Doing so correctly handles I/O errors that
3484
+ * happen after reading some bytes and also both of the allowed EOF
3485
+ * behaviors.
3486
+ *
3487
+ * Implementations should not retain a reference to `p`.
3488
+ *
3489
+ * Use
3490
+ * [`itereateReader`](https://deno.land/std/streams/iterate_reader.ts?s=iterateReader)
3491
+ * from
3492
+ * [`std/streams/iterate_reader.ts`](https://deno.land/std/streams/iterate_reader.ts)
3493
+ * to turn a `Reader` into an {@linkcode AsyncIterator}.
3494
+ */
3495
+ read(p: Uint8Array): Promise<number | null>;
3496
+ }
3497
+
3498
+ /**
3499
+ * An abstract interface which when implemented provides an interface to read
3500
+ * bytes into an array buffer synchronously.
3501
+ *
3502
+ * @deprecated Use {@linkcode ReadableStream} instead. {@linkcode ReaderSync}
3503
+ * will be removed in v2.0.0.
3504
+ * @category I/O
3505
+ */
3506
+ export interface ReaderSync {
3507
+ /**
3508
+ * Reads up to `p.byteLength` bytes into `p`. It resolves to the number
3509
+ * of bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
3510
+ * encountered. Even if `readSync()` returns `n` < `p.byteLength`, it may use
3511
+ * all of `p` as scratch space during the call. If some data is available
3512
+ * but not `p.byteLength` bytes, `readSync()` conventionally returns what is
3513
+ * available instead of waiting for more.
3514
+ *
3515
+ * When `readSync()` encounters end-of-file condition, it returns EOF
3516
+ * (`null`).
3517
+ *
3518
+ * When `readSync()` encounters an error, it throws with an error.
3519
+ *
3520
+ * Callers should always process the `n` > `0` bytes returned before
3521
+ * considering the EOF (`null`). Doing so correctly handles I/O errors that
3522
+ * happen after reading some bytes and also both of the allowed EOF
3523
+ * behaviors.
3524
+ *
3525
+ * Implementations should not retain a reference to `p`.
3526
+ *
3527
+ * Use
3528
+ * [`itereateReaderSync`](https://deno.land/std/streams/iterate_reader.ts?s=iterateReaderSync)
3529
+ * from from
3530
+ * [`std/streams/iterate_reader.ts`](https://deno.land/std/streams/iterate_reader.ts)
3531
+ * to turn a `ReaderSync` into an {@linkcode Iterator}.
3532
+ */
3533
+ readSync(p: Uint8Array): number | null;
3534
+ }
3535
+
3536
+ /**
3537
+ * Options which can be set when using {@linkcode Deno.readFile} or
3538
+ * {@linkcode Deno.readFileSync}.
3539
+ *
3540
+ * @category File System
3541
+ */
3542
+ export interface ReadFileOptions {
3543
+ /**
3544
+ * An abort signal to allow cancellation of the file read operation.
3545
+ * If the signal becomes aborted the readFile operation will be stopped
3546
+ * and the promise returned will be rejected with an AbortError.
3547
+ */
3548
+ signal?: AbortSignal;
3549
+ }
3550
+
3551
+ /**
3552
+ * The permission descriptor for the `allow-read` and `deny-read` permissions, which controls
3553
+ * access to reading resources from the local host. The option `path` allows
3554
+ * scoping the permission to a specific path (and if the path is a directory
3555
+ * any sub paths).
3556
+ *
3557
+ * Permission granted under `allow-read` only allows runtime code to attempt
3558
+ * to read, the underlying operating system may apply additional permissions.
3559
+ *
3560
+ * @category Permissions
3561
+ */
3562
+ export interface ReadPermissionDescriptor {
3563
+ name: "read";
3564
+ /**
3565
+ * An `allow-read` or `deny-read` permission can be scoped to a specific path (and if
3566
+ * the path is a directory, any sub paths).
3567
+ */
3568
+ path?: string | URL;
3569
+ }
3570
+
3571
+ /**
3572
+ * Options which can be set when using {@linkcode Deno.remove} and
3573
+ * {@linkcode Deno.removeSync}.
3574
+ *
3575
+ * @category File System
3576
+ */
3577
+ export interface RemoveOptions {
3578
+ /**
3579
+ * If set to `true`, path will be removed even if it's a non-empty directory.
3580
+ *
3581
+ * @default {false}
3582
+ */
3583
+ recursive?: boolean;
3584
+ }
3585
+
3586
+ /**
3587
+ * A map of open resources that Deno is tracking. The key is the resource ID
3588
+ * (_rid_) and the value is its representation.
3589
+ *
3590
+ * @deprecated {@linkcode Deno.resources} will be removed in Deno 2.0.
3591
+ * @category Observability
3592
+ */
3593
+ export interface ResourceMap {
3594
+ [rid: number]: unknown;
3595
+ }
3596
+
3597
+ /**
3598
+ * Options which can be used with {@linkcode Deno.run}.
3599
+ *
3600
+ * @deprecated Use {@linkcode Deno.Command} instead. {@linkcode Deno.run}
3601
+ * will be removed in v2.0.0.
3602
+ * @category Sub Process
3603
+ */
3604
+ export interface RunOptions {
3605
+ /**
3606
+ * Arguments to pass.
3607
+ *
3608
+ * _Note_: the first element needs to be a path to the executable that is
3609
+ * being run.
3610
+ */
3611
+ cmd: readonly string[] | [string | URL, ...string[]];
3612
+ /**
3613
+ * The current working directory that should be used when running the
3614
+ * sub-process.
3615
+ */
3616
+ cwd?: string;
3617
+ /** Any environment variables to be set when running the sub-process. */
3618
+ env?: Record<string, string>;
3619
+ /**
3620
+ * By default subprocess inherits `stdout` of parent process. To change
3621
+ * this this option can be set to a resource ID (_rid_) of an open file,
3622
+ * `"inherit"`, `"piped"`, or `"null"`:
3623
+ *
3624
+ * - _number_: the resource ID of an open file/resource. This allows you to
3625
+ * write to a file.
3626
+ * - `"inherit"`: The default if unspecified. The subprocess inherits from the
3627
+ * parent.
3628
+ * - `"piped"`: A new pipe should be arranged to connect the parent and child
3629
+ * sub-process.
3630
+ * - `"null"`: This stream will be ignored. This is the equivalent of attaching
3631
+ * the stream to `/dev/null`.
3632
+ */
3633
+ stdout?: "inherit" | "piped" | "null" | number;
3634
+ /**
3635
+ * By default subprocess inherits `stderr` of parent process. To change
3636
+ * this this option can be set to a resource ID (_rid_) of an open file,
3637
+ * `"inherit"`, `"piped"`, or `"null"`:
3638
+ *
3639
+ * - _number_: the resource ID of an open file/resource. This allows you to
3640
+ * write to a file.
3641
+ * - `"inherit"`: The default if unspecified. The subprocess inherits from the
3642
+ * parent.
3643
+ * - `"piped"`: A new pipe should be arranged to connect the parent and child
3644
+ * sub-process.
3645
+ * - `"null"`: This stream will be ignored. This is the equivalent of attaching
3646
+ * the stream to `/dev/null`.
3647
+ */
3648
+ stderr?: "inherit" | "piped" | "null" | number;
3649
+ /**
3650
+ * By default subprocess inherits `stdin` of parent process. To change
3651
+ * this this option can be set to a resource ID (_rid_) of an open file,
3652
+ * `"inherit"`, `"piped"`, or `"null"`:
3653
+ *
3654
+ * - _number_: the resource ID of an open file/resource. This allows you to
3655
+ * read from a file.
3656
+ * - `"inherit"`: The default if unspecified. The subprocess inherits from the
3657
+ * parent.
3658
+ * - `"piped"`: A new pipe should be arranged to connect the parent and child
3659
+ * sub-process.
3660
+ * - `"null"`: This stream will be ignored. This is the equivalent of attaching
3661
+ * the stream to `/dev/null`.
3662
+ */
3663
+ stdin?: "inherit" | "piped" | "null" | number;
3664
+ }
3665
+
3666
+ /**
3667
+ * The permission descriptor for the `allow-run` and `deny-run` permissions, which controls
3668
+ * access to what sub-processes can be executed by Deno. The option `command`
3669
+ * allows scoping the permission to a specific executable.
3670
+ *
3671
+ * **Warning, in practice, `allow-run` is effectively the same as `allow-all`
3672
+ * in the sense that malicious code could execute any arbitrary code on the
3673
+ * host.**
3674
+ *
3675
+ * @category Permissions
3676
+ */
3677
+ export interface RunPermissionDescriptor {
3678
+ name: "run";
3679
+ /**
3680
+ * An `allow-run` or `deny-run` permission can be scoped to a specific executable,
3681
+ * which would be relative to the start-up CWD of the Deno CLI.
3682
+ */
3683
+ command?: string | URL;
3684
+ }
3685
+
3686
+ /**
3687
+ * An abstract interface which when implemented provides an interface to seek
3688
+ * within an open file/resource asynchronously.
3689
+ *
3690
+ * @category I/O
3691
+ */
3692
+ export interface Seeker {
3693
+ /**
3694
+ * Seek sets the offset for the next `read()` or `write()` to offset,
3695
+ * interpreted according to `whence`: `Start` means relative to the
3696
+ * start of the file, `Current` means relative to the current offset,
3697
+ * and `End` means relative to the end. Seek resolves to the new offset
3698
+ * relative to the start of the file.
3699
+ *
3700
+ * Seeking to an offset before the start of the file is an error. Seeking to
3701
+ * any positive offset is legal, but the behavior of subsequent I/O
3702
+ * operations on the underlying object is implementation-dependent.
3703
+ *
3704
+ * It resolves with the updated offset.
3705
+ */
3706
+ seek(offset: number | bigint, whence: SeekMode): Promise<number>;
3707
+ }
3708
+
3709
+ /**
3710
+ * An abstract interface which when implemented provides an interface to seek
3711
+ * within an open file/resource synchronously.
3712
+ *
3713
+ * @category I/O
3714
+ */
3715
+ export interface SeekerSync {
3716
+ /**
3717
+ * Seek sets the offset for the next `readSync()` or `writeSync()` to
3718
+ * offset, interpreted according to `whence`: `Start` means relative
3719
+ * to the start of the file, `Current` means relative to the current
3720
+ * offset, and `End` means relative to the end.
3721
+ *
3722
+ * Seeking to an offset before the start of the file is an error. Seeking to
3723
+ * any positive offset is legal, but the behavior of subsequent I/O
3724
+ * operations on the underlying object is implementation-dependent.
3725
+ *
3726
+ * It returns the updated offset.
3727
+ */
3728
+ seekSync(offset: number | bigint, whence: SeekMode): number;
3729
+ }
3730
+
3731
+ /** @category I/O */
3732
+ export interface SetRawOptions {
3733
+ /**
3734
+ * The `cbreak` option can be used to indicate that characters that
3735
+ * correspond to a signal should still be generated. When disabling raw
3736
+ * mode, this option is ignored. This functionality currently only works on
3737
+ * Linux and Mac OS.
3738
+ */
3739
+ cbreak: boolean;
3740
+ }
3741
+
3742
+ /**
3743
+ * Operating signals which can be listened for or sent to sub-processes. What
3744
+ * signals and what their standard behaviors are OS dependent.
3745
+ *
3746
+ * @category Runtime Environment
3747
+ */
3748
+ export type Signal = | "SIGABRT"
3749
+ | "SIGALRM"
3750
+ | "SIGBREAK"
3751
+ | "SIGBUS"
3752
+ | "SIGCHLD"
3753
+ | "SIGCONT"
3754
+ | "SIGEMT"
3755
+ | "SIGFPE"
3756
+ | "SIGHUP"
3757
+ | "SIGILL"
3758
+ | "SIGINFO"
3759
+ | "SIGINT"
3760
+ | "SIGIO"
3761
+ | "SIGKILL"
3762
+ | "SIGPIPE"
3763
+ | "SIGPROF"
3764
+ | "SIGPWR"
3765
+ | "SIGQUIT"
3766
+ | "SIGSEGV"
3767
+ | "SIGSTKFLT"
3768
+ | "SIGSTOP"
3769
+ | "SIGSYS"
3770
+ | "SIGTERM"
3771
+ | "SIGTRAP"
3772
+ | "SIGTSTP"
3773
+ | "SIGTTIN"
3774
+ | "SIGTTOU"
3775
+ | "SIGURG"
3776
+ | "SIGUSR1"
3777
+ | "SIGUSR2"
3778
+ | "SIGVTALRM"
3779
+ | "SIGWINCH"
3780
+ | "SIGXCPU"
3781
+ | "SIGXFSZ";
3782
+
3783
+ /**
3784
+ * Options that can be used with {@linkcode symlink} and
3785
+ * {@linkcode symlinkSync}.
3786
+ *
3787
+ * @category File System
3788
+ */
3789
+ export interface SymlinkOptions {
3790
+ /**
3791
+ * If the symbolic link should be either a file or directory. This option
3792
+ * only applies to Windows and is ignored on other operating systems.
3793
+ */
3794
+ type: "file" | "dir";
3795
+ }
3796
+
3797
+ /** @category Testing */
3798
+ export interface TestDefinition {
3799
+ fn: (t: TestContext) => void | Promise<void>;
3800
+ /** The name of the test. */
3801
+ name: string;
3802
+ /**
3803
+ * If truthy the current test step will be ignored.
3804
+ *
3805
+ * It is a quick way to skip over a step, but also can be used for
3806
+ * conditional logic, like determining if an environment feature is present.
3807
+ */
3808
+ ignore?: boolean;
3809
+ /**
3810
+ * If at least one test has `only` set to `true`, only run tests that have
3811
+ * `only` set to `true` and fail the test suite.
3812
+ */
3813
+ only?: boolean;
3814
+ /**
3815
+ * Check that the number of async completed operations after the test step
3816
+ * is the same as number of dispatched operations. This ensures that the
3817
+ * code tested does not start async operations which it then does
3818
+ * not await. This helps in preventing logic errors and memory leaks
3819
+ * in the application code.
3820
+ *
3821
+ * @default {true}
3822
+ */
3823
+ sanitizeOps?: boolean;
3824
+ /**
3825
+ * Ensure the test step does not "leak" resources - like open files or
3826
+ * network connections - by ensuring the open resources at the start of the
3827
+ * test match the open resources at the end of the test.
3828
+ *
3829
+ * @default {true}
3830
+ */
3831
+ sanitizeResources?: boolean;
3832
+ /**
3833
+ * Ensure the test case does not prematurely cause the process to exit,
3834
+ * for example via a call to {@linkcode Deno.exit}.
3835
+ *
3836
+ * @default {true}
3837
+ */
3838
+ sanitizeExit?: boolean;
3839
+ /**
3840
+ * Specifies the permissions that should be used to run the test.
3841
+ *
3842
+ * Set this to "inherit" to keep the calling runtime permissions, set this
3843
+ * to "none" to revoke all permissions, or set a more specific set of
3844
+ * permissions using a {@linkcode PermissionOptionsObject}.
3845
+ *
3846
+ * @default {"inherit"}
3847
+ */
3848
+ permissions?: PermissionOptions;
3849
+ }
3850
+
3851
+ /** @category Testing */
3852
+ export interface TestStepDefinition {
3853
+ /**
3854
+ * The test function that will be tested when this step is executed. The
3855
+ * function can take an argument which will provide information about the
3856
+ * current step's context.
3857
+ */
3858
+ fn: (t: TestContext) => void | Promise<void>;
3859
+ /** The name of the step. */
3860
+ name: string;
3861
+ /**
3862
+ * If truthy the current test step will be ignored.
3863
+ *
3864
+ * This is a quick way to skip over a step, but also can be used for
3865
+ * conditional logic, like determining if an environment feature is present.
3866
+ */
3867
+ ignore?: boolean;
3868
+ /**
3869
+ * Check that the number of async completed operations after the test step
3870
+ * is the same as number of dispatched operations. This ensures that the
3871
+ * code tested does not start async operations which it then does
3872
+ * not await. This helps in preventing logic errors and memory leaks
3873
+ * in the application code.
3874
+ *
3875
+ * Defaults to the parent test or step's value.
3876
+ */
3877
+ sanitizeOps?: boolean;
3878
+ /**
3879
+ * Ensure the test step does not "leak" resources - like open files or
3880
+ * network connections - by ensuring the open resources at the start of the
3881
+ * step match the open resources at the end of the step.
3882
+ *
3883
+ * Defaults to the parent test or step's value.
3884
+ */
3885
+ sanitizeResources?: boolean;
3886
+ /**
3887
+ * Ensure the test step does not prematurely cause the process to exit,
3888
+ * for example via a call to {@linkcode Deno.exit}.
3889
+ *
3890
+ * Defaults to the parent test or step's value.
3891
+ */
3892
+ sanitizeExit?: boolean;
3893
+ }
3894
+
3895
+ /**
3896
+ * Context that is passed to a testing function, which can be used to either
3897
+ * gain information about the current test, or register additional test
3898
+ * steps within the current test.
3899
+ *
3900
+ * @category Testing
3901
+ */
3902
+ export interface TestContext {
3903
+ /** The current test name. */
3904
+ name: string;
3905
+ /** The string URL of the current test. */
3906
+ origin: string;
3907
+ /**
3908
+ * If the current test is a step of another test, the parent test context
3909
+ * will be set here.
3910
+ */
3911
+ parent?: TestContext;
3912
+ /**
3913
+ * Run a sub step of the parent test or step. Returns a promise
3914
+ * that resolves to a boolean signifying if the step completed successfully.
3915
+ *
3916
+ * The returned promise never rejects unless the arguments are invalid.
3917
+ *
3918
+ * If the test was ignored the promise returns `false`.
3919
+ *
3920
+ * ```ts
3921
+ * Deno.test({
3922
+ * name: "a parent test",
3923
+ * async fn(t) {
3924
+ * console.log("before the step");
3925
+ * await t.step({
3926
+ * name: "step 1",
3927
+ * fn(t) {
3928
+ * console.log("current step:", t.name);
3929
+ * }
3930
+ * });
3931
+ * console.log("after the step");
3932
+ * }
3933
+ * });
3934
+ * ```
3935
+ */
3936
+ step(definition: TestStepDefinition): Promise<boolean>;
3937
+ /**
3938
+ * Run a sub step of the parent test or step. Returns a promise
3939
+ * that resolves to a boolean signifying if the step completed successfully.
3940
+ *
3941
+ * The returned promise never rejects unless the arguments are invalid.
3942
+ *
3943
+ * If the test was ignored the promise returns `false`.
3944
+ *
3945
+ * ```ts
3946
+ * Deno.test(
3947
+ * "a parent test",
3948
+ * async (t) => {
3949
+ * console.log("before the step");
3950
+ * await t.step(
3951
+ * "step 1",
3952
+ * (t) => {
3953
+ * console.log("current step:", t.name);
3954
+ * }
3955
+ * );
3956
+ * console.log("after the step");
3957
+ * }
3958
+ * );
3959
+ * ```
3960
+ */
3961
+ step(name: string, fn: (t: TestContext) => void | Promise<void>): Promise<boolean>;
3962
+ /**
3963
+ * Run a sub step of the parent test or step. Returns a promise
3964
+ * that resolves to a boolean signifying if the step completed successfully.
3965
+ *
3966
+ * The returned promise never rejects unless the arguments are invalid.
3967
+ *
3968
+ * If the test was ignored the promise returns `false`.
3969
+ *
3970
+ * ```ts
3971
+ * Deno.test(async function aParentTest(t) {
3972
+ * console.log("before the step");
3973
+ * await t.step(function step1(t) {
3974
+ * console.log("current step:", t.name);
3975
+ * });
3976
+ * console.log("after the step");
3977
+ * });
3978
+ * ```
3979
+ */
3980
+ step(fn: (t: TestContext) => void | Promise<void>): Promise<boolean>;
3981
+ }
3982
+
3983
+ /** @category Network */
3984
+ export interface TcpConn extends Conn {
3985
+ /**
3986
+ * The resource ID of the connection.
3987
+ *
3988
+ * @deprecated Use {@linkcode Deno.Conn} instance methods instead.
3989
+ * {@linkcode Deno.Conn.rid} will be removed in Deno 2.0.
3990
+ */
3991
+ readonly rid: number;
3992
+ /**
3993
+ * Enable/disable the use of Nagle's algorithm.
3994
+ *
3995
+ * @param [noDelay=true]
3996
+ */
3997
+ setNoDelay(noDelay?: boolean): void;
3998
+ /** Enable/disable keep-alive functionality. */
3999
+ setKeepAlive(keepAlive?: boolean): void;
4000
+ }
4001
+
4002
+ /** @category Network */
4003
+ export interface TcpListenOptions extends ListenOptions {
4004
+ }
4005
+
4006
+ /** @category Network */
4007
+ export interface TcpListenOptions extends ListenOptions {
4008
+ /**
4009
+ * When `true` the SO_REUSEPORT flag will be set on the listener. This
4010
+ * allows multiple processes to listen on the same address and port.
4011
+ *
4012
+ * On Linux this will cause the kernel to distribute incoming connections
4013
+ * across the different processes that are listening on the same address and
4014
+ * port.
4015
+ *
4016
+ * This flag is only supported on Linux. It is silently ignored on other
4017
+ * platforms.
4018
+ *
4019
+ * @default {false}
4020
+ */
4021
+ reusePort?: boolean;
4022
+ }
4023
+
4024
+ /** @category Network */
4025
+ export interface TlsConn extends Conn {
4026
+ /**
4027
+ * The resource ID of the connection.
4028
+ *
4029
+ * @deprecated Use {@linkcode Deno.TlsConn} instance methods instead.
4030
+ * {@linkcode Deno.TlsConn.rid} will be removed in Deno 2.0.
4031
+ */
4032
+ readonly rid: number;
4033
+ /**
4034
+ * Runs the client or server handshake protocol to completion if that has
4035
+ * not happened yet. Calling this method is optional; the TLS handshake
4036
+ * will be completed automatically as soon as data is sent or received.
4037
+ */
4038
+ handshake(): Promise<TlsHandshakeInfo>;
4039
+ }
4040
+
4041
+ /** @category Network */
4042
+ export interface TlsHandshakeInfo {
4043
+ /**
4044
+ * Contains the ALPN protocol selected during negotiation with the server.
4045
+ * If no ALPN protocol selected, returns `null`.
4046
+ */
4047
+ alpnProtocol: string | null;
4048
+ }
4049
+
4050
+ /**
4051
+ * Specialized listener that accepts TLS connections.
4052
+ *
4053
+ * @category Network
4054
+ */
4055
+ export type TlsListener = Listener<TlsConn>;
4056
+
4057
+ /** @category Network */
4058
+ export interface UnixAddr {
4059
+ transport: "unix" | "unixpacket";
4060
+ path: string;
4061
+ }
4062
+
4063
+ /** @category Network */
4064
+ export interface UnixConn extends Conn {
4065
+ /**
4066
+ * The resource ID of the connection.
4067
+ *
4068
+ * @deprecated Use {@linkcode Deno.UnixConn} instance methods instead.
4069
+ * {@linkcode Deno.UnixConn.rid} will be removed in Deno 2.0.
4070
+ */
4071
+ readonly rid: number;
4072
+ }
4073
+
4074
+ /** @category Network */
4075
+ export interface UnixConnectOptions {
4076
+ transport: "unix";
4077
+ path: string;
4078
+ }
4079
+
4080
+ /**
4081
+ * Options which can be set when opening a Unix listener via
4082
+ * {@linkcode Deno.listen} or {@linkcode Deno.listenDatagram}.
4083
+ *
4084
+ * @category Network
4085
+ */
4086
+ export interface UnixListenOptions {
4087
+ /** A path to the Unix Socket. */
4088
+ path: string;
4089
+ }
4090
+
4091
+ /**
4092
+ * Options for writing to a file.
4093
+ *
4094
+ * @category File System
4095
+ */
4096
+ export interface WriteFileOptions {
4097
+ /**
4098
+ * If set to `true`, will append to a file instead of overwriting previous
4099
+ * contents.
4100
+ *
4101
+ * @default {false}
4102
+ */
4103
+ append?: boolean;
4104
+ /**
4105
+ * Sets the option to allow creating a new file, if one doesn't already
4106
+ * exist at the specified path.
4107
+ *
4108
+ * @default {true}
4109
+ */
4110
+ create?: boolean;
4111
+ /**
4112
+ * If set to `true`, no file, directory, or symlink is allowed to exist at
4113
+ * the target location. When createNew is set to `true`, `create` is ignored.
4114
+ *
4115
+ * @default {false}
4116
+ */
4117
+ createNew?: boolean;
4118
+ /** Permissions always applied to file. */
4119
+ mode?: number;
4120
+ /**
4121
+ * An abort signal to allow cancellation of the file write operation.
4122
+ *
4123
+ * If the signal becomes aborted the write file operation will be stopped
4124
+ * and the promise returned will be rejected with an {@linkcode AbortError}.
4125
+ */
4126
+ signal?: AbortSignal;
4127
+ }
4128
+
4129
+ /**
4130
+ * The permission descriptor for the `allow-write` and `deny-write` permissions, which
4131
+ * controls access to writing to resources from the local host. The option
4132
+ * `path` allow scoping the permission to a specific path (and if the path is
4133
+ * a directory any sub paths).
4134
+ *
4135
+ * Permission granted under `allow-write` only allows runtime code to attempt
4136
+ * to write, the underlying operating system may apply additional permissions.
4137
+ *
4138
+ * @category Permissions
4139
+ */
4140
+ export interface WritePermissionDescriptor {
4141
+ name: "write";
4142
+ /**
4143
+ * An `allow-write` or `deny-write` permission can be scoped to a specific path (and if
4144
+ * the path is a directory, any sub paths).
4145
+ */
4146
+ path?: string | URL;
4147
+ }
4148
+
4149
+ /**
4150
+ * An abstract interface which when implemented provides an interface to write
4151
+ * bytes from an array buffer to a file/resource asynchronously.
4152
+ *
4153
+ * @deprecated Use {@linkcode WritableStream} instead. {@linkcode Writer}
4154
+ * will be removed in v2.0.0.
4155
+ * @category I/O
4156
+ */
4157
+ export interface Writer {
4158
+ /**
4159
+ * Writes `p.byteLength` bytes from `p` to the underlying data stream. It
4160
+ * resolves to the number of bytes written from `p` (`0` <= `n` <=
4161
+ * `p.byteLength`) or reject with the error encountered that caused the
4162
+ * write to stop early. `write()` must reject with a non-null error if
4163
+ * would resolve to `n` < `p.byteLength`. `write()` must not modify the
4164
+ * slice data, even temporarily.
4165
+ *
4166
+ * This function is one of the lowest
4167
+ * level APIs and most users should not work with this directly, but rather use
4168
+ * [`writeAll()`](https://deno.land/std/streams/write_all.ts?s=writeAll) from
4169
+ * [`std/streams/write_all.ts`](https://deno.land/std/streams/write_all.ts)
4170
+ * instead.
4171
+ *
4172
+ * Implementations should not retain a reference to `p`.
4173
+ */
4174
+ write(p: Uint8Array): Promise<number>;
4175
+ }
4176
+
4177
+ /**
4178
+ * An abstract interface which when implemented provides an interface to write
4179
+ * bytes from an array buffer to a file/resource synchronously.
4180
+ *
4181
+ * @deprecated Use {@linkcode WritableStream} instead. {@linkcode WriterSync}
4182
+ * will be removed in v2.0.0.
4183
+ * @category I/O
4184
+ */
4185
+ export interface WriterSync {
4186
+ /**
4187
+ * Writes `p.byteLength` bytes from `p` to the underlying data
4188
+ * stream. It returns the number of bytes written from `p` (`0` <= `n`
4189
+ * <= `p.byteLength`) and any error encountered that caused the write to
4190
+ * stop early. `writeSync()` must throw a non-null error if it returns `n` <
4191
+ * `p.byteLength`. `writeSync()` must not modify the slice data, even
4192
+ * temporarily.
4193
+ *
4194
+ * Implementations should not retain a reference to `p`.
4195
+ */
4196
+ writeSync(p: Uint8Array): number;
4197
+ }
4198
+
4199
+ /**
4200
+ * If {@linkcode Deno.resolveDns} is called with `"CAA"` record type
4201
+ * specified, it will resolve with an array of objects with this interface.
4202
+ *
4203
+ * @category Network
4204
+ */
4205
+ export interface CAARecord {
4206
+ /**
4207
+ * If `true`, indicates that the corresponding property tag **must** be
4208
+ * understood if the semantics of the CAA record are to be correctly
4209
+ * interpreted by an issuer.
4210
+ *
4211
+ * Issuers **must not** issue certificates for a domain if the relevant CAA
4212
+ * Resource Record set contains unknown property tags that have `critical`
4213
+ * set.
4214
+ */
4215
+ critical: boolean;
4216
+ /**
4217
+ * An string that represents the identifier of the property represented by
4218
+ * the record.
4219
+ */
4220
+ tag: string;
4221
+ /** The value associated with the tag. */
4222
+ value: string;
4223
+ }
4224
+
4225
+ /**
4226
+ * If {@linkcode Deno.resolveDns} is called with `"MX"` record type
4227
+ * specified, it will return an array of objects with this interface.
4228
+ *
4229
+ * @category Network
4230
+ */
4231
+ export interface MXRecord {
4232
+ /**
4233
+ * A priority value, which is a relative value compared to the other
4234
+ * preferences of MX records for the domain.
4235
+ */
4236
+ preference: number;
4237
+ /** The server that mail should be delivered to. */
4238
+ exchange: string;
4239
+ }
4240
+
4241
+ /**
4242
+ * If {@linkcode Deno.resolveDns} is called with `"NAPTR"` record type
4243
+ * specified, it will return an array of objects with this interface.
4244
+ *
4245
+ * @category Network
4246
+ */
4247
+ export interface NAPTRRecord {
4248
+ order: number;
4249
+ preference: number;
4250
+ flags: string;
4251
+ services: string;
4252
+ regexp: string;
4253
+ replacement: string;
4254
+ }
4255
+
4256
+ /**
4257
+ * Options which can be set when using {@linkcode Deno.resolveDns}.
4258
+ *
4259
+ * @category Network
4260
+ */
4261
+ export interface ResolveDnsOptions {
4262
+ /**
4263
+ * The name server to be used for lookups.
4264
+ *
4265
+ * If not specified, defaults to the system configuration. For example
4266
+ * `/etc/resolv.conf` on Unix-like systems.
4267
+ */
4268
+ nameServer?: {
4269
+ /** The IP address of the name server. */
4270
+ ipAddr: string;
4271
+ /** The port number the query will be sent to.
4272
+ *
4273
+ * @default {53} */
4274
+ port?: number;
4275
+ };
4276
+ /**
4277
+ * An abort signal to allow cancellation of the DNS resolution operation.
4278
+ * If the signal becomes aborted the resolveDns operation will be stopped
4279
+ * and the promise returned will be rejected with an AbortError.
4280
+ */
4281
+ signal?: AbortSignal;
4282
+ }
4283
+
4284
+ /**
4285
+ * If {@linkcode Deno.resolveDns} is called with `"SOA"` record type
4286
+ * specified, it will return an array of objects with this interface.
4287
+ *
4288
+ * @category Network
4289
+ */
4290
+ export interface SOARecord {
4291
+ mname: string;
4292
+ rname: string;
4293
+ serial: number;
4294
+ refresh: number;
4295
+ retry: number;
4296
+ expire: number;
4297
+ minimum: number;
4298
+ }
4299
+
4300
+ /**
4301
+ * If {@linkcode Deno.resolveDns} is called with `"SRV"` record type
4302
+ * specified, it will return an array of objects with this interface.
4303
+ *
4304
+ * @category Network
4305
+ */
4306
+ export interface SRVRecord {
4307
+ priority: number;
4308
+ weight: number;
4309
+ port: number;
4310
+ target: string;
4311
+ }
4312
+
4313
+ /**
4314
+ * The type of the resource record to resolve via DNS using
4315
+ * {@linkcode Deno.resolveDns}.
4316
+ *
4317
+ * Only the listed types are supported currently.
4318
+ *
4319
+ * @category Network
4320
+ */
4321
+ export type RecordType = | "A"
4322
+ | "AAAA"
4323
+ | "ANAME"
4324
+ | "CAA"
4325
+ | "CNAME"
4326
+ | "MX"
4327
+ | "NAPTR"
4328
+ | "NS"
4329
+ | "PTR"
4330
+ | "SOA"
4331
+ | "SRV"
4332
+ | "TXT";
4333
+ /**
4334
+ * Information related to the build of the current Deno runtime.
4335
+ *
4336
+ * Users are discouraged from code branching based on this information, as
4337
+ * assumptions about what is available in what build environment might change
4338
+ * over time. Developers should specifically sniff out the features they
4339
+ * intend to use.
4340
+ *
4341
+ * The intended use for the information is for logging and debugging purposes.
4342
+ *
4343
+ * @category Runtime Environment
4344
+ */
4345
+ export const build: {
4346
+ /** The [LLVM](https://llvm.org/) target triple, which is the combination
4347
+ * of `${arch}-${vendor}-${os}` and represent the specific build target that
4348
+ * the current runtime was built for. */
4349
+ target: string;
4350
+ /** Instruction set architecture that the Deno CLI was built for. */
4351
+ arch: "x86_64" | "aarch64";
4352
+ /** The operating system that the Deno CLI was built for. `"darwin"` is
4353
+ * also known as OSX or MacOS. */
4354
+ os:
4355
+ | "darwin"
4356
+ | "linux"
4357
+ | "android"
4358
+ | "windows"
4359
+ | "freebsd"
4360
+ | "netbsd"
4361
+ | "aix"
4362
+ | "solaris"
4363
+ | "illumos";
4364
+ /** The computer vendor that the Deno CLI was built for. */
4365
+ vendor: string;
4366
+ /** Optional environment flags that were set for this build of Deno CLI. */
4367
+ env?: string;
4368
+ };
4369
+ export const customInspect: unique symbol;
4370
+ /**
4371
+ * An interface containing methods to interact with the process environment
4372
+ * variables.
4373
+ *
4374
+ * @tags allow-env
4375
+ * @category Runtime Environment
4376
+ */
4377
+ export const env: Env;
4378
+
4379
+ export namespace errors {
4380
+ export class AddrInUse extends Error {
4381
+ }
4382
+
4383
+ export class AddrNotAvailable extends Error {
4384
+ }
4385
+
4386
+ export class AlreadyExists extends Error {
4387
+ }
4388
+
4389
+ export class BadResource extends Error {
4390
+ }
4391
+
4392
+ export class BrokenPipe extends Error {
4393
+ }
4394
+
4395
+ export class Busy extends Error {
4396
+ }
4397
+
4398
+ export class ConnectionAborted extends Error {
4399
+ }
4400
+
4401
+ export class ConnectionRefused extends Error {
4402
+ }
4403
+
4404
+ export class ConnectionReset extends Error {
4405
+ }
4406
+
4407
+ export class Http extends Error {
4408
+ }
4409
+
4410
+ export class Interrupted extends Error {
4411
+ }
4412
+
4413
+ export class InvalidData extends Error {
4414
+ }
4415
+
4416
+ export class NotConnected extends Error {
4417
+ }
4418
+
4419
+ export class NotFound extends Error {
4420
+ code: string;
4421
+ }
4422
+
4423
+ export class PermissionDenied extends Error {
4424
+ }
4425
+
4426
+ export class TimedOut extends Error {
4427
+ }
4428
+
4429
+ export class UnexpectedEof extends Error {
4430
+ }
4431
+
4432
+ export class WriteZero extends Error {
4433
+ }
4434
+ }
4435
+
4436
+ /**
4437
+ * The URL of the entrypoint module entered from the command-line. It
4438
+ * requires read permission to the CWD.
4439
+ *
4440
+ * Also see {@linkcode ImportMeta} for other related information.
4441
+ *
4442
+ * @tags allow-read
4443
+ * @category Runtime Environment
4444
+ */
4445
+ export const mainModule: string;
4446
+ /**
4447
+ * Receive metrics from the privileged side of Deno. This is primarily used
4448
+ * in the development of Deno. _Ops_, also called _bindings_, are the
4449
+ * go-between between Deno JavaScript sandbox and the rest of Deno.
4450
+ *
4451
+ * ```shell
4452
+ * > console.table(Deno.metrics())
4453
+ * ┌─────────────────────────┬────────┐
4454
+ * │ (index) │ Values │
4455
+ * ├─────────────────────────┼────────┤
4456
+ * │ opsDispatched │ 3 │
4457
+ * │ opsDispatchedSync │ 2 │
4458
+ * │ opsDispatchedAsync │ 1 │
4459
+ * │ opsDispatchedAsyncUnref │ 0 │
4460
+ * │ opsCompleted │ 3 │
4461
+ * │ opsCompletedSync │ 2 │
4462
+ * │ opsCompletedAsync │ 1 │
4463
+ * │ opsCompletedAsyncUnref │ 0 │
4464
+ * │ bytesSentControl │ 73 │
4465
+ * │ bytesSentData │ 0 │
4466
+ * │ bytesReceived │ 375 │
4467
+ * └─────────────────────────┴────────┘
4468
+ * ```
4469
+ *
4470
+ * @category Observability
4471
+ * @deprecated {@linkcode Deno.metrics} will be removed in v2.0.0.
4472
+ */
4473
+ export function metrics(): Metrics;
4474
+ /**
4475
+ * Reflects the `NO_COLOR` environment variable at program start.
4476
+ *
4477
+ * When the value is `true`, the Deno CLI will attempt to not send color codes
4478
+ * to `stderr` or `stdout` and other command line programs should also attempt
4479
+ * to respect this value.
4480
+ *
4481
+ * See: https://no-color.org/
4482
+ *
4483
+ * @category Runtime Environment
4484
+ */
4485
+ export const noColor: boolean;
4486
+ /**
4487
+ * Deno's permission management API.
4488
+ *
4489
+ * It is a singleton instance of the {@linkcode Permissions} object and is
4490
+ * based on the web platform
4491
+ * [Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API),
4492
+ * though some proposed parts of the API which are useful in a server side
4493
+ * runtime context were removed or abandoned in the web platform specification
4494
+ * which is why it was chosen to locate it in the {@linkcode Deno} namespace
4495
+ * instead.
4496
+ *
4497
+ * By default, if the `stdin`/`stdout` is TTY for the Deno CLI (meaning it can
4498
+ * send and receive text), then the CLI will prompt the user to grant
4499
+ * permission when an un-granted permission is requested. This behavior can
4500
+ * be changed by using the `--no-prompt` command at startup. When prompting
4501
+ * the CLI will request the narrowest permission possible, potentially making
4502
+ * it annoying to the user. The permissions APIs allow the code author to
4503
+ * request a wider set of permissions at one time in order to provide a better
4504
+ * user experience.
4505
+ *
4506
+ * Requesting already granted permissions will not prompt the user and will
4507
+ * return that the permission was granted.
4508
+ *
4509
+ * ### Querying
4510
+ *
4511
+ * ```ts
4512
+ * const status = await Deno.permissions.query({ name: "read", path: "/etc" });
4513
+ * console.log(status.state);
4514
+ * ```
4515
+ *
4516
+ * ```ts
4517
+ * const status = Deno.permissions.querySync({ name: "read", path: "/etc" });
4518
+ * console.log(status.state);
4519
+ * ```
4520
+ *
4521
+ * ### Revoking
4522
+ *
4523
+ * ```ts
4524
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
4525
+ *
4526
+ * const status = await Deno.permissions.revoke({ name: "run" });
4527
+ * assert(status.state !== "granted")
4528
+ * ```
4529
+ *
4530
+ * ```ts
4531
+ * import { assert } from "https://deno.land/std/assert/mod.ts";
4532
+ *
4533
+ * const status = Deno.permissions.revokeSync({ name: "run" });
4534
+ * assert(status.state !== "granted")
4535
+ * ```
4536
+ *
4537
+ * ### Requesting
4538
+ *
4539
+ * ```ts
4540
+ * const status = await Deno.permissions.request({ name: "env" });
4541
+ * if (status.state === "granted") {
4542
+ * console.log("'env' permission is granted.");
4543
+ * } else {
4544
+ * console.log("'env' permission is denied.");
4545
+ * }
4546
+ * ```
4547
+ *
4548
+ * ```ts
4549
+ * const status = Deno.permissions.requestSync({ name: "env" });
4550
+ * if (status.state === "granted") {
4551
+ * console.log("'env' permission is granted.");
4552
+ * } else {
4553
+ * console.log("'env' permission is denied.");
4554
+ * }
4555
+ * ```
4556
+ *
4557
+ * @category Permissions
4558
+ */
4559
+ export const permissions: Permissions;
4560
+ /**
4561
+ * The current process ID of this instance of the Deno CLI.
4562
+ *
4563
+ * ```ts
4564
+ * console.log(Deno.pid);
4565
+ * ```
4566
+ *
4567
+ * @category Runtime Environment
4568
+ */
4569
+ export const pid: number;
4570
+ /**
4571
+ * The process ID of parent process of this instance of the Deno CLI.
4572
+ *
4573
+ * ```ts
4574
+ * console.log(Deno.ppid);
4575
+ * ```
4576
+ *
4577
+ * @category Runtime Environment
4578
+ */
4579
+ export const ppid: number;
4580
+ /**
4581
+ * Returns a map of open resource IDs (_rid_) along with their string
4582
+ * representations. This is an internal API and as such resource
4583
+ * representation has `unknown` type; that means it can change any time and
4584
+ * should not be depended upon.
4585
+ *
4586
+ * ```ts
4587
+ * console.log(Deno.resources());
4588
+ * // { 0: "stdin", 1: "stdout", 2: "stderr" }
4589
+ * Deno.openSync('../test.file');
4590
+ * console.log(Deno.resources());
4591
+ * // { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" }
4592
+ * ```
4593
+ *
4594
+ * @deprecated {@linkcode Deno.resources} will be removed in Deno 2.0.
4595
+ * @category Observability
4596
+ */
4597
+ export function resources(): ResourceMap;
4598
+ /**
4599
+ * Version information related to the current Deno CLI runtime environment.
4600
+ *
4601
+ * Users are discouraged from code branching based on this information, as
4602
+ * assumptions about what is available in what build environment might change
4603
+ * over time. Developers should specifically sniff out the features they
4604
+ * intend to use.
4605
+ *
4606
+ * The intended use for the information is for logging and debugging purposes.
4607
+ *
4608
+ * @category Runtime Environment
4609
+ */
4610
+ export const version: {
4611
+ /** Deno CLI's version. For example: `"1.26.0"`. */
4612
+ deno: string;
4613
+ /** The V8 version used by Deno. For example: `"10.7.100.0"`.
4614
+ *
4615
+ * V8 is the underlying JavaScript runtime platform that Deno is built on
4616
+ * top of. */
4617
+ v8: string;
4618
+ /** The TypeScript version used by Deno. For example: `"4.8.3"`.
4619
+ *
4620
+ * A version of the TypeScript type checker and language server is built-in
4621
+ * to the Deno CLI. */
4622
+ typescript: string;
4623
+ };
4624
+ /**
4625
+ * A reference to `stdin` which can be used to read directly from `stdin`.
4626
+ * It implements the Deno specific {@linkcode Reader}, {@linkcode ReaderSync},
4627
+ * and {@linkcode Closer} interfaces as well as provides a
4628
+ * {@linkcode ReadableStream} interface.
4629
+ *
4630
+ * ### Reading chunks from the readable stream
4631
+ *
4632
+ * ```ts
4633
+ * const decoder = new TextDecoder();
4634
+ * for await (const chunk of Deno.stdin.readable) {
4635
+ * const text = decoder.decode(chunk);
4636
+ * // do something with the text
4637
+ * }
4638
+ * ```
4639
+ *
4640
+ * @category I/O
4641
+ */
4642
+ export const stdin: Reader & ReaderSync & Closer & {
4643
+ /**
4644
+ * The resource ID assigned to `stdin`. This can be used with the discreet
4645
+ * I/O functions in the `Deno` namespace.
4646
+ *
4647
+ * @deprecated Use {@linkcode Deno.stdin} instance methods instead.
4648
+ * {@linkcode Deno.stdin.rid} will be removed in Deno 2.0.
4649
+ */
4650
+ readonly rid: number;
4651
+ /** A readable stream interface to `stdin`. */
4652
+ readonly readable: ReadableStream<Uint8Array>;
4653
+ /**
4654
+ * Set TTY to be under raw mode or not. In raw mode, characters are read and
4655
+ * returned as is, without being processed. All special processing of
4656
+ * characters by the terminal is disabled, including echoing input
4657
+ * characters. Reading from a TTY device in raw mode is faster than reading
4658
+ * from a TTY device in canonical mode.
4659
+ *
4660
+ * ```ts
4661
+ * Deno.stdin.setRaw(true, { cbreak: true });
4662
+ * ```
4663
+ *
4664
+ * @category I/O
4665
+ */
4666
+ setRaw(mode: boolean, options?: SetRawOptions): void;
4667
+ /**
4668
+ * Checks if `stdin` is a TTY (terminal).
4669
+ *
4670
+ * ```ts
4671
+ * // This example is system and context specific
4672
+ * Deno.stdin.isTerminal(); // true
4673
+ * ```
4674
+ *
4675
+ * @category I/O
4676
+ */
4677
+ isTerminal(): boolean;
4678
+ };
4679
+ /**
4680
+ * A reference to `stdout` which can be used to write directly to `stdout`.
4681
+ * It implements the Deno specific {@linkcode Writer}, {@linkcode WriterSync},
4682
+ * and {@linkcode Closer} interfaces as well as provides a
4683
+ * {@linkcode WritableStream} interface.
4684
+ *
4685
+ * These are low level constructs, and the {@linkcode console} interface is a
4686
+ * more straight forward way to interact with `stdout` and `stderr`.
4687
+ *
4688
+ * @category I/O
4689
+ */
4690
+ export const stdout: Writer & WriterSync & Closer & {
4691
+ /**
4692
+ * The resource ID assigned to `stdout`. This can be used with the discreet
4693
+ * I/O functions in the `Deno` namespace.
4694
+ *
4695
+ * @deprecated Use {@linkcode Deno.stdout} instance methods instead.
4696
+ * {@linkcode Deno.stdout.rid} will be removed in Deno 2.0.
4697
+ */
4698
+ readonly rid: number;
4699
+ /** A writable stream interface to `stdout`. */
4700
+ readonly writable: WritableStream<Uint8Array>;
4701
+ /**
4702
+ * Checks if `stdout` is a TTY (terminal).
4703
+ *
4704
+ * ```ts
4705
+ * // This example is system and context specific
4706
+ * Deno.stdout.isTerminal(); // true
4707
+ * ```
4708
+ *
4709
+ * @category I/O
4710
+ */
4711
+ isTerminal(): boolean;
4712
+ };
4713
+ /**
4714
+ * A reference to `stderr` which can be used to write directly to `stderr`.
4715
+ * It implements the Deno specific {@linkcode Writer}, {@linkcode WriterSync},
4716
+ * and {@linkcode Closer} interfaces as well as provides a
4717
+ * {@linkcode WritableStream} interface.
4718
+ *
4719
+ * These are low level constructs, and the {@linkcode console} interface is a
4720
+ * more straight forward way to interact with `stdout` and `stderr`.
4721
+ *
4722
+ * @category I/O
4723
+ */
4724
+ export const stderr: Writer & WriterSync & Closer & {
4725
+ /**
4726
+ * The resource ID assigned to `stderr`. This can be used with the discreet
4727
+ * I/O functions in the `Deno` namespace.
4728
+ *
4729
+ * @deprecated Use {@linkcode Deno.stderr} instance methods instead.
4730
+ * {@linkcode Deno.stderr.rid} will be removed in Deno 2.0.
4731
+ */
4732
+ readonly rid: number;
4733
+ /** A writable stream interface to `stderr`. */
4734
+ readonly writable: WritableStream<Uint8Array>;
4735
+ /**
4736
+ * Checks if `stderr` is a TTY (terminal).
4737
+ *
4738
+ * ```ts
4739
+ * // This example is system and context specific
4740
+ * Deno.stderr.isTerminal(); // true
4741
+ * ```
4742
+ *
4743
+ * @category I/O
4744
+ */
4745
+ isTerminal(): boolean;
4746
+ };
4747
+ }
4748
+
4749
+ declare module "@deno/shim-deno/test-internals" {
4750
+ type TestDefinition = Deno.TestDefinition;
4751
+ /** Reference to the array that `Deno.test` calls insert their definition into. */
4752
+ export const testDefinitions: TestDefinition[];
4753
+ }
4754
+
4755
+ declare global {
4756
+ interface SymbolConstructor {
4757
+ readonly asyncDispose: unique symbol;
4758
+ readonly dispose: unique symbol;
4759
+ }
4760
+ }
4761
+
4762
+ type MessagePort = typeof globalThis["MessagePort"];