Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

glob

Find files by pattern in Node.js.

UtilitiesNPM

GitHubWebsite

1. License

“Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it.”

The Blue Oak license grants use of the code in any product.

github.com/isaacs/node-glob/blob/main/LICENSE.md

From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error

What glob does

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.

What people build with 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 Idea

A small static site generator lists every Markdown post in the content folder and turns each into a page.

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 Idea

Before a fresh build, list old reports or temporary files by pattern and delete them in one pass.

glob popularity

74 / 100
Gid Score, #230 overall
557M
downloads a week, npm
8,711
GitHub stars
122
agent projects use it
glob: downloads per weeknpm, glob 556,924,992
glob: GitHub starsisaacs/node-glob 8,711

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How glob is used

  • glob is a dependency in 122 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.5% of the 4,867 JavaScript/TypeScript ones), #7 of 408 in utilities.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 311; those are left out of every share on this page.
  • Projects that use it most often also use tsx (50.0%), Husky (39.3%), TypeScript (86.9%).

By coding agent

83 projects, 2.5%
61 projects, 2.0%
49 projects, 2.0%
19 projects, 4.0%
12 projects, 3.5%
11 projects, 2.3%
6 projects, 1.8%

Often used with

In 50.0% of its projects
In 39.3% of its projects
In 86.9% of its projects
In 32.0% of its projects
In 30.3% of its projects
In 49.2% of its projects
In 27.0% of its projects

More about glob

Funding
  • GitHub Sponsors: https://github.com/isaacs
  • 23 GitHub sponsors

See all

Agent Skills for it
  • glob: Find files by glob pattern recursively. Results sorted by modification time (newest first). Auto-skips .git, node_modules and other common i

See all

More in Utilities

Alternatives

glob This page

BlueOak-1.0.0Gid 74557M/wk

globby

Pick globby when your patterns are simple and you want .gitignore rules respected automatically; glob's README names it for that.

fast-glob

Pick fast-glob when patterns are simple and raw speed of a sync search matters most, as glob's own README suggests.

tinyglobby

Pick tinyglobby when you want a small library for everyday patterns with few dependencies.

Compare glob with another tool

Get started

Tell your AI assistant

“Use glob (pin glob@14.0.4, Node.js 20+) with `import { glob } from "glob"` to list the project's files by pattern; always pass ignore: "node_modules/**", use forward slashes in patterns, and sort the result.”

  1. Install the package named glob (not node-glob, which is a different, abandoned package).

    npm i glob

    From github.com/isaacs/node-glob/blob/main/README.md

  2. 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/**' })
    

    From github.com/isaacs/node-glob/blob/main/README.md

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

    npm install glob-bin

    From github.com/isaacs/node-glob/blob/main/README.md

Mistakes to avoid

glob('**/*.js', (err, files) => ...) or import glob from 'glob', copied from answers written for glob 7
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).

glob('**/*.js') in a project root
glob('**/*.js', { ignore: 'node_modules/**' })

Nothing is skipped by default; our demo returned node_modules/left-pad/index.js until ignore was set.

Building a pattern with path.join on Windows, e.g. 'src\\*.js'
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.

Trusting the order of results (first file = oldest, or alphabetical)
Sort the list yourself, or use stat: true with withFileTypes and sort by mtimeMs

The walk happens in no fixed order.

npx glob '**/*.md' expecting the command line tool
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.