# cspell-glob

> Glob matcher for cspell

Latest version **10.3.3** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install cspell-glob
pnpm add cspell-glob
yarn add cspell-glob
bun add cspell-glob
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 10.3.3 |
| Published | 2026-09-16 |
| First published | 2019-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=22.18.0 |
| Dependencies | 2 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1685 |
| Author | Jason Dent |
| Maintainers | jason-dent |
| Keywords | cspell, glob |

## Links

- npm: https://www.npmjs.com/package/cspell-glob
- Repository: https://github.com/streetsidesoftware/cspell
- Homepage: https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-glob#readme
- Issues: https://github.com/streetsidesoftware/cspell/labels/cspell-glob
- npm.io page: https://npm.io/package/cspell-glob

## Dependencies (2)

- [picomatch](https://npm.io/package/picomatch.md) ^4.0.7
- [@cspell/url](https://npm.io/package/@cspell/url.md) 10.3.3

## Recent versions

- 10.3.3 (latest) — 2026-09-16
- 10.3.4-alpha.0 (next) — 2026-09-17
- 5.21.2 (cspell5) — 2022-05-21
- 5.21.2-alpha.0 (cspell5-next) — 2022-05-20
- 10.3.2 — 2026-09-15
- 10.3.2-alpha.0 — 2026-09-13
- 10.3.1 — 2026-09-13
- 10.3.1-alpha.1 — 2026-09-12
- 10.3.1-alpha.0 — 2026-09-12
- 10.3.0 — 2026-09-08
- 10.3.0-alpha.0 — 2026-09-04
- 10.2.2 — 2026-09-04
- 10.2.1 — 2026-09-03
- 10.2.0 — 2026-08-31
- 10.2.0-alpha.7 — 2026-08-30
- … 316 more at https://npm.io/package/cspell-glob/versions

## README

# `cspell-glob`

A simple library for checking filenames against a set of glob rules. It attempts to emulate the `.gitignore` rules.

## Purpose

The purpose behind this library is a bit different than the other glob matchers.
The goal here is to see if a file name matches a glob, not to find files that match globs.
This library doesn't do any file i/o. It uses [micromatch](https://github.com/micromatch/micromatch#readme) under the hood for the actual matching.

## Usage

```ts
import { GlobMatcher } from 'cspell-glob';

// Patterns behave like the contents of a `.gitignore` file.
const patterns = ['*.test.js', '!important.test.js'];

const matcher = new GlobMatcher(patterns, process.cwd());

matcher.match('src/app.test.js'); // true -- matches `*.test.js`
matcher.match('src/important.test.js'); // false -- excluded by the negated pattern
matcher.match('src/app.js'); // false -- does not match any pattern
```

By default, `GlobMatcher` runs in `exclude` mode (like `.gitignore`). Use `include` mode when searching for
files to check, where patterns must be more explicit to match:

```ts
const matcher = new GlobMatcher(['src/**/*.ts'], { root: process.cwd(), mode: 'include' });

matcher.match('src/app.ts'); // true
matcher.match('node_modules/lib/index.ts'); // false
```

## CSpell for Enterprise

<!--- @@inject: ../../static/tidelift.md --->

Available as part of the Tidelift Subscription.

The maintainers of cspell and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-cspell?utm_source=npm-cspell&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

<!--- @@inject-end: ../../static/tidelift.md --->

<!--- @@inject: ../../static/footer.md --->

<br/>

---

<p align="center">Brought to you by<a href="https://streetsidesoftware.com" title="Street Side Software"><img width="16" alt="Street Side Software Logo" src="https://i.imgur.com/CyduuVY.png" /> Street Side Software</a></p>

<!--- @@inject-end: ../../static/footer.md --->

---
_Source: https://npm.io/package/cspell-glob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
