// npm install fs-extra const fsExtra = require('fs-extra'); const folder = './folder_name'; try { fsExtra.emptyDirSync(folder); } catch(e){ console.log("Error emptying folder!", e); }