Text file in Deno

How to create a text file in deno

Sat Jun 19 2021

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.

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.

deno run --allow-write maint.ts

All of my Deno projects will be published on my GitHub Repo, so keep watching.

Comments