Recursively walk directory trees. Think
There is a pull request to merge this project back into findit.
The pull request fixes every open issue in findit, and it completely rewrites the code from the ground up.
It also adds an additional feature regarding symlinks.
I would love for substack to merge the pull request, but realistically it might not happen, and this code is objectively cleaner, more robust, and fixes several critical issues.
I recommend depending on this module rather than the original findit. If the pull request is merged, however, I will add a deprecation notice to this module and happily hand the maintainer hat back to substack.
var finder = processargv2 || '.';var path = ;finder;finder;finder;
var findit =
Return an event emitter
finder that performs a recursive walk starting at
If you set
opts.followSymlinks, symlinks will be followed. Otherwise, a
'link' event will fire but symlinked directories will not be walked.
basedir is actually a non-directory regular file, findit emits a single
"file" event for it then emits "end".
You can optionally specify a custom
opts.fs should implement:
opts.fs.readlink(dir, cb)- optional if your stat objects from
opts.fs.lstatnever return true for
Stop the traversal. A
"stop" event will fire and then no more events will
For each file, directory, and symlink
file, this event fires.
linkPath will be defined when
was found via a symlink. In this situation,
linkPath is the path including
file is the resolved actual location on disk.
For each file, this event fires.
For each directory, this event fires with the path
Your callback may call
stop() on the first tick to tell findit to stop walking
the current directory.
For each symlink, this event fires.
Every time a symlink is read when
opts.followSymlinks is on, this event fires.
When the recursive walk is complete unless
finder.stop() was called, this
finder.stop() is called, this event fires.
Whenever there is an error, this event fires. You can choose to ignore errors or
stop the traversal using
You can always get the source of the error by checking
With npm do:
npm install findit2