
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
get-all-files
Advanced tools
A blazing fast recursive directory crawler with lazy sync and async iterator support.
$ npm i get-all-files
import { getAllFiles, getAllFilesSync } from 'get-all-files'
// Lazily iterate over filenames asynchronously
for await (const filename of getAllFiles(`path/to/dir/or/file`)) {
// Could break early on some condition and get-all-files
// won't have unnecessarily accumulated the filenames in an array
console.log(filename)
}
// Get array of filenames asynchronously
console.log(await getAllFiles(`path/to/dir/or/file`).toArray())
// Lazily iterate over filenames synchronously
for (const filename of getAllFilesSync(`path/to/dir/or/file`)) {
// Could break early on some condition and get-all-files
// won't have unnecessarily accumulated the filenames in an array
console.log(filename)
}
// Get array of filenames synchronously
console.log(getAllFilesSync(`path/to/dir/or/file`).toArray())
getAllFiles(path[, options])
Returns a lazy
async iterable/iterator
that asynchronously iterates over the file paths recursively found at path
in
no particular order.
Calling toArray
on the returned value returns a promise that resolves to an
array of the file paths.
getAllFilesSync(path[, options])
Returns a lazy
iterable/iterator
that iterates over the file paths recursively found at path
in no particular
order.
Calling toArray
on the returned value returns an array of the file paths.
path
Type: string
A path to a file or directory to recursively find files in.
options
Type: object
resolve
Type: boolean
Default: false
Whether to resolve paths to absolute paths (relative to process.cwd()
).
isExcludedDir
Type: (dirname: string) => boolean
Default: () => false
A predicate that determines whether the directory with the given dirname
should be crawled. There is no isExcludedFile
option because you can exclude
files by checking conditions while lazily iterating usinggetAllFiles.sync
or
getAllFiles.async
.
Stars are always welcome!
For bugs and feature requests, please create an issue.
FAQs
A blazing fast recursive directory crawler with lazy sync and async iterator support.
We found that get-all-files demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.