Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

How to Delete File with Deno

Delete file with Deno

In this tutorial, you will learn how to delete a file in Deno. And Deleting directories using Deno’s built-in functions.

For deleting a file or a directory using any of the functions below, you need to add the --allow-write flag.

Examples to delete files using Deno.

// async
await Deno.remove("./file.txt");
// sync

Examples to delete directories using Deno.

// delete empty folder
await Deno.remove("./dir_name");
// delete non-empty folder
await Deno.remove("./dir_name", { recursive: true });
// delete empty folder sync
// delete non-empty folder sync
Deno.removeSync("./dir_name", { recursive: true });

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments