Glob is a file-matching library for Node.js that implements shell-style glob patterns to find files on the filesystem.
The tool solves the problem of matching files against patterns like those used in Unix shells. It implements the glob specification with correctness as a primary goal, offering both asynchronous and synchronous APIs. The library provides multiple consumption patterns: a promise-based interface, synchronous matching, async iterators, sync iterators, and stream-based approaches. It includes a `hasMagic` function to detect whether a pattern contains glob metacharacters and an `escape` function to treat glob patterns as literal strings. The tool handles platform-specific concerns like Windows path separators, allowing developers to choose between treating backslashes as escape characters or as path separators.
Developers should choose this tool if they need reliable, spec-compliant glob matching in Node.js. It suits projects that require file discovery with shell-style patterns and need flexibility in how results are consumed—whether all at once, iteratively, or via streams. The README identifies this implementation as the most correct and second fastest among JavaScript glob libraries, positioning it for use cases where correctness matters more than raw speed. The library is particularly useful when working with Windows systems, as it provides explicit options for handling path separator behavior rather than forcing a single interpretation.
The project maintains active development with regular updates addressing edge cases and platform compatibility. The codebase is written in TypeScript, providing type safety for consumers. The tool has been refined through careful attention to specification compliance, as evidenced by the emphasis on correctness in its positioning. The project separates concerns by moving the command-line interface to a separate package, keeping the core library focused on programmatic use.