Using the regex from this answer, this simple solution removes all hidden files from the result:
fs.readdir('/path/to/directory', (err, list) => {
list = list.filter(item => !(/(^|\/)\.[^\/\.]/g).test(item));
// Your code
});
Using the regex from this answer, this simple solution removes all hidden files from the result:
fs.readdir('/path/to/directory', (err, list) => {
list = list.filter(item => !(/(^|\/)\.[^\/\.]/g).test(item));
// Your code
});