To delete a directory that is not empty with Node, we install rimraf
.
To install it, we run
npm install rimraf
Then we write
rmdir = require("rimraf");
rmdir("some/directory/with/files", (error) => {});
to call rmdir
to remove the some/directory/with/files folder.
If there’s any error, then we get the error
from the callback.