Recursively crawls a folder and returns a list of relative filenames. Iteration is flat and do not use recursive function.
There are few ways to use
crawl-fs. Following examples assume the folder structure looks like this:
./folder-to-crawl/abc.txt ./folder-to-crawl/def/ ./folder-to-crawl/def/ghi.txt ./folder-to-crawl/xyz/
We only returns files, empty folders are not included in result. Filenames are always relative to the base path, which relative to
process.cwd(), specified in the function call.
Default returns an array
Returns a Promise with an iterator
If applicable, this approach is preferred as it is progressive and requires less memory.
let numCalled = 0;;
If you think these design considerations are not valid, please challenge us.
- We did not use Promise progression, instead, we prefer iterator pattern with Promise resolver as finisher
- Bluebird also discourage progression
- We did not implement ES6 generator
- Our iterator is async, ES6 sync generator has no real benefits over array, in terms of time/space complexity
- 0.0.1 (2016-02-13) - Initial commit
- When async generator is official in ES7, we should add new
Want to contribute? There are few easy ways: