avancement planning
This commit is contained in:
+154
-216
@@ -3,10 +3,12 @@
|
||||
Match files using the patterns the shell uses.
|
||||
|
||||
The most correct and second fastest glob implementation in
|
||||
JavaScript. (See **Comparison to Other JavaScript Glob
|
||||
Implementations** at the bottom of this readme.)
|
||||
JavaScript. (See [**Comparison to Other JavaScript Glob
|
||||
Implementations**](#comparisons-to-other-fnmatchglob-implementations)
|
||||
at the bottom of this readme.)
|
||||
|
||||

|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
@@ -16,8 +18,9 @@ Install with npm
|
||||
npm i glob
|
||||
```
|
||||
|
||||
**Note** the npm package name is _not_ `node-glob` that's a
|
||||
different thing that was abandoned years ago. Just `glob`.
|
||||
> [!NOTE]
|
||||
> The npm package name is _not_ `node-glob` that's a
|
||||
> different thing that was abandoned years ago. Just `glob`.
|
||||
|
||||
```js
|
||||
// load using import
|
||||
@@ -69,8 +72,9 @@ for (const file of g2) {
|
||||
}
|
||||
|
||||
// you can also pass withFileTypes: true to get Path objects
|
||||
// these are like a Dirent, but with some more added powers
|
||||
// check out http://npm.im/path-scurry for more info on their API
|
||||
// these are like a fs.Dirent, but with some more added powers
|
||||
// check out https://isaacs.github.io/path-scurry/classes/PathBase.html
|
||||
// for more info on their API
|
||||
const g3 = new Glob('**/baz/**', { withFileTypes: true })
|
||||
g3.stream().on('data', path => {
|
||||
console.log(
|
||||
@@ -135,137 +139,22 @@ const newFiles = await glob('**', {
|
||||
})
|
||||
```
|
||||
|
||||
**Note** Glob patterns should always use `/` as a path separator,
|
||||
even on Windows systems, as `\` is used to escape glob
|
||||
characters. 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. In this mode,
|
||||
special glob characters cannot be escaped, making it impossible
|
||||
to match a literal `*` `?` and so on in filenames.
|
||||
> [!NOTE]
|
||||
> Glob patterns should always use `/` as a path separator,
|
||||
> even on Windows systems, as `\` is used to escape glob
|
||||
> characters. 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. In this mode,
|
||||
> special glob characters cannot be escaped, making it impossible
|
||||
> to match a literal `*` `?` and so on in filenames.
|
||||
|
||||
## Command Line Interface
|
||||
|
||||
The glob CLI has been moved to the `glob-bin` package, and must
|
||||
be installed separately, as of version 13.
|
||||
|
||||
```
|
||||
$ glob -h
|
||||
|
||||
Usage:
|
||||
glob [options] [<pattern> [<pattern> ...]]
|
||||
|
||||
Expand the positional glob expression arguments into any matching file system
|
||||
paths found.
|
||||
|
||||
-c<command> --cmd=<command>
|
||||
Run the command provided, passing the glob expression
|
||||
matches as arguments.
|
||||
|
||||
-A --all By default, the glob cli command will not expand any
|
||||
arguments that are an exact match to a file on disk.
|
||||
|
||||
This prevents double-expanding, in case the shell
|
||||
expands an argument whose filename is a glob
|
||||
expression.
|
||||
|
||||
For example, if 'app/*.ts' would match 'app/[id].ts',
|
||||
then on Windows powershell or cmd.exe, 'glob app/*.ts'
|
||||
will expand to 'app/[id].ts', as expected. However, in
|
||||
posix shells such as bash or zsh, the shell will first
|
||||
expand 'app/*.ts' to a list of filenames. Then glob
|
||||
will look for a file matching 'app/[id].ts' (ie,
|
||||
'app/i.ts' or 'app/d.ts'), which is unexpected.
|
||||
|
||||
Setting '--all' prevents this behavior, causing glob to
|
||||
treat ALL patterns as glob expressions to be expanded,
|
||||
even if they are an exact match to a file on disk.
|
||||
|
||||
When setting this option, be sure to enquote arguments
|
||||
so that the shell will not expand them prior to passing
|
||||
them to the glob command process.
|
||||
|
||||
-a --absolute Expand to absolute paths
|
||||
-d --dot-relative Prepend './' on relative matches
|
||||
-m --mark Append a / on any directories matched
|
||||
-x --posix Always resolve to posix style paths, using '/' as the
|
||||
directory separator, even on Windows. Drive letter
|
||||
absolute matches on Windows will be expanded to their
|
||||
full resolved UNC maths, eg instead of 'C:\foo\bar', it
|
||||
will expand to '//?/C:/foo/bar'.
|
||||
|
||||
-f --follow Follow symlinked directories when expanding '**'
|
||||
-R --realpath Call 'fs.realpath' on all of the results. In the case
|
||||
of an entry that cannot be resolved, the entry is
|
||||
omitted. This incurs a slight performance penalty, of
|
||||
course, because of the added system calls.
|
||||
|
||||
-s --stat Call 'fs.lstat' on all entries, whether required or not
|
||||
to determine if it's a valid match.
|
||||
|
||||
-b --match-base Perform a basename-only match if the pattern does not
|
||||
contain any slash characters. That is, '*.js' would be
|
||||
treated as equivalent to '**/*.js', matching js files
|
||||
in all directories.
|
||||
|
||||
--dot Allow patterns to match files/directories that start
|
||||
with '.', even if the pattern does not start with '.'
|
||||
|
||||
--nobrace Do not expand {...} patterns
|
||||
--nocase Perform a case-insensitive match. This defaults to
|
||||
'true' on macOS and Windows platforms, and false on all
|
||||
others.
|
||||
|
||||
Note: 'nocase' should only be explicitly set when it is
|
||||
known that the filesystem's case sensitivity differs
|
||||
from the platform default. If set 'true' on
|
||||
case-insensitive file systems, then the walk may return
|
||||
more or less results than expected.
|
||||
|
||||
--nodir Do not match directories, only files.
|
||||
|
||||
Note: to *only* match directories, append a '/' at the
|
||||
end of the pattern.
|
||||
|
||||
--noext Do not expand extglob patterns, such as '+(a|b)'
|
||||
--noglobstar Do not expand '**' against multiple path portions. Ie,
|
||||
treat it as a normal '*' instead.
|
||||
|
||||
--windows-path-no-escape
|
||||
Use '\' as a path separator *only*, and *never* as an
|
||||
escape character. If set, all '\' characters are
|
||||
replaced with '/' in the pattern.
|
||||
|
||||
-D<n> --max-depth=<n> Maximum depth to traverse from the current working
|
||||
directory
|
||||
|
||||
-C<cwd> --cwd=<cwd> Current working directory to execute/match in
|
||||
-r<root> --root=<root> A string path resolved against the 'cwd', which is used
|
||||
as the starting point for absolute patterns that start
|
||||
with '/' (but not drive letters or UNC paths on
|
||||
Windows).
|
||||
|
||||
Note that this *doesn't* necessarily limit the walk to
|
||||
the 'root' directory, and doesn't affect the cwd
|
||||
starting point for non-absolute patterns. A pattern
|
||||
containing '..' will still be able to traverse out of
|
||||
the root directory, if it is not an actual root
|
||||
directory on the filesystem, and any non-absolute
|
||||
patterns will still be matched in the 'cwd'.
|
||||
|
||||
To start absolute and non-absolute patterns in the same
|
||||
path, you can use '--root=' to set it to the empty
|
||||
string. However, be aware that on Windows systems, a
|
||||
pattern like 'x:/*' or '//host/share/*' will *always*
|
||||
start in the 'x:/' or '//host/share/' directory,
|
||||
regardless of the --root setting.
|
||||
|
||||
--platform=<platform> Defaults to the value of 'process.platform' if
|
||||
available, or 'linux' if not. Setting --platform=win32
|
||||
on non-Windows systems may cause strange behavior!
|
||||
|
||||
-i<ignore> --ignore=<ignore>
|
||||
Glob patterns to ignore Can be set multiple times
|
||||
-v --debug Output a huge amount of noisy debug information about
|
||||
patterns as they are parsed and used to match files.
|
||||
|
||||
-h --help Show this usage information
|
||||
npm install glob-bin
|
||||
```
|
||||
|
||||
## `glob(pattern: string | string[], options?: GlobOptions) => Promise<string[] | Path[]>`
|
||||
@@ -362,16 +251,17 @@ Options object is required.
|
||||
|
||||
See full options descriptions below.
|
||||
|
||||
Note that a previous `Glob` object can be passed as the
|
||||
`GlobOptions` to another `Glob` instantiation to re-use settings
|
||||
and caches with a new pattern.
|
||||
> [!NOTE]
|
||||
> A previous `Glob` object can be passed as the
|
||||
> `GlobOptions` to another `Glob` instantiation to re-use settings
|
||||
> and caches with a new pattern.
|
||||
|
||||
Traversal functions can be called multiple times to run the walk
|
||||
again.
|
||||
|
||||
### `g.stream()`
|
||||
|
||||
Stream results asynchronously,
|
||||
Stream results asynchronously.
|
||||
|
||||
### `g.streamSync()`
|
||||
|
||||
@@ -429,35 +319,37 @@ share the previously loaded cache.
|
||||
is used as the starting point for absolute patterns that start
|
||||
with `/`, (but not drive letters or UNC paths on Windows).
|
||||
|
||||
Note that this _doesn't_ necessarily limit the walk to the
|
||||
`root` directory, and doesn't affect the cwd starting point for
|
||||
non-absolute patterns. A pattern containing `..` will still be
|
||||
able to traverse out of the root directory, if it is not an
|
||||
actual root directory on the filesystem, and any non-absolute
|
||||
patterns will be matched in the `cwd`. For example, the
|
||||
pattern `/../*` with `{root:'/some/path'}` will return all
|
||||
files in `/some`, not all files in `/some/path`. The pattern
|
||||
`*` with `{root:'/some/path'}` will return all the entries in
|
||||
the cwd, not the entries in `/some/path`.
|
||||
|
||||
To start absolute and non-absolute patterns in the same
|
||||
path, you can use `{root:''}`. However, be aware that on
|
||||
Windows systems, a pattern like `x:/*` or `//host/share/*` will
|
||||
To start absolute and non-absolute patterns in the same path,
|
||||
you can use `{root:''}`. However, be aware that on Windows
|
||||
systems, a pattern like `x:/*` or `//host/share/*` will
|
||||
_always_ start in the `x:/` or `//host/share` directory,
|
||||
regardless of the `root` setting.
|
||||
|
||||
> [!NOTE] This _doesn't_ necessarily limit the walk to the
|
||||
> `root` directory, and doesn't affect the cwd starting point
|
||||
> for non-absolute patterns. A pattern containing `..` will
|
||||
> still be able to traverse out of the root directory, if it
|
||||
> is not an actual root directory on the filesystem, and any
|
||||
> non-absolute patterns will be matched in the `cwd`. For
|
||||
> example, the pattern `/../*` with `{root:'/some/path'}`
|
||||
> will return all files in `/some`, not all files in
|
||||
> `/some/path`. The pattern `*` with `{root:'/some/path'}`
|
||||
> will return all the entries in the cwd, not the entries in
|
||||
> `/some/path`.
|
||||
|
||||
- `windowsPathsNoEscape` Use `\\` as a path separator _only_, and
|
||||
_never_ as an escape character. If set, all `\\` characters are
|
||||
replaced with `/` in the pattern.
|
||||
|
||||
Note that this makes it **impossible** to match against paths
|
||||
containing literal glob pattern characters, but allows matching
|
||||
with patterns constructed using `path.join()` and
|
||||
`path.resolve()` on Windows platforms, mimicking the (buggy!)
|
||||
behavior of Glob v7 and before on Windows. Please use with
|
||||
caution, and be mindful of [the caveat below about Windows
|
||||
paths](#windows). (For legacy reasons, this is also set if
|
||||
`allowWindowsEscape` is set to the exact value `false`.)
|
||||
> [!NOTE]
|
||||
> This makes it **impossible** to match against paths
|
||||
> containing literal glob pattern characters, but allows matching
|
||||
> with patterns constructed using `path.join()` and
|
||||
> `path.resolve()` on Windows platforms, mimicking the (buggy!)
|
||||
> behavior of Glob v7 and before on Windows. Please use with
|
||||
> caution, and be mindful of [the caveat below about Windows
|
||||
> paths](#windows). (For legacy reasons, this is also set if
|
||||
> `allowWindowsEscape` is set to the exact value `false`.)
|
||||
|
||||
- `dot` Include `.dot` files in normal matches and `globstar`
|
||||
matches. Note that an explicit dot in a portion of the pattern
|
||||
@@ -492,11 +384,33 @@ share the previously loaded cache.
|
||||
- `nocase` Perform a case-insensitive match. This defaults to
|
||||
`true` on macOS and Windows systems, and `false` on all others.
|
||||
|
||||
**Note** `nocase` should only be explicitly set when it is
|
||||
known that the filesystem's case sensitivity differs from the
|
||||
platform default. If set `true` on case-sensitive file
|
||||
systems, or `false` on case-insensitive file systems, then the
|
||||
walk may return more or less results than expected.
|
||||
> [!NOTE]
|
||||
> `nocase` should only be explicitly set when it is known that
|
||||
> the filesystem's case sensitivity differs from the platform
|
||||
> default. If set `true` on case-sensitive file systems, or
|
||||
> `false` on case-insensitive file systems, then the walk may
|
||||
> return more or less results than expected.
|
||||
>
|
||||
> As a shortcut to avoid excessive `RegExp` creations, `Glob`
|
||||
> will use string portions as-is to `readdir()` calls while doing
|
||||
> its traversal. If you are setting a `nocase: true` match on a
|
||||
> file system that is in fact case sensitive, then this will
|
||||
> result in matches not being found that you might expect,
|
||||
> because for example the pattern `Foo/*` will fail to read the
|
||||
> `FOO/` or `foo/` directories.
|
||||
>
|
||||
> On the other hand, if you set `nocase: false` on a
|
||||
> case-_insensitive_ system, then the opposite problem occurs:
|
||||
> `Foo/*` will match `foo/bar`, but because we only detect the
|
||||
> existence of the `foo/` folder by successfully performing a
|
||||
> `readdir`, there's no way to know what the "real" case is, and
|
||||
> the match will be reported as `Foo/bar`, using the case of the
|
||||
> string portion of the glob pattern.
|
||||
>
|
||||
> The default is usually correct, however it _is_ possible to
|
||||
> mount file systems with a different case-sensitivity from the
|
||||
> host system. If you know this is the case, set this flag
|
||||
> appropriately to the file system you are searching.
|
||||
|
||||
- `maxDepth` Specify a number to limit the depth of the directory
|
||||
traversal to this many levels below the `cwd`.
|
||||
@@ -509,8 +423,9 @@ share the previously loaded cache.
|
||||
- `nodir` Do not match directories, only files. (Note: to match
|
||||
_only_ directories, put a `/` at the end of the pattern.)
|
||||
|
||||
Note: when `follow` and `nodir` are both set, then symbolic
|
||||
links to directories are also omitted.
|
||||
> [!NOTE]
|
||||
> When `follow` and `nodir` are both set, then symbolic
|
||||
> links to directories are also omitted.
|
||||
|
||||
- `stat` Call `lstat()` on all entries, whether required or not
|
||||
to determine whether it's a valid match. When used with
|
||||
@@ -518,22 +433,33 @@ share the previously loaded cache.
|
||||
as modified time, permissions, and so on. Note that this will
|
||||
incur a performance cost due to the added system calls.
|
||||
|
||||
- `ignore` string or string[], or an object with `ignore` and
|
||||
`ignoreChildren` methods.
|
||||
- `ignore` string or string[], or an object with `ignored` and
|
||||
`childrenIgnored` methods.
|
||||
|
||||
If a string or string[] is provided, then this is treated as a
|
||||
glob pattern or array of glob patterns to exclude from matches.
|
||||
To ignore all children within a directory, as well as the entry
|
||||
itself, append `'/**'` to the ignore pattern.
|
||||
|
||||
**Note** `ignore` patterns are _always_ in `dot:true` mode,
|
||||
regardless of any other settings.
|
||||
If a string or string[] is provided, then this is treated as
|
||||
a glob pattern or array of glob patterns to exclude from
|
||||
matches. To ignore all children within a directory, as well
|
||||
as the entry itself, append `'/**'` to the ignore pattern.
|
||||
|
||||
If an object is provided that has `ignored(path)` and/or
|
||||
`childrenIgnored(path)` methods, then these methods will be
|
||||
called to determine whether any Path is a match or if its
|
||||
called to determine whether any Path is a match or if its
|
||||
children should be traversed, respectively.
|
||||
|
||||
The `path` argument to the methods will be a
|
||||
[`path-scurry`](https://isaacs.github.io/path-scurry/index.html)
|
||||
[`Path`](https://isaacs.github.io/path-scurry/classes/PathBase)
|
||||
object, which extends
|
||||
[`fs.Dirent`](https://nodejs.org/docs/latest/api/fs.html#class-fsdirent)
|
||||
with additional useful methods like
|
||||
[`.fullpath()`](https://isaacs.github.io/path-scurry/classes/PathBase.html#fullpath),
|
||||
[`.relative()`](https://isaacs.github.io/path-scurry/classes/PathBase.html#relative),
|
||||
and more.
|
||||
|
||||
> [!NOTE]
|
||||
> `ignore` patterns are _always_ in `dot:true` mode,
|
||||
> regardless of any other settings.
|
||||
|
||||
- `follow` Follow symlinked directories when expanding `**`
|
||||
patterns. This can result in a lot of duplicate references in
|
||||
the presence of cyclic links, and make performance quite bad.
|
||||
@@ -542,8 +468,9 @@ share the previously loaded cache.
|
||||
it is not the first item in the pattern, or none if it is the
|
||||
first item in the pattern, following the same behavior as Bash.
|
||||
|
||||
Note: when `follow` and `nodir` are both set, then symbolic
|
||||
links to directories are also omitted.
|
||||
> [!NOTE]
|
||||
> When `follow` and `nodir` are both set, then symbolic
|
||||
> links to directories are also omitted.
|
||||
|
||||
- `realpath` Set to true to call `fs.realpath` on all of the
|
||||
results. In the case of an entry that cannot be resolved, the
|
||||
@@ -564,20 +491,21 @@ share the previously loaded cache.
|
||||
`absolute` may not be used along with `withFileTypes`.
|
||||
|
||||
- `posix` Set to true to use `/` as the path separator in
|
||||
returned results. On posix systems, this has no effect. On
|
||||
returned results. On POSIX systems, this has no effect. On
|
||||
Windows systems, this will return `/` delimited path results,
|
||||
and absolute paths will be returned in their full resolved UNC
|
||||
path form, eg insted of `'C:\\foo\\bar'`, it will return
|
||||
and absolute paths will be returned in their fully resolved UNC
|
||||
path form, e.g. instead of `'C:\\foo\\bar'`, it will return
|
||||
`//?/C:/foo/bar`.
|
||||
|
||||
- `platform` Defaults to value of `process.platform` if
|
||||
- `platform` Defaults to the value of `process.platform` if
|
||||
available, or `'linux'` if not. Setting `platform:'win32'` on
|
||||
non-Windows systems may cause strange behavior.
|
||||
|
||||
- `withFileTypes` Return [PathScurry](http://npm.im/path-scurry)
|
||||
`Path` objects instead of strings. These are similar to a
|
||||
NodeJS `Dirent` object, but with additional methods and
|
||||
properties.
|
||||
- `withFileTypes` Return
|
||||
[`path-scurry`](http://npm.im/path-scurry)
|
||||
[`Path`](https://isaacs.github.io/path-scurry/classes/PathBase.html)
|
||||
objects instead of strings. These are similar to a NodeJS
|
||||
`fs.Dirent` object, but with additional methods and properties.
|
||||
|
||||
`withFileTypes` may not be used along with `absolute`.
|
||||
|
||||
@@ -585,13 +513,15 @@ share the previously loaded cache.
|
||||
triggered.
|
||||
|
||||
- `fs` An override object to pass in custom filesystem methods.
|
||||
See [PathScurry docs](http://npm.im/path-scurry) for what can
|
||||
be overridden.
|
||||
See [`path-scurry`
|
||||
docs](https://isaacs.github.io/path-scurry/interfaces/FSOption.html)
|
||||
for what can be overridden.
|
||||
|
||||
- `scurry` A [PathScurry](http://npm.im/path-scurry) object used
|
||||
to traverse the file system. If the `nocase` option is set
|
||||
explicitly, then any provided `scurry` object must match this
|
||||
setting.
|
||||
- `scurry` A
|
||||
[`PathScurry`](https://isaacs.github.io/path-scurry/classes/PathScurryBase.html)
|
||||
object used to traverse the file system. If the `nocase` option
|
||||
is set explicitly, then any provided `scurry` object must match
|
||||
this setting.
|
||||
|
||||
- `includeChildMatches` boolean, default `true`. Do not match any
|
||||
children of any matches. For example, the pattern `**\/foo`
|
||||
@@ -606,13 +536,6 @@ share the previously loaded cache.
|
||||
`false`, and a custom `Ignore` is provided that does not have
|
||||
an `add()` method, then it will throw an error.
|
||||
|
||||
**Caveat** It _only_ ignores matches that would be a descendant
|
||||
of a previous match, and only if that descendant is matched
|
||||
_after_ the ancestor is encountered. Since the file system walk
|
||||
happens in indeterminate order, it's possible that a match will
|
||||
already be added before its ancestor, if multiple or braced
|
||||
patterns are used.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
@@ -638,6 +561,19 @@ share the previously loaded cache.
|
||||
one another's file system descendants, or if the occasional
|
||||
included child entry will not cause problems.
|
||||
|
||||
> [!NOTE]
|
||||
> It _only_ ignores matches that would be a descendant
|
||||
> of a previous match, and only if that descendant is matched
|
||||
> _after_ the ancestor is encountered. Since the file system walk
|
||||
> happens in indeterminate order, it's possible that a match will
|
||||
> already be added before its ancestor, if multiple or braced
|
||||
> patterns are used.
|
||||
|
||||
- `braceExpandMax` number, defaults to `10_000`. This is the
|
||||
maximum number of `{x,y,...}` patterns to expand. It is very
|
||||
unlikely that you'll need more than this, and setting it higher
|
||||
exposes the system to out-of-memory errors.
|
||||
|
||||
## Glob Primer
|
||||
|
||||
Much more information about glob pattern expansion can be found
|
||||
@@ -737,11 +673,12 @@ bsdglob and bash 5, where `**` only has special significance if
|
||||
it is the only thing in a path part. That is, `a/**/b` will match
|
||||
`a/x/y/b`, but `a/**b` will not.
|
||||
|
||||
Note that symlinked directories are not traversed as part of a
|
||||
`**`, though their contents may match against subsequent portions
|
||||
of the pattern. This prevents infinite loops and duplicates and
|
||||
the like. You can force glob to traverse symlinks with `**` by
|
||||
setting `{follow:true}` in the options.
|
||||
> [!NOTE]
|
||||
> Symlinked directories are not traversed as part of a
|
||||
> `**`, though their contents may match against subsequent portions
|
||||
> of the pattern. This prevents infinite loops and duplicates and
|
||||
> the like. You can force glob to traverse symlinks with `**` by
|
||||
> setting `{follow:true}` in the options.
|
||||
|
||||
There is no equivalent of the `nonull` option. A pattern that
|
||||
does not find any matches simply resolves to nothing. (An empty
|
||||
@@ -754,8 +691,8 @@ expanded **first** into the set of `+(a|b)` and `+(a|c)`, and
|
||||
those patterns are checked for validity. Since those two are
|
||||
valid, matching proceeds.
|
||||
|
||||
The character class patterns `[:class:]` (posix standard named
|
||||
classes) style class patterns are supported and unicode-aware,
|
||||
The character class patterns `[:class:]` (POSIX standard named
|
||||
classes) style class patterns are supported and Unicode-aware,
|
||||
but `[=c=]` (locale-specific character collation weight), and
|
||||
`[.symbol.]` (collating symbol), are not.
|
||||
|
||||
@@ -779,13 +716,13 @@ To specify things that should not match, use the `ignore` option.
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only
|
||||
Though Windows uses either `/` or `\` as its path separator, only
|
||||
`/` characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes will
|
||||
always be interpreted as escape characters, not path separators.
|
||||
|
||||
Results from absolute patterns such as `/foo/*` are mounted onto
|
||||
the root setting using `path.join`. On windows, this will by
|
||||
the root setting using `path.join`. On Windows, this will by
|
||||
default result in `/foo/*` matching `C:\foo\bar.txt`.
|
||||
|
||||
To automatically coerce all `\` characters to `/` in pattern
|
||||
@@ -795,7 +732,7 @@ characters**, you may set the `windowsPathsNoEscape` option to
|
||||
|
||||
### Windows, CWDs, Drive Letters, and UNC Paths
|
||||
|
||||
On posix systems, when a pattern starts with `/`, any `cwd`
|
||||
On POSIX systems, when a pattern starts with `/`, any `cwd`
|
||||
option is ignored, and the traversal starts at `/`, plus any
|
||||
non-magic path portions specified in the pattern.
|
||||
|
||||
@@ -955,10 +892,11 @@ performing a glob pattern expansion as faithfully as possible to
|
||||
the behavior of Bash and other sh-like shells, with as much speed
|
||||
as possible.
|
||||
|
||||
Note that prior versions of `node-glob` are _not_ on this list.
|
||||
Former versions of this module are far too slow for any cases
|
||||
where performance matters at all, and were designed with APIs
|
||||
that are extremely dated by current JavaScript standards.
|
||||
> [!NOTE]
|
||||
> Prior versions of `node-glob` are _not_ on this list.
|
||||
> Former versions of this module are far too slow for any cases
|
||||
> where performance matters at all, and were designed with APIs
|
||||
> that are extremely dated by current JavaScript standards.
|
||||
|
||||
---
|
||||
|
||||
@@ -970,9 +908,9 @@ course.</small>
|
||||
|
||||
### Benchmark Results
|
||||
|
||||
First number is time, smaller is better.
|
||||
The first number is time, smaller is better.
|
||||
|
||||
Second number is the count of results returned.
|
||||
The second number is the count of results returned.
|
||||
|
||||
```
|
||||
--- pattern: '**' ---
|
||||
|
||||
Reference in New Issue
Block a user