How can I count the number of files in a directory using nodejs with just plain JavaScript or packages? I want to do something like this:
nodejs
How to count the n
const readdir = (path) => { return new Promise((resolve, reject) => { fs.readdir(path, (error, files) => { error ? reject(error) : resolve(files); }); }); };s readdir("---path to directory---").then((files) => { console.log(files.length); });