Remove Folder Node.js
Remove Folder Node.js
When we say about the remove a folder in Node.js, we can use fs.rmdir() or fs.rmdirSync() or fsPromises.rmdir() to remove folder. Below is the syntax and the code example:-
To remove a folder which has contents we can use fs.rm() with the option { recursive: true } to recursively remove the contents.
And { recursive: true, force: true } makes it so that exceptions will be ignored if the folder will not exists as per the below code.
 | |