Dirtraverse
Traverse directory and call a callback with each file/folder. If callback return true for a folder, it's content will be skipped.
Example
const dirtraverse = require('@pkemp/dirtraverse');
dirtraverse.traverse('.', (err, filepath, stats) => {
console.log('Callback called with path: ', filepath);
return stats.isDirectory() && path.basename(filepath) === '.git' // return true if you want to skip traversal of a subfolder
});
See API docs for more information.
Thanks
- Typescript Starter by Jason Dreyzehner