Usuń dir nodejs
fs.rmdirSync(dir, { recursive: true });
Bloody Boar
fs.rmdirSync(dir, { recursive: true });
const fs = require('fs');
// directory path
const dir = 'temp';
// delete directory recursively
try {
fs.rmdirSync(dir, { recursive: true });
console.log(`${dir} is deleted!`);
} catch (err) {
console.error(`Error while deleting ${dir}.`);
}
const fs = require('fs');
fs.rmSync(folderPath, { recursive: true })
var rimraf = require("rimraf");
rimraf("/some/directory", function () { console.log("done"); });
fs.unlink('./node/myText.txt',function(){
fs.rmdir('node');
});
const fs = require('fs');
fs.rmSync('./folder-to-be-deleted', { recursive: true });