Find all files matching a pattern (e.g. `**/*.ts`) recursively in a project without writing a custom directory walker.
Stream matches from a large directory tree one file at a time to avoid loading all paths into memory at once.
Filter search results by modification time or permissions using built-in file metadata without extra filesystem calls.
| isaacs/node-glob | buuing/lucky-canvas | howtographql/howtographql | |
|---|---|---|---|
| Stars | 8,713 | 8,710 | 8,718 |
| Language | TypeScript | TypeScript | TypeScript |
| Setup difficulty | easy | easy | easy |
| Complexity | 2/5 | 2/5 | 1/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
This is a Node.js library that lets your JavaScript or TypeScript code search for files using patterns instead of exact names. You give it something like **/.js and it returns every JavaScript file in the folder tree, or .{png,jpeg} to match multiple image types at once. It is published on npm simply as glob (not node-glob, which is a different, abandoned package). The pattern language it uses is the same one that Unix shells like Bash understand: * matches any string within a single folder, ** crosses folder boundaries, ? matches a single character, and curly braces let you list alternatives. This makes it straightforward to describe file searches that would otherwise require writing a custom recursive directory walker from scratch. The library gives you several ways to receive results. The main glob() function is async and returns a promise that resolves to a list of matching file paths. globSync() does the same thing but blocks until it finishes. If you have a large folder tree, globStream() hands back matches one at a time as a stream, so you do not have to wait for every result before you start processing. An iterator form is also available for looping through matches one by one in a for-await loop. Beyond plain file path strings, glob can return richer path objects that include metadata like file size, permissions, and modification time. This lets you sort results by when a file was last changed or filter by read/write mode without making extra calls to the filesystem yourself. Ignore rules can be defined with patterns or with custom functions, giving you fine-grained control over which files and folders are skipped during the search walk. The full README is longer than what was shown.
Node.js library for finding files using shell-style patterns like `**/*.js`, returns results as a promise, sync call, stream, or async iterator with optional file metadata.
Mainly TypeScript. The stack also includes TypeScript, Node.js, npm.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.