- Drop support for node before v20
- Add
includeChildMatches: false
option - Export the
Ignore
class
- Add
--default -p
flag to provide a default pattern - exclude symbolic links to directories when
follow
andnodir
are both set
- Add glob cli
- Return
'.'
instead of the empty string''
when the current working directory is returned as a match. - Add
posix: true
option to return/
delimited paths, even on Windows.
- No default exports, only named exports
- Upgraded minimatch to v8, adding support for any degree of nested extglob patterns.
- Add aliases for methods.
glob.sync
,glob.stream
,glob.stream.sync
, etc.
- Support using a custom fs object, which is passed to PathScurry
- add maxDepth option
- add stat option
- add custom Ignore support
- Bring back the
root
option, albeit with slightly different semantics than in v8 and before. - Support
{ absolute:false }
option to explicitly always return relative paths. An unsetabsolute
setting will still return absolute or relative paths based on whether the pattern is absolute. - Add
magicalBraces
option to treat brace expansion as "magic" in thehasMagic
function. - Add
dotRelative
option - Add
escape()
andunescape()
methods
This is a full rewrite, with significant API and algorithm changes.
- Only support node 16 and higher.
- Promise API instead of callbacks.
- Exported function names have changed, as have the methods on the Glob class. See API documentation for details.
- Accept pattern as string or array of strings.
- Hybrid module distribution.
- Full TypeScript support.
- Exported
Glob
class is no longer an event emitter. - Exported
Glob
class haswalk()
,walkSync()
,stream()
,streamSync()
,iterate()
,iterateSync()
methods, and is both an async and sync Generator. - First class support for UNC paths and drive letters on Windows.
Note that glob patterns must still use
/
as a path separator, unless thewindowsPathsNoEscape
option is set, in which case glob patterns cannot be escaped with\
. - Paths are returned in the canonical formatting for the platform in question.
- The
hasMagic
method will return false for patterns that only contain brace expansion, but no other "magic" glob characters. - Patterns ending in
/
will still be restricted to matching directories, but will not have a/
appended in the results. In general, results will be in their default relative or absolute forms, without any extraneous/
and.
characters, unlike shell matches. (Themark
option may still be used to always mark directory matches with a trailing/
or\
.) - An options argument is required for the
Glob
class constructor.{}
may be provided to accept all default options.
- Removed
root
option and mounting behavior. - Removed
stat
option. It's slow and pointless. (Could bring back easily if there's demand, but items are already statted in cases where it's relevant, such asnodir:true
ormark:true
.) - Simplified
cwd
behavior so it is far less magical, and relies less on platform-specific absolute path representations. cwd
can be a File URL or a string path.- More efficient handling for absolute patterns. (That is,
patterns that start with
/
on any platform, or start with a drive letter or UNC path on Windows.) - Removed
silent
andstrict
options. Any readdir errors are simply treated as "the directory could not be read", and it is treated as a normal file entry instead, like shells do. - Removed
fs
option. This module only operates on the real filesystem. (Could bring back if there's demand for it, but it'd be an update to PathScurry, not Glob.) nonull:true
is no longer supported.withFileTypes:true
option added, to getPath
objects. These are a bit like a Dirent, but can do a lot more. See http://npm.im/path-scurrynounique:true
is no longer supported. Result sets are always unique.nosort:true
is no longer supported. Result sets are never sorted.- When the
nocase
option is used, the assumption is that it reflects the case sensitivity of the filesystem itself. Using case-insensitive matching on a case-sensitive filesystem, or vice versa, may thus result in more or fewer matches than expected. In general, it should only be used when the filesystem is known to differ from the platform default. realpath:true
no longer impliesabsolute:true
. The relative path to the realpath will be emitted whenabsolute
is not set.realpath:true
will cause invalid symbolic links to be omitted, rather than matching the link itself.
- Massive performance improvements.
- Removed nearly all stat calls, in favor of using
withFileTypes:true
withfs.readdir()
. - Replaced most of the caching with a PathScurry based implementation.
- More correct handling of
**
vs./**
, following Bash semantics, where a**
is followed one time only if it is not the first item in the pattern.
- Add
windowsPathsNoEscape
option
- Only support node v12 and higher
\
is now only used as an escape character, and never as a path separator in glob patterns, so that Windows users have a way to match against filenames containing literal glob pattern characters.- Glob pattern paths must use forward-slashes as path
separators, since
\
is an escape character to match literal glob pattern characters. - (8.0.2)
cwd
androot
will always be automatically coerced to use/
as path separators on Windows, as they cannot contain glob patterns anyway, and are often supplied bypath.resolve()
and other methods that will use\
path separators by default.
- Add fs option to allow passing virtual filesystem
- Ignore stat errors that are not
ENOENT
to work around Windows issues. - Support using root and absolute options together
- Bring back lumpy space princess
- force 'en' locale in string sorting
- Raise error if
options.cwd
is specified, and not a directory
- Remove comment and negation pattern support
- Ignore patterns are always in
dot:true
mode
- Deprecate comment and negation patterns
- Fix regression in
mark
andnodir
options from making all cache keys absolute path. - Abort if
fs.readdir
returns an error that's unexpected - Don't emit
match
events for ignored items - Treat ENOTSUP like ENOTDIR in readdir
- Add
options.follow
to always follow directory symlinks in globstar - Add
options.realpath
to callfs.realpath
on all results - Always cache based on absolute path
- Add
options.ignore
- Fix handling of broken symlinks
- Bump minimatch to 2.x
- Pass all tests on Windows
- Add
glob.hasMagic
function - Add
options.nodir
flag
- Refactor sync and async implementations for performance
- Throw if callback provided to sync glob function
- Treat symbolic links in globstar results the same as Bash 4.3
- Use
^
for dependency versions (bumped major because this breaks older npm versions) - Ensure callbacks are only ever called once
- switch to ISC license
- Rewrite in JavaScript
- Add support for setting root, cwd, and windows support
- Cache many fs calls
- Add globstar support
- emit match events
- Use
glob.h
andfnmatch.h
from NetBSD
glob.h
static binding.