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

minimatch

Test file paths against wildcard patterns.

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 every use the copyright covers, paid or not.

github.com/isaacs/minimatch/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 minimatch does

minimatch is a small free JavaScript library that answers one question: does this file path match a pattern like src/**/*.ts or *.{png,jpg}? Your scripts and tools use it to pick, skip or group files by name. It only compares text; listing the files on disk is the job of the glob library, which uses minimatch inside.

What people build with it

Run only the changed tests

From the list of files changed in a pull request, keep only the test files and run just those.

Keep secrets out of uploads Idea

Before a deploy or backup script uploads a folder, it skips .env files, logs and build output by pattern.

Skip folders that cannot match

A tool that walks a big folder tree stops going into folders whose path can never fit the pattern.

Find a file whose name has a star

Match a user's file called report[final]*.pdf by its exact name, without the brackets and star acting as wildcards.

Accept photos in any letter case

An import tool picks up photo.JPG as well as photo.jpg when the user's rule says *.{png,jpg}.

Let users set include rules Idea

Your app's settings file takes lines like src/**/*.md, and the app treats only matching files.

minimatch popularity

66 / 100
Gid Score, #642 overall
1.02B
downloads a week, npm
3,530
GitHub stars
30
agent projects use it
minimatch: downloads per weeknpm, minimatch 1,018,012,295
minimatch: GitHub starsisaacs/minimatch 3,530

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

How minimatch is used

  • minimatch is a dependency in 30 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.6% of the 4,867 JavaScript/TypeScript ones), #48 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 85; those are left out of every share on this page.
  • The most used alternative in our scan is glob (122 projects).
  • Projects that use it most often also use Vitest (73.3%), Model Context Protocol SDK (JavaScript) (60.0%), tsx (56.7%).

By coding agent

23 projects, 0.7%
20 projects, 0.7%
7 projects, 2.1%
6 projects, 0.2%
5 projects, 1.1%

Often used with

In 73.3% of its projects
In 56.7% of its projects
In 50.0% of its projects
In 50.0% of its projects
In 50.0% of its projects
In 46.7% of its projects
In 46.7% of its projects

More about minimatch

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

See all

More in Utilities

Alternatives

minimatch This page

BlueOak-1.0.0Gid 661.02B/wk

picomatch

Pick picomatch when you need a regular expression made from a glob, which minimatch 11 no longer offers.

micromatch

Pick micromatch when your project already uses it; it is a glob matcher offered as an alternative to minimatch.

glob

Pick glob when you need the list of matching files on disk rather than a yes or no for one path.

BlueOak-1.0.0Gid 74557M/wk

Compare minimatch with another tool

Get started

Tell your AI assistant

“Use the npm package minimatch (pin minimatch@11.0.5, Node.js 20 or 22+) with the named import { minimatch }, forward slashes only in patterns, and { dot: true } where dot files must match; never build patterns from untrusted user input.”

  1. Add minimatch to a project that runs on Node.js 20, or 22 and newer.

    From registry.npmjs.org/minimatch/11.0.5

  2. Import the named function and test a path against a pattern.

    // hybrid module, load with require() or import
    import { minimatch } from 'minimatch'
    // or:
    // const { minimatch } = require('minimatch')
    
    minimatch('bar.foo', '*.foo') // true!
    minimatch('bar.foo', '*.bar') // false!
    

    From github.com/isaacs/minimatch/blob/main/README.md

Mistakes to avoid

import minimatch from 'minimatch'
import { minimatch } from 'minimatch'

There is no default export since 9.0; in our run the module had no default.

minimatch.makeRe(pattern) or new Minimatch(p).regexp
Call minimatch(path, pattern) or mm.match(path); if you need a regular expression, use picomatch

Version 11 removed both; in our run makeRe was undefined.

Building a pattern with path.join() on Windows, such as src\*.ts
Write patterns with / only, such as src/*.ts

A backslash escapes the next character; in our run src\*.ts did not match src/app.ts.

Expecting **/* to include .env or .github files
Pass { dot: true } when dot files must match

Dot files are skipped by default; in our demo .env matched only with { dot: true }.

minimatch(path, req.query.pattern) with a pattern typed by a visitor
Offer fixed patterns or escape the input with minimatch.escape()

Patterns from untrusted input can make any glob matcher slow or behave unexpectedly.

Questions

Does it find files on my disk?

No. It only says whether a path string fits a pattern; the glob library uses it to list files.

Why does import minimatch from 'minimatch' fail?

Since version 9 there is no default export; use import { minimatch } from 'minimatch'.

Where did minimatch.makeRe go?

Version 11 removed makeRe and the regexp property; it now matches each path part without regular expressions.

Which wildcard features does it support?

Brace sets like {png,jpg}, extended patterns like +(a|b), ** across folders and POSIX character classes.