nono
Version:
Nono is a scaffolding for mobile web single-page application develop, which based on command-line operations.
25 lines (19 loc) • 521 B
JavaScript
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs-extra'));
function deleteFolder(path) {
var files = [];
if (fs.existsSync(path)) {
files = fs.readdirSync(path);
files.forEach(function(file, index) {
var curPath = path + '/' + file;
if (fs.statSync(curPath).isDirectory()) { // recurse
deleteFolder(curPath);
} else {
// delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
module.exports = deleteFolder;