I have searched the Nodejs Doc,But don't find relative API.
So I write the following code to determine whether the directory is empty directory.
var fs = require('fs');
function isEmptyDir(dirnane){
try{
fs.rmdirSync(dirname)
}
catch(err){
return false;
}
fs.mkdirSync(dirname);
return true
}
QUESTION:it look like some troublesome,there is better way to do it with nodejs?