glob
The most correct and second-fastest shell-style file pattern matching library for Node.js.
Repository Health
Technical Analysis
Glob resolves shell-style wildcard patterns like **/*.js into lists of matching file paths, giving Node.js programs the same globbing power the Unix shell has at the command line. It supports globstar recursion, brace expansion, character classes, negation, and fine-grained ignore rules, returning results as arrays, async/sync iterators, or backpressure-aware Minipass streams.
Authored by Isaac Z. Schlueter and depended on by npm itself, ESLint, Mocha, and thousands of other build tools, glob is one of the most widely installed packages in the JavaScript ecosystem with hundreds of millions of weekly downloads. Version 13 is written in TypeScript, ships both ESM and CommonJS builds, and exposes a rich options surface for cwd control, symlink handling, file-type objects, and cancellation.
What You Get
- Async and synchronous APIs (
glob,globSync) that resolve to arrays of matching file paths - Streaming and iterator interfaces (
globStream,globIterate) for processing large result sets with backpressure - A reusable
Globclass that caches filesystem reads across repeated walks in the same directory tree - Rich options including globstar recursion, brace expansion, custom ignore functions,
withFileTypesPath objects, andAbortSignalcancellation - First-class TypeScript types with dual ESM and CommonJS builds
Common Use Cases
- Collecting source files for build tools, bundlers, and test runners
- Selecting files to lint, format, or transform by wildcard pattern
- Cleaning or copying files matching a pattern in scripts and task runners
- Streaming large directory trees while filtering with custom ignore rules
Under The Hood
Architecture
The public surface in src/index.ts re-exports the Glob class (src/glob.ts) and thin functional wrappers (glob, globSync, globStream, globIterate and their sync variants) that each construct a Glob and delegate to it. src/glob.ts normalizes options and parses the input into immutable Pattern objects (src/pattern.ts), which the Processor (src/processor.ts) walks against the filesystem via the GlobWalker/GlobStream machinery in src/walker.ts. Directory reads are delegated to path-scurry for cached, symlink-aware traversal, individual path segments are matched with minimatch, and results are emitted through minipass streams so async, sync, iterator, and streaming call styles all share one core walk. Ignore logic lives in src/ignore.ts, and src/has-magic.ts provides magic-character detection.
Tech Stack
Written in TypeScript targeting Node 18/20/22+, glob has just three runtime dependencies: minimatch (pattern-to-regex compilation and escape/unescape), minipass (streams), and path-scurry (cached filesystem walking). It builds with tshy to emit both ESM and CommonJS outputs plus minified bundles via esbuild, is linted with oxlint, and formatted with Prettier.
Code Quality
The repository has an extensive test/ directory (40+ tap test files covering absolute paths, symlinks, custom filesystems via memfs, ignore rules, Windows path handling, and bash-comparison fixtures), with tap snapshots committed. The code is strongly typed with heavily overloaded signatures so return types narrow correctly based on the withFileTypes option, and the walker separates async and sync paths explicitly rather than papering over them.
API Design
The API is ergonomic and progressive: a one-line await glob('**/*.js') covers the common case, while the Glob class, streams, and iterators serve advanced needs, and a prior Glob instance can be passed as the options object to share caches. TypeScript overloads make withFileTypes return the right type automatically, and the README is exhaustive with runnable examples for every method and option. As of v13 the CLI moved to a separate glob-bin package, keeping the library dependency lean.
Used by 84 apps in this directory
Outline
Collaboration · Knowledge Management
A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.
overleaf
Collaboration · Productivity
Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.
Pangolin
Networking
An open-source, identity-based zero-trust remote access platform built on WireGuard — a self-hostable alternative to Cloudflare Tunnel and Twingate with SSO, OIDC, and tunneled reverse proxying.
Arize Phoenix
Analytics · Devops · Monitoring
Open-source AI observability platform for tracing, evaluating, and debugging LLM applications with built-in intelligence and MCP support.
Pi
AI Agents
An open-source, self-extensible agent harness and coding agent CLI — a modular runtime (agent core, unified multi-provider LLM API, TUI) with no built-in permission system by default, documented containerization patterns for sandboxing instead.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
Prime Agent
AI Agents · AI Code Assistants · Developer Tools
An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.
Promptfoo
AI Development
An open-source CLI and library for evaluating and red-teaming LLM applications — replace trial-and-error prompt engineering with systematic evals, vulnerability scanning, and CI/CD integration.
React Cosmos
Developer Tools
An open-source sandbox for developing and testing React and React Native UI components in isolation, with pluggable bundler support for Vite and Webpack.