Text file in Deno
Devmnj • Wed Nov 02 2022
0 min read
Posted Under :
null
Deno is asynchronous JavaScript/TypeScript runtime, a super upgrade to Nodejs which is meant to develop server side and client side apps.
How about a text file in Deno ?
In flutter, the result of the job will come in future.
You know that Deno is async by default, in the async world program continue working without interrupting other jobs.
Source code
const write = Deno.writeTextFile("./hello.txt", "Hello World!");
write.then(() => console.log("File written to ./hello.txt"));
Here the write constant will return result / only if the operation is succeeded.
To run this script yo may allow deno to use --allow-write permission.
Source code
deno run --allow-write maint.ts
All of my Deno projects will be published on my GitHub Repo, so keep watching.