I am using Node.js
.
I want to check if folder is empty or not? One option is to use fs.readdir but it loads whole bunch of
Just like to add that there's a node module extfs which can be used to check if a directory is empty using the function isEmpty() as shown by the code snippet below:
var fs = require('extfs');
fs.isEmpty('/home/myFolder', function (empty) {
console.log(empty);
});
Check out the link for documentation regarding the synchronous version of this function.