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 ?
You can see the graphical version here
Originally it published on nerdjfpbblog. You can connect with me in twitter or linkedin !
You can read the old posts from here --
Top comments (0)