We are on the same fs module for the creating and deleting folders

we are going to use fs.mkdirSync to make new folder

I’m creating a new folder called song by writing fs.mkdirSync(‘song’)

Run it using node app.js
It created a new song folder on the dir

Now we are going to use fs.rmdirSync to delete the folder

We can delete dir by fs.rmdirSync(path) so we’ll try it

Run it using node app.js

So we created and deleted folder easily using fs.mkdirSync and fs.rmdirSync

Do you have any questions ?

Leave a Reply

Your email address will not be published. Required fields are marked *