npm

@pkemp/dirtraverse
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

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

Package Sidebar

Install

npm i @pkemp/dirtraverse

Weekly Downloads

2

Version

1.0.12

License

MIT

Unpacked Size

22.9 kB

Total Files

15

Last publish

Collaborators

  • pkemp