删除用户

This commit is contained in:
life
2015-11-20 00:07:04 +08:00
parent 3fd0da6810
commit d620c30298
5 changed files with 203 additions and 7 deletions

19
node_modules/common.js generated vendored
View File

@@ -272,6 +272,23 @@ var Common = {
md5sum.update(key);
str = md5sum.digest('hex');
return str;
}
},
// 删除文件夹
deleteFolderRecursive: function(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
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
},
};
module.exports = Common;