nodejs fs delete non empty directory

JavaScript
fs.rmdirSync(dir, { recursive: true });var rimraf = require("rimraf");
rimraf("/some/directory", function () { console.log("done"); });
rimraf.sync("/some/directory");

Source

Also in JavaScript: