A fast and correct glob pattern matching library for Node.js, implementing shell-like file matching.
Glob is a Node.js library that provides glob functionality, allowing developers to match files using shell-like patterns such as `*.js` or `**/*.txt`. It solves the problem of efficiently finding files in a directory tree based on expressive patterns, similar to how command-line shells work. The library is designed to be both fast and correct, adhering closely to Bash globbing semantics.
Node.js developers who need to programmatically search for files using pattern matching, such as those building build tools, CLI applications, or file processors.
Developers choose Glob because it offers the most correct implementation of shell globbing in JavaScript, ensuring predictable matches, while still being highly performant. Its comprehensive API and cross-platform support make it a reliable choice for file system operations.
glob functionality for node.js
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Faithfully replicates shell globbing semantics, including support for extglobs like `+(a|b)` and correct `**` behavior, ensuring predictable matches as documented in the comparisons section.
Optimized for speed with efficient traversal and caching, benchmarked as the second fastest JavaScript glob implementation, making it suitable for large file systems.
Offers async, sync, streaming, and iterator-based methods (e.g., `globStream`, `globIterate`), providing flexibility for different integration needs as shown in the usage examples.
With `withFileTypes:true`, returns Path objects containing file stats, permissions, and methods for advanced filtering and sorting, leveraging the path-scurry library.
Caches readdir calls to improve performance, but this makes it susceptible to race conditions in rapidly changing file systems, as admitted in the README's 'Race Conditions' section.
The command-line interface was moved to a separate `glob-bin` package in version 13, adding installation overhead for users who need CLI functionality.
With over 20 options like `windowsPathsNoEscape` and `includeChildMatches`, the API can be overwhelming for simple use cases, increasing the learning curve.