Deno is asynchronous JavaScript/TypeScript runtime. If you are not sure how and what’s of Deno, here is the links
- How to install Deno on Windows - Deno tutorial for beginners
- How to install Deno on Ubuntu Linux - Deno tutorial for beginners: how to install Deno on Windows
- Deno : next generation Node - About Deno TypeScript Runtime
Read a text file
Deno API allows developers to read files using readTextFile() which return a promise. A promise is similar to future in flutter, the result of the job will come in as a future.
You know that Deno is async by default, in the async world program continue working without interrupting other jobs.
const text = Deno.readTextFile("./data.json"); text.then((response) => console.log(response));
Here the text constant will return the resulted content in this operation.
To run this script yo may allow deno to use –allow-read permission.
deno run --allow-read maint.ts
All of my Deno projects will be published on my GitHub Repo, so keep watching.