nodejs get list of files code example
Example 1: get all from dir node
const getAllFromDir = source =>
fs.readdirSync(source).map(name => path.join(source, name));
console.log(getDirectories("C:/"));
Example 2: how to get file name in directory node js
const path = require('path')
//...
//inside the `for` loop
const stat = fs.lstatSync(path.join(dir, file))