Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to empty a folder in Node.js

// 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); 
}
 
PREVIOUS NEXT
Tagged: #How #empty #folder
ADD COMMENT
Topic
Name
8+6 =