globby

User-friendly glob matching for Node.js, built on fast-glob with negation, directory expansion, and gitignore support.

Library
npm
v16.2.4
2,649 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
68 /100 Good
Development Activity 56
Maintenance 60
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 78
Code Quality 82
Innovation 65
Learning Curve 85

globby wraps fast-glob with a batch of ergonomic conveniences: a promise-based API, support for multiple patterns in a single call, negated and negation-only patterns, automatic expansion of directory patterns into recursive globs, and native .gitignore-aware filtering. It is one of the most widely used file-globbing libraries in the Node.js ecosystem, relied on by build tools, linters, and CLIs to resolve file lists from user-supplied patterns.

When gitignore mode is enabled, globby reads .gitignore files from the working directory up through the repository root before globbing, and proves which ignored directories can be safely skipped during traversal (rather than enumerated and filtered afterward), so large ignored trees like node_modules don’t slow down the scan while still matching Git’s exact ignore semantics, including negation patterns.

What You Get

  • A globby(patterns, options?) promise API returning matched file paths, plus a synchronous globbySync variant
  • Multiple and negated pattern support in a single call (['foo*', '!foobar'])
  • Automatic directory expansion (foo becomes foo/**/*) configurable via expandDirectories
  • Native .gitignore support that walks parent directories to the repo root and matches Git’s exact ignore semantics
  • convertPathToPattern() for safely turning a filesystem path into a valid glob pattern (handling Windows backslashes)
  • URL support as a cwd value alongside plain string paths

Common Use Cases

  • Resolving a build tool’s or bundler’s input file list from user-configured glob patterns
  • Writing a lint/format CLI that needs to skip .gitignored files automatically without re-implementing Git’s ignore rules
  • Expanding a directory argument (src) into every file beneath it as part of a CLI’s file-discovery step
  • Finding files to process in a Gulp-style task pipeline where multiple glob patterns need combining with exclusions

Under The Hood

Architecture: index.js (707 lines) is the core entrypoint, translating globby’s higher-level options (expandDirectories, gitignore, onlyFiles, etc.) into one or more fast-glob calls, then merging/deduplicating the resulting path streams (via @sindresorhus/merge-streams for the streaming variant). ignore.js (1016 lines) is the largest module and implements gitignore-aware filtering: it discovers .gitignore files from the cwd up to the detected repository root, compiles them with the ignore package, and — critically for performance — proves which directories are provably fully ignored (no negation pattern could re-include their contents) so those directories are excluded from fast-glob’s own traversal instead of being walked and filtered after the fact. utilities.js (554 lines) holds shared helpers like directory-expansion logic and path/pattern normalization (including convertPathToPattern). Tech Stack: Pure ESM (type: module, Node.js >=20 required), built on fast-glob for the underlying matching engine, ignore for gitignore-pattern compilation, @sindresorhus/merge-streams for combining async iterables, is-path-inside and slash/unicorn-magic for path handling; devDependencies show a benchmark harness (bench.js) that compares against glob-stream and a main-branch fork of itself, plus xo (linting), ava (tests), and tsd (type-definition tests). Code Quality: The tests/ directory has ten focused test files (globby.js, ignore.js, gitignore-comprehensive.js, gitignore-vs-git.js, global-gitignore.js, global-gitignore-custom-fs.js, parent-directory-patterns.js, convert-path-to-pattern.js, generate-glob-tasks.js, utilities.js) that specifically stress-test the gitignore-matching-Git-behavior guarantee — including a dedicated gitignore-vs-git.js file that appears to diff globby’s ignore behavior directly against real Git output — which is a strong quality signal for a feature whose entire value proposition is ‘matches Git exactly.’ TypeScript types are validated via tsd against index.test-d.ts. API Design: The single globby(patterns, options) promise entrypoint (with a synchronous twin) covers the vast majority of use cases with no configuration required for the common case, while options like expandDirectories and gitignore are opt-in booleans rather than required setup — the README’s copy-pasteable three-line usage example demonstrates the entire happy path, and pattern negation reuses familiar glob syntax (!pattern) rather than a separate exclude option.

Used by 19 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

166

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
31
Repo Health
70
Technical
64
Dependency
Built with
TypeScript 76%
MDX 18%
Updated 1 years ago
TypeScript
89%
MIT

Amical

AI Assistants · Note Taking · Voice AI

1,540

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
82
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 89%
Updated 1 weeks ago
Python
55%
Other

authentik

Authentication · Security

25,758

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
Python 55%
TypeScript 36%
Updated 4 days ago
TypeScript
98%
Apache 2.0

Cline

AI Code Assistants

69,455

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 98%
Updated 4 days ago
C++
53%
Other

Cocos Engine

Design Tools · Developer Tools · Game Development

9,832

Open-source, cross-platform 2D/3D game engine with Vulkan, Metal, and WebGL support for web, mobile, and instant gaming platforms

View details
89
Repo Health
79
Technical
70
Dependency
Built with
C++ 53%
TypeScript 34%
Updated 1 weeks ago
TypeScript
79%
Other

Directus

CMS · Low Code Platforms

37,987

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

View details
92
Repo Health
82
Technical
76
Dependency
Built with
TypeScript 79%
Vue 19%
Updated 1 weeks ago
Ruby
67%
Other

GitLab

Developer Tools · Devops

24,552

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
67
Dependency
Built with
Ruby 67%
JavaScript 20%
Updated 4 days ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,378

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
67
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 1 months ago
TypeScript
99%
MIT

KeystoneJS

CMS · Developer Tools

9,982

The superpowered headless CMS for developers built with GraphQL and React

View details
92
Repo Health
81
Technical
64
Dependency
Built with
TypeScript 99%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers