glob
Match files in the filesystem using shell glob patterns, with async, sync, and streaming APIs.
Official Documentation ↗v14.0.3. Check the official docs for the latest API surface.Installation
npm install globMethods
No methods match this filter.
glob expands shell-style patterns such as **/*.ts into concrete paths and exposes promise, callback, and sync entry points.
Key Features
- Globstar, brace expansion, and negation support
- ignore and dot options for precise filtering
- Streaming API for very large directory trees
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/isaacs/node-glob@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:49.413Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- If using the default Ignore class, then this is fine, but if this is set to false, and a custom Ignore is provided that does not have an add() method, then it will throw an error. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
- It is very unlikely that you’ll need more than this, and setting it higher exposes the system to out-of-memory errors. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
- Patches that fail tests or reduce performance will be rejected. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:49.413Z.
- If you wish to use \ as a path separator instead > of using it as an escape character on Windows platforms, you may > set windowsPathsNoEscape:true in the options. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
- If the windowsPathsNoEscape option is used, then square-brace escapes are removed, but not backslash escapes. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
- When windowsPathsNoEscape is not set, then both brace escapes and backslash escapes are removed. (https://cdn.jsdelivr.net/gh/isaacs/node-glob@latest/README.md)
FAQ
- Does glob follow symlinks by default?
- No. Symlinked directories are not followed unless you set follow: true, which prevents infinite loops caused by circular links.
- How do I exclude node_modules?
- Pass ignore: "**/node_modules/**". ignore accepts a string or an array evaluated relative to the search root.
- Is glob fast enough for large repos?
- For tens of thousands of files, yes. To skip walking ignored trees entirely, consider fast-glob or combine ignore with the nocase option.
Report a problem with this API docOpens a pre-filled issue on GitHub.