# glob — card for AI agents

Correct and fast file pattern matching for file system operations.

Category: Utilities · npm package `glob` · latest version 14.0.3 (checked 2026-11-01)
Install: `npm install glob`
License: BlueOak-1.0.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Agent Skills for it
- glob from openakita/openakita: `npx skills add openakita/openakita --skill glob`

## Numbers (AgentGid data)
- Gid Score: 74.1 (#230 of all tools, 17 of 408 in its category)
- Used in 122 public projects set up for AI coding agents (1.9%)
- Downloads last week: 556,924,992 (as of 2026-11-24), +38.5% over 4 weeks
- GitHub stars: 8,711 (as of 2026-11-24)
- Last push: 2026-11-20

## Often used with
tsx 50.0%, Husky 39.3%, TypeScript 86.9%, lint-staged 32.0%, Express 30.3%, Prettier 49.2%

## Links
- AgentGid page: https://agentgid.com/tools/glob/
- Homepage: https://github.com/isaacs/node-glob#readme
- Repository: https://github.com/isaacs/node-glob


## glob: find files by pattern in Node.js

glob is a free Node.js library that finds files on disk by a pattern, like every .js file under src or all images in two folders. Your script gets back a plain list of file paths to read, copy, check or delete. It uses the same wildcards as the command line.

### Where to use it
- Collect your project's source files: A build or check script gathers every JavaScript file in the project but stays out of the huge folder of installed packages.
- Gather images from several folders: A script that resizes or uploads pictures picks every png and jpeg from the css and public folders in one call.
- Build pages from Markdown posts: A small static site generator lists every Markdown post in the content folder and turns each into a page. (idea, not from the official pages)
- Stop a search that takes too long: On a big drive or network share, give the search a time limit so a slow folder cannot hang your tool.
- Include hidden config files: A backup or packaging script also picks up files like .env or .eslintrc that a plain pattern skips.
- Clean up generated files: Before a fresh build, list old reports or temporary files by pattern and delete them in one pass. (idea, not from the official pages)

### How to start
- Install the package named glob (not node-glob, which is a different, abandoned package).

```
npm i glob
```

- Import the functions by name and await the list of matches.

```
// load using import
import { glob, globSync, globStream, globStreamSync, Glob } from 'glob'

// all js files, but don't look in node_modules
const jsfiles = await glob('**/*.js', { ignore: 'node_modules/**' })
```

- Need it on the command line? The command moved to its own package in version 13.

```
npm install glob-bin
```


### License
Free to use, also in paid products, under the Blue Oak Model License. If you hand copies of glob's own files to others, include its license text or a link to it.

### Good to know
- Patterns must use forward slashes, even on Windows. A backslash in a pattern means 'treat the next character literally', not 'folder'.
- Results come back in no fixed order, so sort them if the order matters.
- On macOS and Windows matching ignores letter case by default; on Linux it does not, so the same pattern can find different files.
- Version 14 matches patterns without building regular expressions, so a crafted pattern cannot freeze your server.
- Old major versions get no fixes; the package marks them as unsupported.

Checked 2026-11-10 against: https://github.com/isaacs/node-glob/blob/main/README.md, https://github.com/isaacs/node-glob/blob/main/changelog.md, https://github.com/isaacs/node-glob/blob/main/LICENSE.md, https://github.com/isaacs/node-glob, https://isaacs.github.io/node-glob/, https://registry.npmjs.org/glob, https://registry.npmjs.org/glob/14.0.4

### Mistakes to avoid
- Don't: glob('**/*.js', (err, files) => ...) or import glob from 'glob', copied from answers written for glob 7 → Do: const { glob, globSync } = require('glob') (or import { glob } from 'glob'), then await glob(pattern) (Version 9 moved to promises and named exports; the ESM build has no default export (our run: typeof default was undefined).)
- Don't: glob('**/*.js') in a project root → Do: glob('**/*.js', { ignore: 'node_modules/**' }) (Nothing is skipped by default; our demo returned node_modules/left-pad/index.js until ignore was set.)
- Don't: Building a pattern with path.join on Windows, e.g. 'src\\*.js' → Do: Write patterns with forward slashes ('src/*.js'), or set windowsPathsNoEscape: true (A backslash is an escape in patterns; in our run 'src\\*.js' found nothing and found src/app.js with windowsPathsNoEscape.)
- Don't: Trusting the order of results (first file = oldest, or alphabetical) → Do: Sort the list yourself, or use stat: true with withFileTypes and sort by mtimeMs (The walk happens in no fixed order.)
- Don't: npx glob '**/*.md' expecting the command line tool → Do: Install glob-bin for the command, keep glob for code (The command left the main package in version 13.)

### Questions
- Does it skip node_modules on its own? No. Pass ignore: "node_modules/**"; in our demo **/*.js returned node_modules files until we did.
- What happens when nothing matches? You get an empty list, unlike a shell, which prints the pattern itself.
- Where did the glob command go? Since version 13 it lives in the separate glob-bin package.
- Why does my old callback code fail? Version 9 replaced callbacks with promises and renamed the exported functions; use await glob(...).
- Can I use it in a paid product? Yes. The Blue Oak license allows it; pass on the license text or link with copies of glob's files.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
