Changelog
9.3.3
glob.sync
, glob.stream
,
glob.stream.sync
, etc.root
option, albeit with slightly different
semantics than in v8 and before.{ absolute:false }
option to explicitly always return
relative paths. An unset absolute
setting will still return
absolute or relative paths based on whether the pattern is
absolute.magicalBraces
option to treat brace expansion as "magic"
in the hasMagic
function.dotRelative
optionescape()
and unescape()
methodsThis is a full rewrite, with significant API and algorithm changes.
Glob
class is no longer an event emitter.Glob
class has walk()
, walkSync()
, stream()
,
streamSync()
, iterate()
, iterateSync()
methods, and is
both an async and sync Generator./
as a path
separator, unless the windowsPathsNoEscape
option is set, in
which case glob patterns cannot be escaped with \
.hasMagic
method will return false for patterns that only
contain brace expansion, but no other "magic" glob characters./
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. (The mark
option may still be used to
always mark directory matches with a trailing /
or \
.)Glob
class
constructor. {}
may be provided to accept all default
options.root
option and mounting behavior.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 as nodir:true
or
mark:true
.)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./
on any platform, or start with a
drive letter or UNC path on Windows.)silent
and strict
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.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 get Path
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.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 implies absolute:true
. The
relative path to the realpath will be emitted when absolute
is not set.realpath:true
will cause invalid symbolic links to be
omitted, rather than matching the link itself.withFileTypes:true
with fs.readdir()
.**
vs ./**
, following Bash
semantics, where a **
is followed one time only if it is not
the first item in the pattern.windowsPathsNoEscape
option\
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.\
is an escape character to match literal
glob pattern characters.cwd
and root
will always be automatically coerced
to use /
as path separators on Windows, as they cannot
contain glob patterns anyway, and are often supplied by
path.resolve()
and other methods that will use \
path
separators by default.ENOENT
to work around Windows issues.options.cwd
is specified, and not a directorydot:true
modemark
and nodir
options from making all cache
keys absolute path.fs.readdir
returns an error that's unexpectedmatch
events for ignored itemsoptions.follow
to always follow directory symlinks in globstaroptions.realpath
to call fs.realpath
on all resultsoptions.ignore
glob.hasMagic
functionoptions.nodir
flag^
for dependency versions (bumped major because this breaks
older npm versions)glob.h
and fnmatch.h
from NetBSDglob.h
static binding.