🛠️
Utility25M+/wkISC

glob

glob is a library for matching files using glob patterns — the wildcard syntax familiar from shell commands. The library supports standard glob features includi

Installation

npm
npm install glob
yarn
yarn add glob
pnpm
pnpm add glob

Import

ESM
import { glob } from 'glob';

Quick Example

usage
import { glob } from 'glob';

const tsFiles = await glob('src/**/*.ts');
const configs = await glob('*.config.{js,ts}');
const allExceptNode = await glob('**/*', {
  ignore: 'node_modules/**',
});

About glob

glob is a library for matching files using glob patterns — the wildcard syntax familiar from shell commands. The library supports standard glob features including * (match any characters except path separators), ** (match any characters including path separators for recursive directory traversal), ? (match a single character), [...] (character classes), and {a,b} (brace expansion). glob is the underlying pattern matching engine used by countless Node.js tools for file discovery, including test runners finding test files, build tools locating source files, and linters discovering files to check. The library provides both callback and promise-based APIs, with options for ignoring patterns, following symlinks, case-insensitive matching, dot file inclusion, and result sorting. glob v10+ is a complete rewrite with significantly improved performance, featuring a walk-based approach that reduces filesystem calls. The library handles platform-specific path separators and provides both absolute and relative path output. While fast-glob and globby have gained popularity as faster alternatives with more features, glob remains the most widely used file matching library in the Node.js ecosystem.

Quick Facts

Packageglob
CategoryUtility
Weekly Downloads25M+
LicenseISC
Installnpm install glob

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.