API Reference

fast-glob

High-performance glob library with a task queue, returning entries, streams, and directory trees.

Official Documentation ↗
CompatibilityThis documentation covers version v3.3. Check the official docs for the latest API surface.

Installation

npmnpm install fast-glob

Methods

fast-glob reads directories in parallel and supports inline negative patterns, making it one of the fastest Node glob implementations.

Key Features

  • Inline negation patterns resolved before the walk
  • onlyFiles and onlyDirectories entry filters
  • Stream and sync APIs share one option set

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/mrmlnc/fast-glob@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:35.059Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

What makes fast-glob faster than node-glob?
It builds a reader task queue, avoids unnecessary stat calls, and reads directories in parallel, which matters on trees with many entries.
How do I return directory paths only?
Set onlyDirectories: true for directories or keep the default onlyFiles: true for files. Both are fast-glob entry filters.
Does it support negative patterns inline?
Yes. Prefix a pattern with ! to exclude, for example ["**/*.ts", "!**/*.d.ts"], and it is applied before the filesystem walk.