function (dir) {
    var files = fs.readdirSync(dir);

    // Get all file stats in parallel.
    var paths = _.map(files, function (file) { return path.join(dir, file); });
    var stats = _.map(paths, function (path) { return fs.statSync(path); });

    // Count the files.
    return _.filter(stats, function (stat) { return stat.isFile(); }).length;
}
function (dir) {
    var files = fs.readdirSync(dir);

    
    var paths = _.map(files, function (file) { return path.join(dir, file); });
    var stats = _.map(paths, function (path) { return fs.statSync(path); });

    
    return _.filter(stats, function (stat) { return stat.isFile(); }).length;
}
function ( dir ) { var files = fs . readdirSync ( dir ) ; // Get all file stats in parallel. var paths = _ . map ( files , function ( file ) { return path . join ( dir , file ) ; } ) ; var stats = _ . map ( paths , function ( path ) { return fs . statSync ( path ) ; } ) ; // Count the files. return _ . filter ( stats , function ( stat ) { return stat . isFile ( ) ; } ) . length ; }
Returns the number of files in the given directory.
Returns the number of files in the given directory .