the type of each match: a path, or a FileWithStats when FileHound.includeFileStats is set
the type of each match: a path, or a FileWithStats when FileHound.includeFileStats is set
Specify the directory search depth. If set to zero, recursive searching will be disabled. Directories at the limit are not searched, but are still returned when FileHound.type includes directories.
the maximum search depth (a non-negative integer)
the FileHound instance
Asynchronously executes a file search. Once called, the query is locked and can no longer be modified.
a signal to stop the search
a Promise of all matches. If the Promise fulfils, the fulfilment value is an array of all matching files
Synchronously executes a file search. Once called, the query is locked and can no longer be modified. No events are emitted.
an array of all matching files
Returns the paths that will be searched. When no depth is set, any path that is a subdirectory of another search path is removed, as it would otherwise be searched twice.
a copy of the search paths
Excludes hidden directories (names beginning with a dot), and their contents, from the search
the FileHound instance
Excludes symbolic links from the search. Linked files are not matched and linked directories are not searched.
the FileHound instance
Returns each match with its stats, as { path, stats }, in place of
its path. Stats already fetched by a predicate are reused.
the FileHound instance, typed to return FileWithStats matches
Asynchronously executes a file search, returning matches one at a time as they are found, in the same order as FileHound.find. Once called, the query is locked and can no longer be modified.
a signal to stop the search
an async iterator of matches
The search runs ahead of the loop by a bounded amount, so a large search can be read without holding every match in memory. Breaking out of the loop stops the search.
Emits a match event as each match is returned, an error event if the
search fails or is aborted and an end event when the search finishes:
when every match has been returned, the search fails or is aborted, or
the loop is left early.
Specifies the criteria that files must satisfy to be included in the results. Defaults to matching all files.
the predicate used to test each file
the FileHound instance
Defines the search paths: the directories to search. Duplicate paths are removed and each path is normalised. Defaults to the current working directory.
one or more directory paths
the FileHound instance
Defines the search paths from an array.
an array of paths
the FileHound instance
Skips directories by name: a directory whose name matches any of the
given names is neither searched nor returned. Use it to keep the search
out of directories such as node_modules, which a FileHound.match
predicate can only exclude from the results after searching them.
Calling it again replaces the names.
one or more directory names or globs
the FileHound instance
Each name is matched against a directory's name only, not its path,
following Node's path.matchesGlob.
A plain name, such as 'node_modules', matches exactly, and a glob, such
as 'build-*', matches any name it describes. Every directory below the
search paths is tested, including linked directories, but not the search
paths themselves.
Specifies the types of file system entry to return. Defaults to regular files only.
one or more file types
the FileHound instance
StaticanyExecutes one or more FileHound queries and combines their results
a Promise of all matches. If the Promise fulfils, the fulfilment value is an array of all files matched by any of the queries
Staticcreate
A fluent query for searching the file system.
Remarks
Configure a query by chaining methods, then run it with FileHound.find or FileHound.findSync. Once a search has started the query is locked and can no longer be modified.
Example