Answer the question
In order to leave comments, you need to log in
How to find out the number of files in a directory in node.js?
How to find out the number of files in a directory in node.js?
Answer the question
In order to leave comments, you need to log in
const fs = require('fs');
const dir = './directory';
fs.readdir(dir, (err, files) => {
console.log(files.length);
});
const FileHound = require('filehound');
const a = FileHound.create()
.discard(discard)
.depth(depth)
.paths(path)
.ext(ext)
.find();
a.then(function(files){
console.log(files.length);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question