-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
doc: enhance glob pattern documentation in fs.md #58988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2bc0ba6
to
bc710d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, looks good to me
should it be mentioned for path.matchesGlob(path, pattern) as well?
I’ve added a note referencing |
Improved the documentation for fs.glob, fs.globSync, and fsPromises.glob by adding comprehensive information about the `pattern` parameter. The update includes: - Detailed explanations of glob syntax: wildcards (*, ?), character sets, globstar (**), brace expansion ({a,b,c}), and extended patterns (+(x), !(x)) - Practical usage examples including recursive patterns, exclusions, and multiple patterns - Platform considerations such as case sensitivity, path separators, symlink handling, and hidden file behavior - Performance notes on caching, memory efficiency, and matching strategies - Improved parameter descriptions and consistent formatting across variants - Added a reference to `path.matchesGlob()` which supports the same glob pattern syntax for in-memory path matching Fixes: nodejs#58981
bc710d9
to
45a5d32
Compare
and path.matchesGlob() does not support exclude? |
@mizulu @jasnell @lpinca |
Clarify that path.matchesGlob() only performs pattern matching, and does not support the exclude functionality available in fs.glob methods. This addresses potential user confusion as noted in code review feedback. Refs: nodejs#58988
@mag123c , I think so one can for example implement globing on an in memory file system ( list of paths ) This is out side the scope of this PR I might open an issue for feature request to improve on that. edit: #59015 |
This PR improves the documentation for
fs.glob
,fs.globSync
, andfsPromises.glob
by adding comprehensive pattern syntaxexplanations and practical examples.
In the current docs, the pattern parameter is mentioned but not explained clearly, making it difficult for developers to understand
what glob patterns are supported and how to use them effectively.
The updated docs now include:
*
,?
,[abc]
), globstar (**
), brace expansion ({a,b,c}
), andextended glob patterns (
+(pattern)
,!(pattern)
)This change resolves #58981