picomatch
Blazing-fast JavaScript glob pattern matching library with zero dependencies. The underlying engine used by micromatch, chokidar, rollup, and other major tools. Converts glob patterns to regular expressions with support for extglob, brace expansion, and negation. Lower-level than micromatch — designed for library authors who need the pattern compiler directly without the higher-level array filtering API.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Zero dependencies, local computation, MIT licensed. No security concerns.
⚡ Reliability
Best When
You're building a library or performance-critical tool that needs efficient glob pattern compilation — picomatch is the foundation that tools like micromatch and chokidar use.
Avoid When
You're building an application (not a library) — use micromatch instead, which wraps picomatch with a more convenient array-filtering API.
Use Cases
- • Build file watchers and build tools that need to test whether paths match glob patterns with maximum performance
- • Implement custom file filtering logic in build pipelines where micromatch's array API adds unnecessary overhead
- • Create reusable glob matchers that can be compiled once and tested against many paths efficiently
- • Write library code that needs glob pattern support without taking micromatch as a dependency
- • Validate path patterns in agent configuration systems with precise control over matching behavior
Not For
- • End-user applications — micromatch provides a friendlier higher-level API built on picomatch
- • Filesystem traversal — picomatch only matches strings against patterns; use fast-glob for filesystem discovery
- • Regular expression patterns — picomatch handles glob syntax only
Interface
Authentication
Local library — no authentication required. MIT licensed.
Pricing
MIT licensed. Zero cost. Zero dependencies.
Agent Metadata
Known Gotchas
- ⚠ picomatch() returns a FUNCTION — call it to create a matcher, then call the matcher with a string: const isMatch = picomatch('*.js'); isMatch('foo.js') // => true
- ⚠ Compile patterns once and reuse — picomatch caches compiled regexes by default, but creating new picomatch() calls in loops is unnecessary work
- ⚠ Windows paths: backslashes must be normalized to forward slashes before matching — set { windows: true } option or normalize manually
- ⚠ Dot files require { dot: true } option — hidden files starting with . are excluded by default like standard glob behavior
- ⚠ v3+ changed some matching semantics around ** and trailing slashes — test against actual paths if upgrading from v2
- ⚠ Low-level API — for most use cases, micromatch is the better choice; picomatch is the engine for library authors
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for picomatch.
Scores are editorial opinions as of 2026-03-06.