2.5.2 • Published 2 years ago

walk-filtered v2.5.2

Weekly downloads
4,504
License
MIT
Repository
github
Last release
2 years ago

walk-filtered

A simple, performant file system walker to provided fine-grained control over directories and files to walk. Supports Node 0.10 and above.

Note: This API is very robust for a variety of use cases as it passes the chokidar and readdirp test suites plus it does not accumulate results in memory.

Entries are of the format:

  • string: basename - file or directory name
  • string: path - realtive path from the directory to the file or directory
  • string: fullPath - full path to the file or directory
  • fs.Stats | fs.Dirent: stats - file, directory or symlink stats

Promise Filter Function

await walk(rootPath, async (entry) => { /* do something */ return true or false });

Callback Filter Function

walk(rootPath, function(entry, callback) { /* do something */ callback(null, true or false); }, {callbacks: true}, done);

Synchronous Filter Function

walk(rootPath, function(entry) { /* do something */ return true or false }, done);

Options:

  • number: depth - choose maximum depth of the tree to traverse. (default: Infinity)
  • function: filter - filter function to continue processing the tree. Return false to skip processing (default: process all)
  • bool: callbacks - use a filter function with a callback format like function(entry, callback). (default: false)
  • bool: alwaysStat - stat each file individually rather than fetching dirents when reading directories. (default: false)
  • bool: lstat - use lstat to get the link's stats instead of using stat on the file itself. (default: false)
  • function: error - custom error callback for expected filesystem errors ('ENOENT', 'EPERM', 'EACCES', 'ELOOP'). Return false to stop processing. (default: silent filsystem errors)
2.5.2

2 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.4

4 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.23.0

4 years ago

1.24.0

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.16.0

4 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.9.3

8 years ago

0.9.2

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.0

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago