11cb0ef41Sopenharmony_ci# Glob 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciMatch files using the patterns the shell uses. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciThe most correct and second fastest glob implementation in 61cb0ef41Sopenharmony_ciJavaScript. (See **Comparison to Other JavaScript Glob 71cb0ef41Sopenharmony_ciImplementations** at the bottom of this readme.) 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci## Usage 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciInstall with npm 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci``` 161cb0ef41Sopenharmony_cinpm i glob 171cb0ef41Sopenharmony_ci``` 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci**Note** the npm package name is _not_ `node-glob` that's a 201cb0ef41Sopenharmony_cidifferent thing that was abandoned years ago. Just `glob`. 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci```js 231cb0ef41Sopenharmony_ci// load using import 241cb0ef41Sopenharmony_ciimport { glob, globSync, globStream, globStreamSync, Glob } from 'glob' 251cb0ef41Sopenharmony_ci// or using commonjs, that's fine, too 261cb0ef41Sopenharmony_ciconst { 271cb0ef41Sopenharmony_ci glob, 281cb0ef41Sopenharmony_ci globSync, 291cb0ef41Sopenharmony_ci globStream, 301cb0ef41Sopenharmony_ci globStreamSync, 311cb0ef41Sopenharmony_ci Glob, 321cb0ef41Sopenharmony_ci} = require('glob') 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci// the main glob() and globSync() resolve/return array of filenames 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci// all js files, but don't look in node_modules 371cb0ef41Sopenharmony_ciconst jsfiles = await glob('**/*.js', { ignore: 'node_modules/**' }) 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci// pass in a signal to cancel the glob walk 401cb0ef41Sopenharmony_ciconst stopAfter100ms = await glob('**/*.css', { 411cb0ef41Sopenharmony_ci signal: AbortSignal.timeout(100), 421cb0ef41Sopenharmony_ci}) 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ci// multiple patterns supported as well 451cb0ef41Sopenharmony_ciconst images = await glob(['css/*.{png,jpeg}', 'public/*.{png,jpeg}']) 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ci// but of course you can do that with the glob pattern also 481cb0ef41Sopenharmony_ci// the sync function is the same, just returns a string[] instead 491cb0ef41Sopenharmony_ci// of Promise<string[]> 501cb0ef41Sopenharmony_ciconst imagesAlt = globSync('{css,public}/*.{png,jpeg}') 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci// you can also stream them, this is a Minipass stream 531cb0ef41Sopenharmony_ciconst filesStream = globStream(['**/*.dat', 'logs/**/*.log']) 541cb0ef41Sopenharmony_ci 551cb0ef41Sopenharmony_ci// construct a Glob object if you wanna do it that way, which 561cb0ef41Sopenharmony_ci// allows for much faster walks if you have to look in the same 571cb0ef41Sopenharmony_ci// folder multiple times. 581cb0ef41Sopenharmony_ciconst g = new Glob('**/foo', {}) 591cb0ef41Sopenharmony_ci// glob objects are async iterators, can also do globIterate() or 601cb0ef41Sopenharmony_ci// g.iterate(), same deal 611cb0ef41Sopenharmony_cifor await (const file of g) { 621cb0ef41Sopenharmony_ci console.log('found a foo file:', file) 631cb0ef41Sopenharmony_ci} 641cb0ef41Sopenharmony_ci// pass a glob as the glob options to reuse its settings and caches 651cb0ef41Sopenharmony_ciconst g2 = new Glob('**/bar', g) 661cb0ef41Sopenharmony_ci// sync iteration works as well 671cb0ef41Sopenharmony_cifor (const file of g2) { 681cb0ef41Sopenharmony_ci console.log('found a bar file:', file) 691cb0ef41Sopenharmony_ci} 701cb0ef41Sopenharmony_ci 711cb0ef41Sopenharmony_ci// you can also pass withFileTypes: true to get Path objects 721cb0ef41Sopenharmony_ci// these are like a Dirent, but with some more added powers 731cb0ef41Sopenharmony_ci// check out http://npm.im/path-scurry for more info on their API 741cb0ef41Sopenharmony_ciconst g3 = new Glob('**/baz/**', { withFileTypes: true }) 751cb0ef41Sopenharmony_cig3.stream().on('data', path => { 761cb0ef41Sopenharmony_ci console.log( 771cb0ef41Sopenharmony_ci 'got a path object', 781cb0ef41Sopenharmony_ci path.fullpath(), 791cb0ef41Sopenharmony_ci path.isDirectory(), 801cb0ef41Sopenharmony_ci path.readdirSync().map(e => e.name) 811cb0ef41Sopenharmony_ci ) 821cb0ef41Sopenharmony_ci}) 831cb0ef41Sopenharmony_ci 841cb0ef41Sopenharmony_ci// if you use stat:true and withFileTypes, you can sort results 851cb0ef41Sopenharmony_ci// by things like modified time, filter by permission mode, etc. 861cb0ef41Sopenharmony_ci// All Stats fields will be available in that case. Slightly 871cb0ef41Sopenharmony_ci// slower, though. 881cb0ef41Sopenharmony_ci// For example: 891cb0ef41Sopenharmony_ciconst results = await glob('**', { stat: true, withFileTypes: true }) 901cb0ef41Sopenharmony_ci 911cb0ef41Sopenharmony_ciconst timeSortedFiles = results 921cb0ef41Sopenharmony_ci .sort((a, b) => a.mtimeMs - b.mtimeMs) 931cb0ef41Sopenharmony_ci .map(path => path.fullpath()) 941cb0ef41Sopenharmony_ci 951cb0ef41Sopenharmony_ciconst groupReadableFiles = results 961cb0ef41Sopenharmony_ci .filter(path => path.mode & 0o040) 971cb0ef41Sopenharmony_ci .map(path => path.fullpath()) 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci// custom ignores can be done like this, for example by saying 1001cb0ef41Sopenharmony_ci// you'll ignore all markdown files, and all folders named 'docs' 1011cb0ef41Sopenharmony_ciconst customIgnoreResults = await glob('**', { 1021cb0ef41Sopenharmony_ci ignore: { 1031cb0ef41Sopenharmony_ci ignored: p => /\.md$/.test(p.name), 1041cb0ef41Sopenharmony_ci childrenIgnored: p => p.isNamed('docs'), 1051cb0ef41Sopenharmony_ci }, 1061cb0ef41Sopenharmony_ci}) 1071cb0ef41Sopenharmony_ci 1081cb0ef41Sopenharmony_ci// another fun use case, only return files with the same name as 1091cb0ef41Sopenharmony_ci// their parent folder, plus either `.ts` or `.js` 1101cb0ef41Sopenharmony_ciconst folderNamedModules = await glob('**/*.{ts,js}', { 1111cb0ef41Sopenharmony_ci ignore: { 1121cb0ef41Sopenharmony_ci ignored: p => { 1131cb0ef41Sopenharmony_ci const pp = p.parent 1141cb0ef41Sopenharmony_ci return !(p.isNamed(pp.name + '.ts') || p.isNamed(pp.name + '.js')) 1151cb0ef41Sopenharmony_ci }, 1161cb0ef41Sopenharmony_ci }, 1171cb0ef41Sopenharmony_ci}) 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_ci// find all files edited in the last hour, to do this, we ignore 1201cb0ef41Sopenharmony_ci// all of them that are more than an hour old 1211cb0ef41Sopenharmony_ciconst newFiles = await glob('**', { 1221cb0ef41Sopenharmony_ci // need stat so we have mtime 1231cb0ef41Sopenharmony_ci stat: true, 1241cb0ef41Sopenharmony_ci // only want the files, not the dirs 1251cb0ef41Sopenharmony_ci nodir: true, 1261cb0ef41Sopenharmony_ci ignore: { 1271cb0ef41Sopenharmony_ci ignored: p => { 1281cb0ef41Sopenharmony_ci return new Date() - p.mtime > 60 * 60 * 1000 1291cb0ef41Sopenharmony_ci }, 1301cb0ef41Sopenharmony_ci // could add similar childrenIgnored here as well, but 1311cb0ef41Sopenharmony_ci // directory mtime is inconsistent across platforms, so 1321cb0ef41Sopenharmony_ci // probably better not to, unless you know the system 1331cb0ef41Sopenharmony_ci // tracks this reliably. 1341cb0ef41Sopenharmony_ci }, 1351cb0ef41Sopenharmony_ci}) 1361cb0ef41Sopenharmony_ci``` 1371cb0ef41Sopenharmony_ci 1381cb0ef41Sopenharmony_ci**Note** Glob patterns should always use `/` as a path separator, 1391cb0ef41Sopenharmony_cieven on Windows systems, as `\` is used to escape glob 1401cb0ef41Sopenharmony_cicharacters. If you wish to use `\` as a path separator _instead 1411cb0ef41Sopenharmony_ciof_ using it as an escape character on Windows platforms, you may 1421cb0ef41Sopenharmony_ciset `windowsPathsNoEscape:true` in the options. In this mode, 1431cb0ef41Sopenharmony_cispecial glob characters cannot be escaped, making it impossible 1441cb0ef41Sopenharmony_cito match a literal `*` `?` and so on in filenames. 1451cb0ef41Sopenharmony_ci 1461cb0ef41Sopenharmony_ci## Command Line Interface 1471cb0ef41Sopenharmony_ci 1481cb0ef41Sopenharmony_ci``` 1491cb0ef41Sopenharmony_ci$ glob -h 1501cb0ef41Sopenharmony_ci 1511cb0ef41Sopenharmony_ciUsage: 1521cb0ef41Sopenharmony_ci glob [options] [<pattern> [<pattern> ...]] 1531cb0ef41Sopenharmony_ci 1541cb0ef41Sopenharmony_ciExpand the positional glob expression arguments into any matching file system 1551cb0ef41Sopenharmony_cipaths found. 1561cb0ef41Sopenharmony_ci 1571cb0ef41Sopenharmony_ci -c<command> --cmd=<command> 1581cb0ef41Sopenharmony_ci Run the command provided, passing the glob expression 1591cb0ef41Sopenharmony_ci matches as arguments. 1601cb0ef41Sopenharmony_ci 1611cb0ef41Sopenharmony_ci -A --all By default, the glob cli command will not expand any 1621cb0ef41Sopenharmony_ci arguments that are an exact match to a file on disk. 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ci This prevents double-expanding, in case the shell 1651cb0ef41Sopenharmony_ci expands an argument whose filename is a glob 1661cb0ef41Sopenharmony_ci expression. 1671cb0ef41Sopenharmony_ci 1681cb0ef41Sopenharmony_ci For example, if 'app/*.ts' would match 'app/[id].ts', 1691cb0ef41Sopenharmony_ci then on Windows powershell or cmd.exe, 'glob app/*.ts' 1701cb0ef41Sopenharmony_ci will expand to 'app/[id].ts', as expected. However, in 1711cb0ef41Sopenharmony_ci posix shells such as bash or zsh, the shell will first 1721cb0ef41Sopenharmony_ci expand 'app/*.ts' to a list of filenames. Then glob 1731cb0ef41Sopenharmony_ci will look for a file matching 'app/[id].ts' (ie, 1741cb0ef41Sopenharmony_ci 'app/i.ts' or 'app/d.ts'), which is unexpected. 1751cb0ef41Sopenharmony_ci 1761cb0ef41Sopenharmony_ci Setting '--all' prevents this behavior, causing glob to 1771cb0ef41Sopenharmony_ci treat ALL patterns as glob expressions to be expanded, 1781cb0ef41Sopenharmony_ci even if they are an exact match to a file on disk. 1791cb0ef41Sopenharmony_ci 1801cb0ef41Sopenharmony_ci When setting this option, be sure to enquote arguments 1811cb0ef41Sopenharmony_ci so that the shell will not expand them prior to passing 1821cb0ef41Sopenharmony_ci them to the glob command process. 1831cb0ef41Sopenharmony_ci 1841cb0ef41Sopenharmony_ci -a --absolute Expand to absolute paths 1851cb0ef41Sopenharmony_ci -d --dot-relative Prepend './' on relative matches 1861cb0ef41Sopenharmony_ci -m --mark Append a / on any directories matched 1871cb0ef41Sopenharmony_ci -x --posix Always resolve to posix style paths, using '/' as the 1881cb0ef41Sopenharmony_ci directory separator, even on Windows. Drive letter 1891cb0ef41Sopenharmony_ci absolute matches on Windows will be expanded to their 1901cb0ef41Sopenharmony_ci full resolved UNC maths, eg instead of 'C:\foo\bar', it 1911cb0ef41Sopenharmony_ci will expand to '//?/C:/foo/bar'. 1921cb0ef41Sopenharmony_ci 1931cb0ef41Sopenharmony_ci -f --follow Follow symlinked directories when expanding '**' 1941cb0ef41Sopenharmony_ci -R --realpath Call 'fs.realpath' on all of the results. In the case 1951cb0ef41Sopenharmony_ci of an entry that cannot be resolved, the entry is 1961cb0ef41Sopenharmony_ci omitted. This incurs a slight performance penalty, of 1971cb0ef41Sopenharmony_ci course, because of the added system calls. 1981cb0ef41Sopenharmony_ci 1991cb0ef41Sopenharmony_ci -s --stat Call 'fs.lstat' on all entries, whether required or not 2001cb0ef41Sopenharmony_ci to determine if it's a valid match. 2011cb0ef41Sopenharmony_ci 2021cb0ef41Sopenharmony_ci -b --match-base Perform a basename-only match if the pattern does not 2031cb0ef41Sopenharmony_ci contain any slash characters. That is, '*.js' would be 2041cb0ef41Sopenharmony_ci treated as equivalent to '**/*.js', matching js files 2051cb0ef41Sopenharmony_ci in all directories. 2061cb0ef41Sopenharmony_ci 2071cb0ef41Sopenharmony_ci --dot Allow patterns to match files/directories that start 2081cb0ef41Sopenharmony_ci with '.', even if the pattern does not start with '.' 2091cb0ef41Sopenharmony_ci 2101cb0ef41Sopenharmony_ci --nobrace Do not expand {...} patterns 2111cb0ef41Sopenharmony_ci --nocase Perform a case-insensitive match. This defaults to 2121cb0ef41Sopenharmony_ci 'true' on macOS and Windows platforms, and false on all 2131cb0ef41Sopenharmony_ci others. 2141cb0ef41Sopenharmony_ci 2151cb0ef41Sopenharmony_ci Note: 'nocase' should only be explicitly set when it is 2161cb0ef41Sopenharmony_ci known that the filesystem's case sensitivity differs 2171cb0ef41Sopenharmony_ci from the platform default. If set 'true' on 2181cb0ef41Sopenharmony_ci case-insensitive file systems, then the walk may return 2191cb0ef41Sopenharmony_ci more or less results than expected. 2201cb0ef41Sopenharmony_ci 2211cb0ef41Sopenharmony_ci --nodir Do not match directories, only files. 2221cb0ef41Sopenharmony_ci 2231cb0ef41Sopenharmony_ci Note: to *only* match directories, append a '/' at the 2241cb0ef41Sopenharmony_ci end of the pattern. 2251cb0ef41Sopenharmony_ci 2261cb0ef41Sopenharmony_ci --noext Do not expand extglob patterns, such as '+(a|b)' 2271cb0ef41Sopenharmony_ci --noglobstar Do not expand '**' against multiple path portions. Ie, 2281cb0ef41Sopenharmony_ci treat it as a normal '*' instead. 2291cb0ef41Sopenharmony_ci 2301cb0ef41Sopenharmony_ci --windows-path-no-escape 2311cb0ef41Sopenharmony_ci Use '\' as a path separator *only*, and *never* as an 2321cb0ef41Sopenharmony_ci escape character. If set, all '\' characters are 2331cb0ef41Sopenharmony_ci replaced with '/' in the pattern. 2341cb0ef41Sopenharmony_ci 2351cb0ef41Sopenharmony_ci -D<n> --max-depth=<n> Maximum depth to traverse from the current working 2361cb0ef41Sopenharmony_ci directory 2371cb0ef41Sopenharmony_ci 2381cb0ef41Sopenharmony_ci -C<cwd> --cwd=<cwd> Current working directory to execute/match in 2391cb0ef41Sopenharmony_ci -r<root> --root=<root> A string path resolved against the 'cwd', which is used 2401cb0ef41Sopenharmony_ci as the starting point for absolute patterns that start 2411cb0ef41Sopenharmony_ci with '/' (but not drive letters or UNC paths on 2421cb0ef41Sopenharmony_ci Windows). 2431cb0ef41Sopenharmony_ci 2441cb0ef41Sopenharmony_ci Note that this *doesn't* necessarily limit the walk to 2451cb0ef41Sopenharmony_ci the 'root' directory, and doesn't affect the cwd 2461cb0ef41Sopenharmony_ci starting point for non-absolute patterns. A pattern 2471cb0ef41Sopenharmony_ci containing '..' will still be able to traverse out of 2481cb0ef41Sopenharmony_ci the root directory, if it is not an actual root 2491cb0ef41Sopenharmony_ci directory on the filesystem, and any non-absolute 2501cb0ef41Sopenharmony_ci patterns will still be matched in the 'cwd'. 2511cb0ef41Sopenharmony_ci 2521cb0ef41Sopenharmony_ci To start absolute and non-absolute patterns in the same 2531cb0ef41Sopenharmony_ci path, you can use '--root=' to set it to the empty 2541cb0ef41Sopenharmony_ci string. However, be aware that on Windows systems, a 2551cb0ef41Sopenharmony_ci pattern like 'x:/*' or '//host/share/*' will *always* 2561cb0ef41Sopenharmony_ci start in the 'x:/' or '//host/share/' directory, 2571cb0ef41Sopenharmony_ci regardless of the --root setting. 2581cb0ef41Sopenharmony_ci 2591cb0ef41Sopenharmony_ci --platform=<platform> Defaults to the value of 'process.platform' if 2601cb0ef41Sopenharmony_ci available, or 'linux' if not. Setting --platform=win32 2611cb0ef41Sopenharmony_ci on non-Windows systems may cause strange behavior! 2621cb0ef41Sopenharmony_ci 2631cb0ef41Sopenharmony_ci -i<ignore> --ignore=<ignore> 2641cb0ef41Sopenharmony_ci Glob patterns to ignore Can be set multiple times 2651cb0ef41Sopenharmony_ci -v --debug Output a huge amount of noisy debug information about 2661cb0ef41Sopenharmony_ci patterns as they are parsed and used to match files. 2671cb0ef41Sopenharmony_ci 2681cb0ef41Sopenharmony_ci -h --help Show this usage information 2691cb0ef41Sopenharmony_ci``` 2701cb0ef41Sopenharmony_ci 2711cb0ef41Sopenharmony_ci## `glob(pattern: string | string[], options?: GlobOptions) => Promise<string[] | Path[]>` 2721cb0ef41Sopenharmony_ci 2731cb0ef41Sopenharmony_ciPerform an asynchronous glob search for the pattern(s) specified. 2741cb0ef41Sopenharmony_ciReturns 2751cb0ef41Sopenharmony_ci[Path](https://isaacs.github.io/path-scurry/classes/PathBase) 2761cb0ef41Sopenharmony_ciobjects if the `withFileTypes` option is set to `true`. See below 2771cb0ef41Sopenharmony_cifor full options field desciptions. 2781cb0ef41Sopenharmony_ci 2791cb0ef41Sopenharmony_ci## `globSync(pattern: string | string[], options?: GlobOptions) => string[] | Path[]` 2801cb0ef41Sopenharmony_ci 2811cb0ef41Sopenharmony_ciSynchronous form of `glob()`. 2821cb0ef41Sopenharmony_ci 2831cb0ef41Sopenharmony_ciAlias: `glob.sync()` 2841cb0ef41Sopenharmony_ci 2851cb0ef41Sopenharmony_ci## `globIterate(pattern: string | string[], options?: GlobOptions) => AsyncGenerator<string>` 2861cb0ef41Sopenharmony_ci 2871cb0ef41Sopenharmony_ciReturn an async iterator for walking glob pattern matches. 2881cb0ef41Sopenharmony_ci 2891cb0ef41Sopenharmony_ciAlias: `glob.iterate()` 2901cb0ef41Sopenharmony_ci 2911cb0ef41Sopenharmony_ci## `globIterateSync(pattern: string | string[], options?: GlobOptions) => Generator<string>` 2921cb0ef41Sopenharmony_ci 2931cb0ef41Sopenharmony_ciReturn a sync iterator for walking glob pattern matches. 2941cb0ef41Sopenharmony_ci 2951cb0ef41Sopenharmony_ciAlias: `glob.iterate.sync()`, `glob.sync.iterate()` 2961cb0ef41Sopenharmony_ci 2971cb0ef41Sopenharmony_ci## `globStream(pattern: string | string[], options?: GlobOptions) => Minipass<string | Path>` 2981cb0ef41Sopenharmony_ci 2991cb0ef41Sopenharmony_ciReturn a stream that emits all the strings or `Path` objects and 3001cb0ef41Sopenharmony_cithen emits `end` when completed. 3011cb0ef41Sopenharmony_ci 3021cb0ef41Sopenharmony_ciAlias: `glob.stream()` 3031cb0ef41Sopenharmony_ci 3041cb0ef41Sopenharmony_ci## `globStreamSync(pattern: string | string[], options?: GlobOptions) => Minipass<string | Path>` 3051cb0ef41Sopenharmony_ci 3061cb0ef41Sopenharmony_ciSyncronous form of `globStream()`. Will read all the matches as 3071cb0ef41Sopenharmony_cifast as you consume them, even all in a single tick if you 3081cb0ef41Sopenharmony_ciconsume them immediately, but will still respond to backpressure 3091cb0ef41Sopenharmony_ciif they're not consumed immediately. 3101cb0ef41Sopenharmony_ci 3111cb0ef41Sopenharmony_ciAlias: `glob.stream.sync()`, `glob.sync.stream()` 3121cb0ef41Sopenharmony_ci 3131cb0ef41Sopenharmony_ci## `hasMagic(pattern: string | string[], options?: GlobOptions) => boolean` 3141cb0ef41Sopenharmony_ci 3151cb0ef41Sopenharmony_ciReturns `true` if the provided pattern contains any "magic" glob 3161cb0ef41Sopenharmony_cicharacters, given the options provided. 3171cb0ef41Sopenharmony_ci 3181cb0ef41Sopenharmony_ciBrace expansion is not considered "magic" unless the 3191cb0ef41Sopenharmony_ci`magicalBraces` option is set, as brace expansion just turns one 3201cb0ef41Sopenharmony_cistring into an array of strings. So a pattern like `'x{a,b}y'` 3211cb0ef41Sopenharmony_ciwould return `false`, because `'xay'` and `'xby'` both do not 3221cb0ef41Sopenharmony_cicontain any magic glob characters, and it's treated the same as 3231cb0ef41Sopenharmony_ciif you had called it on `['xay', 'xby']`. When 3241cb0ef41Sopenharmony_ci`magicalBraces:true` is in the options, brace expansion _is_ 3251cb0ef41Sopenharmony_citreated as a pattern having magic. 3261cb0ef41Sopenharmony_ci 3271cb0ef41Sopenharmony_ci## `escape(pattern: string, options?: GlobOptions) => string` 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ciEscape all magic characters in a glob pattern, so that it will 3301cb0ef41Sopenharmony_cionly ever match literal strings 3311cb0ef41Sopenharmony_ci 3321cb0ef41Sopenharmony_ciIf the `windowsPathsNoEscape` option is used, then characters are 3331cb0ef41Sopenharmony_ciescaped by wrapping in `[]`, because a magic character wrapped in 3341cb0ef41Sopenharmony_cia character class can only be satisfied by that exact character. 3351cb0ef41Sopenharmony_ci 3361cb0ef41Sopenharmony_ciSlashes (and backslashes in `windowsPathsNoEscape` mode) cannot 3371cb0ef41Sopenharmony_cibe escaped or unescaped. 3381cb0ef41Sopenharmony_ci 3391cb0ef41Sopenharmony_ci## `unescape(pattern: string, options?: GlobOptions) => string` 3401cb0ef41Sopenharmony_ci 3411cb0ef41Sopenharmony_ciUn-escape a glob string that may contain some escaped characters. 3421cb0ef41Sopenharmony_ci 3431cb0ef41Sopenharmony_ciIf the `windowsPathsNoEscape` option is used, then square-brace 3441cb0ef41Sopenharmony_ciescapes are removed, but not backslash escapes. For example, it 3451cb0ef41Sopenharmony_ciwill turn the string `'[*]'` into `*`, but it will not turn 3461cb0ef41Sopenharmony_ci`'\\*'` into `'*'`, because `\` is a path separator in 3471cb0ef41Sopenharmony_ci`windowsPathsNoEscape` mode. 3481cb0ef41Sopenharmony_ci 3491cb0ef41Sopenharmony_ciWhen `windowsPathsNoEscape` is not set, then both brace escapes 3501cb0ef41Sopenharmony_ciand backslash escapes are removed. 3511cb0ef41Sopenharmony_ci 3521cb0ef41Sopenharmony_ciSlashes (and backslashes in `windowsPathsNoEscape` mode) cannot 3531cb0ef41Sopenharmony_cibe escaped or unescaped. 3541cb0ef41Sopenharmony_ci 3551cb0ef41Sopenharmony_ci## Class `Glob` 3561cb0ef41Sopenharmony_ci 3571cb0ef41Sopenharmony_ciAn object that can perform glob pattern traversals. 3581cb0ef41Sopenharmony_ci 3591cb0ef41Sopenharmony_ci### `const g = new Glob(pattern: string | string[], options: GlobOptions)` 3601cb0ef41Sopenharmony_ci 3611cb0ef41Sopenharmony_ciOptions object is required. 3621cb0ef41Sopenharmony_ci 3631cb0ef41Sopenharmony_ciSee full options descriptions below. 3641cb0ef41Sopenharmony_ci 3651cb0ef41Sopenharmony_ciNote that a previous `Glob` object can be passed as the 3661cb0ef41Sopenharmony_ci`GlobOptions` to another `Glob` instantiation to re-use settings 3671cb0ef41Sopenharmony_ciand caches with a new pattern. 3681cb0ef41Sopenharmony_ci 3691cb0ef41Sopenharmony_ciTraversal functions can be called multiple times to run the walk 3701cb0ef41Sopenharmony_ciagain. 3711cb0ef41Sopenharmony_ci 3721cb0ef41Sopenharmony_ci### `g.stream()` 3731cb0ef41Sopenharmony_ci 3741cb0ef41Sopenharmony_ciStream results asynchronously, 3751cb0ef41Sopenharmony_ci 3761cb0ef41Sopenharmony_ci### `g.streamSync()` 3771cb0ef41Sopenharmony_ci 3781cb0ef41Sopenharmony_ciStream results synchronously. 3791cb0ef41Sopenharmony_ci 3801cb0ef41Sopenharmony_ci### `g.iterate()` 3811cb0ef41Sopenharmony_ci 3821cb0ef41Sopenharmony_ciDefault async iteration function. Returns an AsyncGenerator that 3831cb0ef41Sopenharmony_ciiterates over the results. 3841cb0ef41Sopenharmony_ci 3851cb0ef41Sopenharmony_ci### `g.iterateSync()` 3861cb0ef41Sopenharmony_ci 3871cb0ef41Sopenharmony_ciDefault sync iteration function. Returns a Generator that 3881cb0ef41Sopenharmony_ciiterates over the results. 3891cb0ef41Sopenharmony_ci 3901cb0ef41Sopenharmony_ci### `g.walk()` 3911cb0ef41Sopenharmony_ci 3921cb0ef41Sopenharmony_ciReturns a Promise that resolves to the results array. 3931cb0ef41Sopenharmony_ci 3941cb0ef41Sopenharmony_ci### `g.walkSync()` 3951cb0ef41Sopenharmony_ci 3961cb0ef41Sopenharmony_ciReturns a results array. 3971cb0ef41Sopenharmony_ci 3981cb0ef41Sopenharmony_ci### Properties 3991cb0ef41Sopenharmony_ci 4001cb0ef41Sopenharmony_ciAll options are stored as properties on the `Glob` object. 4011cb0ef41Sopenharmony_ci 4021cb0ef41Sopenharmony_ci- `opts` The options provided to the constructor. 4031cb0ef41Sopenharmony_ci- `patterns` An array of parsed immutable `Pattern` objects. 4041cb0ef41Sopenharmony_ci 4051cb0ef41Sopenharmony_ci## Options 4061cb0ef41Sopenharmony_ci 4071cb0ef41Sopenharmony_ciExported as `GlobOptions` TypeScript interface. A `GlobOptions` 4081cb0ef41Sopenharmony_ciobject may be provided to any of the exported methods, and must 4091cb0ef41Sopenharmony_cibe provided to the `Glob` constructor. 4101cb0ef41Sopenharmony_ci 4111cb0ef41Sopenharmony_ciAll options are optional, boolean, and false by default, unless 4121cb0ef41Sopenharmony_ciotherwise noted. 4131cb0ef41Sopenharmony_ci 4141cb0ef41Sopenharmony_ciAll resolved options are added to the Glob object as properties. 4151cb0ef41Sopenharmony_ci 4161cb0ef41Sopenharmony_ciIf you are running many `glob` operations, you can pass a Glob 4171cb0ef41Sopenharmony_ciobject as the `options` argument to a subsequent operation to 4181cb0ef41Sopenharmony_cishare the previously loaded cache. 4191cb0ef41Sopenharmony_ci 4201cb0ef41Sopenharmony_ci- `cwd` String path or `file://` string or URL object. The 4211cb0ef41Sopenharmony_ci current working directory in which to search. Defaults to 4221cb0ef41Sopenharmony_ci `process.cwd()`. See also: "Windows, CWDs, Drive Letters, and 4231cb0ef41Sopenharmony_ci UNC Paths", below. 4241cb0ef41Sopenharmony_ci 4251cb0ef41Sopenharmony_ci This option may be eiher a string path or a `file://` URL 4261cb0ef41Sopenharmony_ci object or string. 4271cb0ef41Sopenharmony_ci 4281cb0ef41Sopenharmony_ci- `root` A string path resolved against the `cwd` option, which 4291cb0ef41Sopenharmony_ci is used as the starting point for absolute patterns that start 4301cb0ef41Sopenharmony_ci with `/`, (but not drive letters or UNC paths on Windows). 4311cb0ef41Sopenharmony_ci 4321cb0ef41Sopenharmony_ci Note that this _doesn't_ necessarily limit the walk to the 4331cb0ef41Sopenharmony_ci `root` directory, and doesn't affect the cwd starting point for 4341cb0ef41Sopenharmony_ci non-absolute patterns. A pattern containing `..` will still be 4351cb0ef41Sopenharmony_ci able to traverse out of the root directory, if it is not an 4361cb0ef41Sopenharmony_ci actual root directory on the filesystem, and any non-absolute 4371cb0ef41Sopenharmony_ci patterns will be matched in the `cwd`. For example, the 4381cb0ef41Sopenharmony_ci pattern `/../*` with `{root:'/some/path'}` will return all 4391cb0ef41Sopenharmony_ci files in `/some`, not all files in `/some/path`. The pattern 4401cb0ef41Sopenharmony_ci `*` with `{root:'/some/path'}` will return all the entries in 4411cb0ef41Sopenharmony_ci the cwd, not the entries in `/some/path`. 4421cb0ef41Sopenharmony_ci 4431cb0ef41Sopenharmony_ci To start absolute and non-absolute patterns in the same 4441cb0ef41Sopenharmony_ci path, you can use `{root:''}`. However, be aware that on 4451cb0ef41Sopenharmony_ci Windows systems, a pattern like `x:/*` or `//host/share/*` will 4461cb0ef41Sopenharmony_ci _always_ start in the `x:/` or `//host/share` directory, 4471cb0ef41Sopenharmony_ci regardless of the `root` setting. 4481cb0ef41Sopenharmony_ci 4491cb0ef41Sopenharmony_ci- `windowsPathsNoEscape` Use `\\` as a path separator _only_, and 4501cb0ef41Sopenharmony_ci _never_ as an escape character. If set, all `\\` characters are 4511cb0ef41Sopenharmony_ci replaced with `/` in the pattern. 4521cb0ef41Sopenharmony_ci 4531cb0ef41Sopenharmony_ci Note that this makes it **impossible** to match against paths 4541cb0ef41Sopenharmony_ci containing literal glob pattern characters, but allows matching 4551cb0ef41Sopenharmony_ci with patterns constructed using `path.join()` and 4561cb0ef41Sopenharmony_ci `path.resolve()` on Windows platforms, mimicking the (buggy!) 4571cb0ef41Sopenharmony_ci behavior of Glob v7 and before on Windows. Please use with 4581cb0ef41Sopenharmony_ci caution, and be mindful of [the caveat below about Windows 4591cb0ef41Sopenharmony_ci paths](#windows). (For legacy reasons, this is also set if 4601cb0ef41Sopenharmony_ci `allowWindowsEscape` is set to the exact value `false`.) 4611cb0ef41Sopenharmony_ci 4621cb0ef41Sopenharmony_ci- `dot` Include `.dot` files in normal matches and `globstar` 4631cb0ef41Sopenharmony_ci matches. Note that an explicit dot in a portion of the pattern 4641cb0ef41Sopenharmony_ci will always match dot files. 4651cb0ef41Sopenharmony_ci 4661cb0ef41Sopenharmony_ci- `magicalBraces` Treat brace expansion like `{a,b}` as a "magic" 4671cb0ef41Sopenharmony_ci pattern. Has no effect if {@link nobrace} is set. 4681cb0ef41Sopenharmony_ci 4691cb0ef41Sopenharmony_ci Only has effect on the {@link hasMagic} function, no effect on 4701cb0ef41Sopenharmony_ci glob pattern matching itself. 4711cb0ef41Sopenharmony_ci 4721cb0ef41Sopenharmony_ci- `dotRelative` Prepend all relative path strings with `./` (or 4731cb0ef41Sopenharmony_ci `.\` on Windows). 4741cb0ef41Sopenharmony_ci 4751cb0ef41Sopenharmony_ci Without this option, returned relative paths are "bare", so 4761cb0ef41Sopenharmony_ci instead of returning `'./foo/bar'`, they are returned as 4771cb0ef41Sopenharmony_ci `'foo/bar'`. 4781cb0ef41Sopenharmony_ci 4791cb0ef41Sopenharmony_ci Relative patterns starting with `'../'` are not prepended with 4801cb0ef41Sopenharmony_ci `./`, even if this option is set. 4811cb0ef41Sopenharmony_ci 4821cb0ef41Sopenharmony_ci- `mark` Add a `/` character to directory matches. Note that this 4831cb0ef41Sopenharmony_ci requires additional stat calls. 4841cb0ef41Sopenharmony_ci 4851cb0ef41Sopenharmony_ci- `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. 4861cb0ef41Sopenharmony_ci 4871cb0ef41Sopenharmony_ci- `noglobstar` Do not match `**` against multiple filenames. (Ie, 4881cb0ef41Sopenharmony_ci treat it as a normal `*` instead.) 4891cb0ef41Sopenharmony_ci 4901cb0ef41Sopenharmony_ci- `noext` Do not match "extglob" patterns such as `+(a|b)`. 4911cb0ef41Sopenharmony_ci 4921cb0ef41Sopenharmony_ci- `nocase` Perform a case-insensitive match. This defaults to 4931cb0ef41Sopenharmony_ci `true` on macOS and Windows systems, and `false` on all others. 4941cb0ef41Sopenharmony_ci 4951cb0ef41Sopenharmony_ci **Note** `nocase` should only be explicitly set when it is 4961cb0ef41Sopenharmony_ci known that the filesystem's case sensitivity differs from the 4971cb0ef41Sopenharmony_ci platform default. If set `true` on case-sensitive file 4981cb0ef41Sopenharmony_ci systems, or `false` on case-insensitive file systems, then the 4991cb0ef41Sopenharmony_ci walk may return more or less results than expected. 5001cb0ef41Sopenharmony_ci 5011cb0ef41Sopenharmony_ci- `maxDepth` Specify a number to limit the depth of the directory 5021cb0ef41Sopenharmony_ci traversal to this many levels below the `cwd`. 5031cb0ef41Sopenharmony_ci 5041cb0ef41Sopenharmony_ci- `matchBase` Perform a basename-only match if the pattern does 5051cb0ef41Sopenharmony_ci not contain any slash characters. That is, `*.js` would be 5061cb0ef41Sopenharmony_ci treated as equivalent to `**/*.js`, matching all js files in 5071cb0ef41Sopenharmony_ci all directories. 5081cb0ef41Sopenharmony_ci 5091cb0ef41Sopenharmony_ci- `nodir` Do not match directories, only files. (Note: to match 5101cb0ef41Sopenharmony_ci _only_ directories, put a `/` at the end of the pattern.) 5111cb0ef41Sopenharmony_ci 5121cb0ef41Sopenharmony_ci- `stat` Call `lstat()` on all entries, whether required or not 5131cb0ef41Sopenharmony_ci to determine whether it's a valid match. When used with 5141cb0ef41Sopenharmony_ci `withFileTypes`, this means that matches will include data such 5151cb0ef41Sopenharmony_ci as modified time, permissions, and so on. Note that this will 5161cb0ef41Sopenharmony_ci incur a performance cost due to the added system calls. 5171cb0ef41Sopenharmony_ci 5181cb0ef41Sopenharmony_ci- `ignore` string or string[], or an object with `ignore` and 5191cb0ef41Sopenharmony_ci `ignoreChildren` methods. 5201cb0ef41Sopenharmony_ci 5211cb0ef41Sopenharmony_ci If a string or string[] is provided, then this is treated as a 5221cb0ef41Sopenharmony_ci glob pattern or array of glob patterns to exclude from matches. 5231cb0ef41Sopenharmony_ci To ignore all children within a directory, as well as the entry 5241cb0ef41Sopenharmony_ci itself, append `'/**'` to the ignore pattern. 5251cb0ef41Sopenharmony_ci 5261cb0ef41Sopenharmony_ci **Note** `ignore` patterns are _always_ in `dot:true` mode, 5271cb0ef41Sopenharmony_ci regardless of any other settings. 5281cb0ef41Sopenharmony_ci 5291cb0ef41Sopenharmony_ci If an object is provided that has `ignored(path)` and/or 5301cb0ef41Sopenharmony_ci `childrenIgnored(path)` methods, then these methods will be 5311cb0ef41Sopenharmony_ci called to determine whether any Path is a match or if its 5321cb0ef41Sopenharmony_ci children should be traversed, respectively. 5331cb0ef41Sopenharmony_ci 5341cb0ef41Sopenharmony_ci- `follow` Follow symlinked directories when expanding `**` 5351cb0ef41Sopenharmony_ci patterns. This can result in a lot of duplicate references in 5361cb0ef41Sopenharmony_ci the presence of cyclic links, and make performance quite bad. 5371cb0ef41Sopenharmony_ci 5381cb0ef41Sopenharmony_ci By default, a `**` in a pattern will follow 1 symbolic link if 5391cb0ef41Sopenharmony_ci it is not the first item in the pattern, or none if it is the 5401cb0ef41Sopenharmony_ci first item in the pattern, following the same behavior as Bash. 5411cb0ef41Sopenharmony_ci 5421cb0ef41Sopenharmony_ci- `realpath` Set to true to call `fs.realpath` on all of the 5431cb0ef41Sopenharmony_ci results. In the case of an entry that cannot be resolved, the 5441cb0ef41Sopenharmony_ci entry is omitted. This incurs a slight performance penalty, of 5451cb0ef41Sopenharmony_ci course, because of the added system calls. 5461cb0ef41Sopenharmony_ci 5471cb0ef41Sopenharmony_ci- `absolute` Set to true to always receive absolute paths for 5481cb0ef41Sopenharmony_ci matched files. Set to `false` to always receive relative paths 5491cb0ef41Sopenharmony_ci for matched files. 5501cb0ef41Sopenharmony_ci 5511cb0ef41Sopenharmony_ci By default, when this option is not set, absolute paths are 5521cb0ef41Sopenharmony_ci returned for patterns that are absolute, and otherwise paths 5531cb0ef41Sopenharmony_ci are returned that are relative to the `cwd` setting. 5541cb0ef41Sopenharmony_ci 5551cb0ef41Sopenharmony_ci This does _not_ make an extra system call to get the realpath, 5561cb0ef41Sopenharmony_ci it only does string path resolution. 5571cb0ef41Sopenharmony_ci 5581cb0ef41Sopenharmony_ci `absolute` may not be used along with `withFileTypes`. 5591cb0ef41Sopenharmony_ci 5601cb0ef41Sopenharmony_ci- `posix` Set to true to use `/` as the path separator in 5611cb0ef41Sopenharmony_ci returned results. On posix systems, this has no effect. On 5621cb0ef41Sopenharmony_ci Windows systems, this will return `/` delimited path results, 5631cb0ef41Sopenharmony_ci and absolute paths will be returned in their full resolved UNC 5641cb0ef41Sopenharmony_ci path form, eg insted of `'C:\\foo\\bar'`, it will return 5651cb0ef41Sopenharmony_ci `//?/C:/foo/bar`. 5661cb0ef41Sopenharmony_ci 5671cb0ef41Sopenharmony_ci- `platform` Defaults to value of `process.platform` if 5681cb0ef41Sopenharmony_ci available, or `'linux'` if not. Setting `platform:'win32'` on 5691cb0ef41Sopenharmony_ci non-Windows systems may cause strange behavior. 5701cb0ef41Sopenharmony_ci 5711cb0ef41Sopenharmony_ci- `withFileTypes` Return [PathScurry](http://npm.im/path-scurry) 5721cb0ef41Sopenharmony_ci `Path` objects instead of strings. These are similar to a 5731cb0ef41Sopenharmony_ci NodeJS `Dirent` object, but with additional methods and 5741cb0ef41Sopenharmony_ci properties. 5751cb0ef41Sopenharmony_ci 5761cb0ef41Sopenharmony_ci `withFileTypes` may not be used along with `absolute`. 5771cb0ef41Sopenharmony_ci 5781cb0ef41Sopenharmony_ci- `signal` An AbortSignal which will cancel the Glob walk when 5791cb0ef41Sopenharmony_ci triggered. 5801cb0ef41Sopenharmony_ci 5811cb0ef41Sopenharmony_ci- `fs` An override object to pass in custom filesystem methods. 5821cb0ef41Sopenharmony_ci See [PathScurry docs](http://npm.im/path-scurry) for what can 5831cb0ef41Sopenharmony_ci be overridden. 5841cb0ef41Sopenharmony_ci 5851cb0ef41Sopenharmony_ci- `scurry` A [PathScurry](http://npm.im/path-scurry) object used 5861cb0ef41Sopenharmony_ci to traverse the file system. If the `nocase` option is set 5871cb0ef41Sopenharmony_ci explicitly, then any provided `scurry` object must match this 5881cb0ef41Sopenharmony_ci setting. 5891cb0ef41Sopenharmony_ci 5901cb0ef41Sopenharmony_ci## Glob Primer 5911cb0ef41Sopenharmony_ci 5921cb0ef41Sopenharmony_ciMuch more information about glob pattern expansion can be found 5931cb0ef41Sopenharmony_ciby running `man bash` and searching for `Pattern Matching`. 5941cb0ef41Sopenharmony_ci 5951cb0ef41Sopenharmony_ci"Globs" are the patterns you type when you do stuff like `ls 5961cb0ef41Sopenharmony_ci*.js` on the command line, or put `build/*` in a `.gitignore` 5971cb0ef41Sopenharmony_cifile. 5981cb0ef41Sopenharmony_ci 5991cb0ef41Sopenharmony_ciBefore parsing the path part patterns, braced sections are 6001cb0ef41Sopenharmony_ciexpanded into a set. Braced sections start with `{` and end with 6011cb0ef41Sopenharmony_ci`}`, with 2 or more comma-delimited sections within. Braced 6021cb0ef41Sopenharmony_cisections may contain slash characters, so `a{/b/c,bcd}` would 6031cb0ef41Sopenharmony_ciexpand into `a/b/c` and `abcd`. 6041cb0ef41Sopenharmony_ci 6051cb0ef41Sopenharmony_ciThe following characters have special magic meaning when used in 6061cb0ef41Sopenharmony_cia path portion. With the exception of `**`, none of these match 6071cb0ef41Sopenharmony_cipath separators (ie, `/` on all platforms, and `\` on Windows). 6081cb0ef41Sopenharmony_ci 6091cb0ef41Sopenharmony_ci- `*` Matches 0 or more characters in a single path portion. 6101cb0ef41Sopenharmony_ci When alone in a path portion, it must match at least 1 6111cb0ef41Sopenharmony_ci character. If `dot:true` is not specified, then `*` will not 6121cb0ef41Sopenharmony_ci match against a `.` character at the start of a path portion. 6131cb0ef41Sopenharmony_ci- `?` Matches 1 character. If `dot:true` is not specified, then 6141cb0ef41Sopenharmony_ci `?` will not match against a `.` character at the start of a 6151cb0ef41Sopenharmony_ci path portion. 6161cb0ef41Sopenharmony_ci- `[...]` Matches a range of characters, similar to a RegExp 6171cb0ef41Sopenharmony_ci range. If the first character of the range is `!` or `^` then 6181cb0ef41Sopenharmony_ci it matches any character not in the range. If the first 6191cb0ef41Sopenharmony_ci character is `]`, then it will be considered the same as `\]`, 6201cb0ef41Sopenharmony_ci rather than the end of the character class. 6211cb0ef41Sopenharmony_ci- `!(pattern|pattern|pattern)` Matches anything that does not 6221cb0ef41Sopenharmony_ci match any of the patterns provided. May _not_ contain `/` 6231cb0ef41Sopenharmony_ci characters. Similar to `*`, if alone in a path portion, then 6241cb0ef41Sopenharmony_ci the path portion must have at least one character. 6251cb0ef41Sopenharmony_ci- `?(pattern|pattern|pattern)` Matches zero or one occurrence of 6261cb0ef41Sopenharmony_ci the patterns provided. May _not_ contain `/` characters. 6271cb0ef41Sopenharmony_ci- `+(pattern|pattern|pattern)` Matches one or more occurrences of 6281cb0ef41Sopenharmony_ci the patterns provided. May _not_ contain `/` characters. 6291cb0ef41Sopenharmony_ci- `*(a|b|c)` Matches zero or more occurrences of the patterns 6301cb0ef41Sopenharmony_ci provided. May _not_ contain `/` characters. 6311cb0ef41Sopenharmony_ci- `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns 6321cb0ef41Sopenharmony_ci provided. May _not_ contain `/` characters. 6331cb0ef41Sopenharmony_ci- `**` If a "globstar" is alone in a path portion, then it 6341cb0ef41Sopenharmony_ci matches zero or more directories and subdirectories searching 6351cb0ef41Sopenharmony_ci for matches. It does not crawl symlinked directories, unless 6361cb0ef41Sopenharmony_ci `{follow:true}` is passed in the options object. A pattern 6371cb0ef41Sopenharmony_ci like `a/b/**` will only match `a/b` if it is a directory. 6381cb0ef41Sopenharmony_ci Follows 1 symbolic link if not the first item in the pattern, 6391cb0ef41Sopenharmony_ci or 0 if it is the first item, unless `follow:true` is set, in 6401cb0ef41Sopenharmony_ci which case it follows all symbolic links. 6411cb0ef41Sopenharmony_ci 6421cb0ef41Sopenharmony_ci`[:class:]` patterns are supported by this implementation, but 6431cb0ef41Sopenharmony_ci`[=c=]` and `[.symbol.]` style class patterns are not. 6441cb0ef41Sopenharmony_ci 6451cb0ef41Sopenharmony_ci### Dots 6461cb0ef41Sopenharmony_ci 6471cb0ef41Sopenharmony_ciIf a file or directory path portion has a `.` as the first 6481cb0ef41Sopenharmony_cicharacter, then it will not match any glob pattern unless that 6491cb0ef41Sopenharmony_cipattern's corresponding path part also has a `.` as its first 6501cb0ef41Sopenharmony_cicharacter. 6511cb0ef41Sopenharmony_ci 6521cb0ef41Sopenharmony_ciFor example, the pattern `a/.*/c` would match the file at 6531cb0ef41Sopenharmony_ci`a/.b/c`. However the pattern `a/*/c` would not, because `*` does 6541cb0ef41Sopenharmony_cinot start with a dot character. 6551cb0ef41Sopenharmony_ci 6561cb0ef41Sopenharmony_ciYou can make glob treat dots as normal characters by setting 6571cb0ef41Sopenharmony_ci`dot:true` in the options. 6581cb0ef41Sopenharmony_ci 6591cb0ef41Sopenharmony_ci### Basename Matching 6601cb0ef41Sopenharmony_ci 6611cb0ef41Sopenharmony_ciIf you set `matchBase:true` in the options, and the pattern has 6621cb0ef41Sopenharmony_cino slashes in it, then it will seek for any file anywhere in the 6631cb0ef41Sopenharmony_citree with a matching basename. For example, `*.js` would match 6641cb0ef41Sopenharmony_ci`test/simple/basic.js`. 6651cb0ef41Sopenharmony_ci 6661cb0ef41Sopenharmony_ci### Empty Sets 6671cb0ef41Sopenharmony_ci 6681cb0ef41Sopenharmony_ciIf no matching files are found, then an empty array is returned. 6691cb0ef41Sopenharmony_ciThis differs from the shell, where the pattern itself is 6701cb0ef41Sopenharmony_cireturned. For example: 6711cb0ef41Sopenharmony_ci 6721cb0ef41Sopenharmony_ci```sh 6731cb0ef41Sopenharmony_ci$ echo a*s*d*f 6741cb0ef41Sopenharmony_cia*s*d*f 6751cb0ef41Sopenharmony_ci``` 6761cb0ef41Sopenharmony_ci 6771cb0ef41Sopenharmony_ci## Comparisons to other fnmatch/glob implementations 6781cb0ef41Sopenharmony_ci 6791cb0ef41Sopenharmony_ciWhile strict compliance with the existing standards is a 6801cb0ef41Sopenharmony_ciworthwhile goal, some discrepancies exist between node-glob and 6811cb0ef41Sopenharmony_ciother implementations, and are intentional. 6821cb0ef41Sopenharmony_ci 6831cb0ef41Sopenharmony_ciThe double-star character `**` is supported by default, unless 6841cb0ef41Sopenharmony_cithe `noglobstar` flag is set. This is supported in the manner of 6851cb0ef41Sopenharmony_cibsdglob and bash 5, where `**` only has special significance if 6861cb0ef41Sopenharmony_ciit is the only thing in a path part. That is, `a/**/b` will match 6871cb0ef41Sopenharmony_ci`a/x/y/b`, but `a/**b` will not. 6881cb0ef41Sopenharmony_ci 6891cb0ef41Sopenharmony_ciNote that symlinked directories are not traversed as part of a 6901cb0ef41Sopenharmony_ci`**`, though their contents may match against subsequent portions 6911cb0ef41Sopenharmony_ciof the pattern. This prevents infinite loops and duplicates and 6921cb0ef41Sopenharmony_cithe like. You can force glob to traverse symlinks with `**` by 6931cb0ef41Sopenharmony_cisetting `{follow:true}` in the options. 6941cb0ef41Sopenharmony_ci 6951cb0ef41Sopenharmony_ciThere is no equivalent of the `nonull` option. A pattern that 6961cb0ef41Sopenharmony_cidoes not find any matches simply resolves to nothing. (An empty 6971cb0ef41Sopenharmony_ciarray, immediately ended stream, etc.) 6981cb0ef41Sopenharmony_ci 6991cb0ef41Sopenharmony_ciIf brace expansion is not disabled, then it is performed before 7001cb0ef41Sopenharmony_ciany other interpretation of the glob pattern. Thus, a pattern 7011cb0ef41Sopenharmony_cilike `+(a|{b),c)}`, which would not be valid in bash or zsh, is 7021cb0ef41Sopenharmony_ciexpanded **first** into the set of `+(a|b)` and `+(a|c)`, and 7031cb0ef41Sopenharmony_cithose patterns are checked for validity. Since those two are 7041cb0ef41Sopenharmony_civalid, matching proceeds. 7051cb0ef41Sopenharmony_ci 7061cb0ef41Sopenharmony_ciThe character class patterns `[:class:]` (posix standard named 7071cb0ef41Sopenharmony_ciclasses) style class patterns are supported and unicode-aware, 7081cb0ef41Sopenharmony_cibut `[=c=]` (locale-specific character collation weight), and 7091cb0ef41Sopenharmony_ci`[.symbol.]` (collating symbol), are not. 7101cb0ef41Sopenharmony_ci 7111cb0ef41Sopenharmony_ci### Repeated Slashes 7121cb0ef41Sopenharmony_ci 7131cb0ef41Sopenharmony_ciUnlike Bash and zsh, repeated `/` are always coalesced into a 7141cb0ef41Sopenharmony_cisingle path separator. 7151cb0ef41Sopenharmony_ci 7161cb0ef41Sopenharmony_ci### Comments and Negation 7171cb0ef41Sopenharmony_ci 7181cb0ef41Sopenharmony_ciPreviously, this module let you mark a pattern as a "comment" if 7191cb0ef41Sopenharmony_ciit started with a `#` character, or a "negated" pattern if it 7201cb0ef41Sopenharmony_cistarted with a `!` character. 7211cb0ef41Sopenharmony_ci 7221cb0ef41Sopenharmony_ciThese options were deprecated in version 5, and removed in 7231cb0ef41Sopenharmony_civersion 6. 7241cb0ef41Sopenharmony_ci 7251cb0ef41Sopenharmony_ciTo specify things that should not match, use the `ignore` option. 7261cb0ef41Sopenharmony_ci 7271cb0ef41Sopenharmony_ci## Windows 7281cb0ef41Sopenharmony_ci 7291cb0ef41Sopenharmony_ci**Please only use forward-slashes in glob expressions.** 7301cb0ef41Sopenharmony_ci 7311cb0ef41Sopenharmony_ciThough windows uses either `/` or `\` as its path separator, only 7321cb0ef41Sopenharmony_ci`/` characters are used by this glob implementation. You must use 7331cb0ef41Sopenharmony_ciforward-slashes **only** in glob expressions. Back-slashes will 7341cb0ef41Sopenharmony_cialways be interpreted as escape characters, not path separators. 7351cb0ef41Sopenharmony_ci 7361cb0ef41Sopenharmony_ciResults from absolute patterns such as `/foo/*` are mounted onto 7371cb0ef41Sopenharmony_cithe root setting using `path.join`. On windows, this will by 7381cb0ef41Sopenharmony_cidefault result in `/foo/*` matching `C:\foo\bar.txt`. 7391cb0ef41Sopenharmony_ci 7401cb0ef41Sopenharmony_ciTo automatically coerce all `\` characters to `/` in pattern 7411cb0ef41Sopenharmony_cistrings, **thus making it impossible to escape literal glob 7421cb0ef41Sopenharmony_cicharacters**, you may set the `windowsPathsNoEscape` option to 7431cb0ef41Sopenharmony_ci`true`. 7441cb0ef41Sopenharmony_ci 7451cb0ef41Sopenharmony_ci### Windows, CWDs, Drive Letters, and UNC Paths 7461cb0ef41Sopenharmony_ci 7471cb0ef41Sopenharmony_ciOn posix systems, when a pattern starts with `/`, any `cwd` 7481cb0ef41Sopenharmony_cioption is ignored, and the traversal starts at `/`, plus any 7491cb0ef41Sopenharmony_cinon-magic path portions specified in the pattern. 7501cb0ef41Sopenharmony_ci 7511cb0ef41Sopenharmony_ciOn Windows systems, the behavior is similar, but the concept of 7521cb0ef41Sopenharmony_cian "absolute path" is somewhat more involved. 7531cb0ef41Sopenharmony_ci 7541cb0ef41Sopenharmony_ci#### UNC Paths 7551cb0ef41Sopenharmony_ci 7561cb0ef41Sopenharmony_ciA UNC path may be used as the start of a pattern on Windows 7571cb0ef41Sopenharmony_ciplatforms. For example, a pattern like: `//?/x:/*` will return 7581cb0ef41Sopenharmony_ciall file entries in the root of the `x:` drive. A pattern like 7591cb0ef41Sopenharmony_ci`//ComputerName/Share/*` will return all files in the associated 7601cb0ef41Sopenharmony_cishare. 7611cb0ef41Sopenharmony_ci 7621cb0ef41Sopenharmony_ciUNC path roots are always compared case insensitively. 7631cb0ef41Sopenharmony_ci 7641cb0ef41Sopenharmony_ci#### Drive Letters 7651cb0ef41Sopenharmony_ci 7661cb0ef41Sopenharmony_ciA pattern starting with a drive letter, like `c:/*`, will search 7671cb0ef41Sopenharmony_ciin that drive, regardless of any `cwd` option provided. 7681cb0ef41Sopenharmony_ci 7691cb0ef41Sopenharmony_ciIf the pattern starts with `/`, and is not a UNC path, and there 7701cb0ef41Sopenharmony_ciis an explicit `cwd` option set with a drive letter, then the 7711cb0ef41Sopenharmony_cidrive letter in the `cwd` is used as the root of the directory 7721cb0ef41Sopenharmony_citraversal. 7731cb0ef41Sopenharmony_ci 7741cb0ef41Sopenharmony_ciFor example, `glob('/tmp', { cwd: 'c:/any/thing' })` will return 7751cb0ef41Sopenharmony_ci`['c:/tmp']` as the result. 7761cb0ef41Sopenharmony_ci 7771cb0ef41Sopenharmony_ciIf an explicit `cwd` option is not provided, and the pattern 7781cb0ef41Sopenharmony_cistarts with `/`, then the traversal will run on the root of the 7791cb0ef41Sopenharmony_cidrive provided as the `cwd` option. (That is, it is the result of 7801cb0ef41Sopenharmony_ci`path.resolve('/')`.) 7811cb0ef41Sopenharmony_ci 7821cb0ef41Sopenharmony_ci## Race Conditions 7831cb0ef41Sopenharmony_ci 7841cb0ef41Sopenharmony_ciGlob searching, by its very nature, is susceptible to race 7851cb0ef41Sopenharmony_ciconditions, since it relies on directory walking. 7861cb0ef41Sopenharmony_ci 7871cb0ef41Sopenharmony_ciAs a result, it is possible that a file that exists when glob 7881cb0ef41Sopenharmony_cilooks for it may have been deleted or modified by the time it 7891cb0ef41Sopenharmony_cireturns the result. 7901cb0ef41Sopenharmony_ci 7911cb0ef41Sopenharmony_ciBy design, this implementation caches all readdir calls that it 7921cb0ef41Sopenharmony_cimakes, in order to cut down on system overhead. However, this 7931cb0ef41Sopenharmony_cialso makes it even more susceptible to races, especially if the 7941cb0ef41Sopenharmony_cicache object is reused between glob calls. 7951cb0ef41Sopenharmony_ci 7961cb0ef41Sopenharmony_ciUsers are thus advised not to use a glob result as a guarantee of 7971cb0ef41Sopenharmony_cifilesystem state in the face of rapid changes. For the vast 7981cb0ef41Sopenharmony_cimajority of operations, this is never a problem. 7991cb0ef41Sopenharmony_ci 8001cb0ef41Sopenharmony_ci### See Also: 8011cb0ef41Sopenharmony_ci 8021cb0ef41Sopenharmony_ci- `man sh` 8031cb0ef41Sopenharmony_ci- `man bash` [Pattern 8041cb0ef41Sopenharmony_ci Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) 8051cb0ef41Sopenharmony_ci- `man 3 fnmatch` 8061cb0ef41Sopenharmony_ci- `man 5 gitignore` 8071cb0ef41Sopenharmony_ci- [minimatch documentation](https://github.com/isaacs/minimatch) 8081cb0ef41Sopenharmony_ci 8091cb0ef41Sopenharmony_ci## Glob Logo 8101cb0ef41Sopenharmony_ci 8111cb0ef41Sopenharmony_ciGlob's logo was created by [Tanya 8121cb0ef41Sopenharmony_ciBrassie](http://tanyabrassie.com/). Logo files can be found 8131cb0ef41Sopenharmony_ci[here](https://github.com/isaacs/node-glob/tree/master/logo). 8141cb0ef41Sopenharmony_ci 8151cb0ef41Sopenharmony_ciThe logo is licensed under a [Creative Commons 8161cb0ef41Sopenharmony_ciAttribution-ShareAlike 4.0 International 8171cb0ef41Sopenharmony_ciLicense](https://creativecommons.org/licenses/by-sa/4.0/). 8181cb0ef41Sopenharmony_ci 8191cb0ef41Sopenharmony_ci## Contributing 8201cb0ef41Sopenharmony_ci 8211cb0ef41Sopenharmony_ciAny change to behavior (including bugfixes) must come with a 8221cb0ef41Sopenharmony_citest. 8231cb0ef41Sopenharmony_ci 8241cb0ef41Sopenharmony_ciPatches that fail tests or reduce performance will be rejected. 8251cb0ef41Sopenharmony_ci 8261cb0ef41Sopenharmony_ci```sh 8271cb0ef41Sopenharmony_ci# to run tests 8281cb0ef41Sopenharmony_cinpm test 8291cb0ef41Sopenharmony_ci 8301cb0ef41Sopenharmony_ci# to re-generate test fixtures 8311cb0ef41Sopenharmony_cinpm run test-regen 8321cb0ef41Sopenharmony_ci 8331cb0ef41Sopenharmony_ci# run the benchmarks 8341cb0ef41Sopenharmony_cinpm run bench 8351cb0ef41Sopenharmony_ci 8361cb0ef41Sopenharmony_ci# to profile javascript 8371cb0ef41Sopenharmony_cinpm run prof 8381cb0ef41Sopenharmony_ci``` 8391cb0ef41Sopenharmony_ci 8401cb0ef41Sopenharmony_ci## Comparison to Other JavaScript Glob Implementations 8411cb0ef41Sopenharmony_ci 8421cb0ef41Sopenharmony_ci**tl;dr** 8431cb0ef41Sopenharmony_ci 8441cb0ef41Sopenharmony_ci- If you want glob matching that is as faithful as possible to 8451cb0ef41Sopenharmony_ci Bash pattern expansion semantics, and as fast as possible 8461cb0ef41Sopenharmony_ci within that constraint, _use this module_. 8471cb0ef41Sopenharmony_ci- If you are reasonably sure that the patterns you will encounter 8481cb0ef41Sopenharmony_ci are relatively simple, and want the absolutely fastest glob 8491cb0ef41Sopenharmony_ci matcher out there, _use [fast-glob](http://npm.im/fast-glob)_. 8501cb0ef41Sopenharmony_ci- If you are reasonably sure that the patterns you will encounter 8511cb0ef41Sopenharmony_ci are relatively simple, and want the convenience of 8521cb0ef41Sopenharmony_ci automatically respecting `.gitignore` files, _use 8531cb0ef41Sopenharmony_ci [globby](http://npm.im/globby)_. 8541cb0ef41Sopenharmony_ci 8551cb0ef41Sopenharmony_ciThere are some other glob matcher libraries on npm, but these 8561cb0ef41Sopenharmony_cithree are (in my opinion, as of 2023) the best. 8571cb0ef41Sopenharmony_ci 8581cb0ef41Sopenharmony_ci--- 8591cb0ef41Sopenharmony_ci 8601cb0ef41Sopenharmony_ci**full explanation** 8611cb0ef41Sopenharmony_ci 8621cb0ef41Sopenharmony_ciEvery library reflects a set of opinions and priorities in the 8631cb0ef41Sopenharmony_citrade-offs it makes. Other than this library, I can personally 8641cb0ef41Sopenharmony_cirecommend both [globby](http://npm.im/globby) and 8651cb0ef41Sopenharmony_ci[fast-glob](http://npm.im/fast-glob), though they differ in their 8661cb0ef41Sopenharmony_cibenefits and drawbacks. 8671cb0ef41Sopenharmony_ci 8681cb0ef41Sopenharmony_ciBoth have very nice APIs and are reasonably fast. 8691cb0ef41Sopenharmony_ci 8701cb0ef41Sopenharmony_ci`fast-glob` is, as far as I am aware, the fastest glob 8711cb0ef41Sopenharmony_ciimplementation in JavaScript today. However, there are many 8721cb0ef41Sopenharmony_cicases where the choices that `fast-glob` makes in pursuit of 8731cb0ef41Sopenharmony_cispeed mean that its results differ from the results returned by 8741cb0ef41Sopenharmony_ciBash and other sh-like shells, which may be surprising. 8751cb0ef41Sopenharmony_ci 8761cb0ef41Sopenharmony_ciIn my testing, `fast-glob` is around 10-20% faster than this 8771cb0ef41Sopenharmony_cimodule when walking over 200k files nested 4 directories 8781cb0ef41Sopenharmony_cideep[1](#fn-webscale). However, there are some inconsistencies 8791cb0ef41Sopenharmony_ciwith Bash matching behavior that this module does not suffer 8801cb0ef41Sopenharmony_cifrom: 8811cb0ef41Sopenharmony_ci 8821cb0ef41Sopenharmony_ci- `**` only matches files, not directories 8831cb0ef41Sopenharmony_ci- `..` path portions are not handled unless they appear at the 8841cb0ef41Sopenharmony_ci start of the pattern 8851cb0ef41Sopenharmony_ci- `./!(<pattern>)` will not match any files that _start_ with 8861cb0ef41Sopenharmony_ci `<pattern>`, even if they do not match `<pattern>`. For 8871cb0ef41Sopenharmony_ci example, `!(9).txt` will not match `9999.txt`. 8881cb0ef41Sopenharmony_ci- Some brace patterns in the middle of a pattern will result in 8891cb0ef41Sopenharmony_ci failing to find certain matches. 8901cb0ef41Sopenharmony_ci- Extglob patterns are allowed to contain `/` characters. 8911cb0ef41Sopenharmony_ci 8921cb0ef41Sopenharmony_ciGlobby exhibits all of the same pattern semantics as fast-glob, 8931cb0ef41Sopenharmony_ci(as it is a wrapper around fast-glob) and is slightly slower than 8941cb0ef41Sopenharmony_cinode-glob (by about 10-20% in the benchmark test set, or in other 8951cb0ef41Sopenharmony_ciwords, anywhere from 20-50% slower than fast-glob). However, it 8961cb0ef41Sopenharmony_ciadds some API conveniences that may be worth the costs. 8971cb0ef41Sopenharmony_ci 8981cb0ef41Sopenharmony_ci- Support for `.gitignore` and other ignore files. 8991cb0ef41Sopenharmony_ci- Support for negated globs (ie, patterns starting with `!` 9001cb0ef41Sopenharmony_ci rather than using a separate `ignore` option). 9011cb0ef41Sopenharmony_ci 9021cb0ef41Sopenharmony_ciThe priority of this module is "correctness" in the sense of 9031cb0ef41Sopenharmony_ciperforming a glob pattern expansion as faithfully as possible to 9041cb0ef41Sopenharmony_cithe behavior of Bash and other sh-like shells, with as much speed 9051cb0ef41Sopenharmony_cias possible. 9061cb0ef41Sopenharmony_ci 9071cb0ef41Sopenharmony_ciNote that prior versions of `node-glob` are _not_ on this list. 9081cb0ef41Sopenharmony_ciFormer versions of this module are far too slow for any cases 9091cb0ef41Sopenharmony_ciwhere performance matters at all, and were designed with APIs 9101cb0ef41Sopenharmony_cithat are extremely dated by current JavaScript standards. 9111cb0ef41Sopenharmony_ci 9121cb0ef41Sopenharmony_ci--- 9131cb0ef41Sopenharmony_ci 9141cb0ef41Sopenharmony_ci<small id="fn-webscale">[1]: In the cases where this module 9151cb0ef41Sopenharmony_cireturns results and `fast-glob` doesn't, it's even faster, of 9161cb0ef41Sopenharmony_cicourse.</small> 9171cb0ef41Sopenharmony_ci 9181cb0ef41Sopenharmony_ci 9191cb0ef41Sopenharmony_ci 9201cb0ef41Sopenharmony_ci### Benchmark Results 9211cb0ef41Sopenharmony_ci 9221cb0ef41Sopenharmony_ciFirst number is time, smaller is better. 9231cb0ef41Sopenharmony_ci 9241cb0ef41Sopenharmony_ciSecond number is the count of results returned. 9251cb0ef41Sopenharmony_ci 9261cb0ef41Sopenharmony_ci``` 9271cb0ef41Sopenharmony_ci--- pattern: '**' --- 9281cb0ef41Sopenharmony_ci~~ sync ~~ 9291cb0ef41Sopenharmony_cinode fast-glob sync 0m0.598s 200364 9301cb0ef41Sopenharmony_cinode globby sync 0m0.765s 200364 9311cb0ef41Sopenharmony_cinode current globSync mjs 0m0.683s 222656 9321cb0ef41Sopenharmony_cinode current glob syncStream 0m0.649s 222656 9331cb0ef41Sopenharmony_ci~~ async ~~ 9341cb0ef41Sopenharmony_cinode fast-glob async 0m0.350s 200364 9351cb0ef41Sopenharmony_cinode globby async 0m0.509s 200364 9361cb0ef41Sopenharmony_cinode current glob async mjs 0m0.463s 222656 9371cb0ef41Sopenharmony_cinode current glob stream 0m0.411s 222656 9381cb0ef41Sopenharmony_ci 9391cb0ef41Sopenharmony_ci--- pattern: '**/..' --- 9401cb0ef41Sopenharmony_ci~~ sync ~~ 9411cb0ef41Sopenharmony_cinode fast-glob sync 0m0.486s 0 9421cb0ef41Sopenharmony_cinode globby sync 0m0.769s 200364 9431cb0ef41Sopenharmony_cinode current globSync mjs 0m0.564s 2242 9441cb0ef41Sopenharmony_cinode current glob syncStream 0m0.583s 2242 9451cb0ef41Sopenharmony_ci~~ async ~~ 9461cb0ef41Sopenharmony_cinode fast-glob async 0m0.283s 0 9471cb0ef41Sopenharmony_cinode globby async 0m0.512s 200364 9481cb0ef41Sopenharmony_cinode current glob async mjs 0m0.299s 2242 9491cb0ef41Sopenharmony_cinode current glob stream 0m0.312s 2242 9501cb0ef41Sopenharmony_ci 9511cb0ef41Sopenharmony_ci--- pattern: './**/0/**/0/**/0/**/0/**/*.txt' --- 9521cb0ef41Sopenharmony_ci~~ sync ~~ 9531cb0ef41Sopenharmony_cinode fast-glob sync 0m0.490s 10 9541cb0ef41Sopenharmony_cinode globby sync 0m0.517s 10 9551cb0ef41Sopenharmony_cinode current globSync mjs 0m0.540s 10 9561cb0ef41Sopenharmony_cinode current glob syncStream 0m0.550s 10 9571cb0ef41Sopenharmony_ci~~ async ~~ 9581cb0ef41Sopenharmony_cinode fast-glob async 0m0.290s 10 9591cb0ef41Sopenharmony_cinode globby async 0m0.296s 10 9601cb0ef41Sopenharmony_cinode current glob async mjs 0m0.278s 10 9611cb0ef41Sopenharmony_cinode current glob stream 0m0.302s 10 9621cb0ef41Sopenharmony_ci 9631cb0ef41Sopenharmony_ci--- pattern: './**/[01]/**/[12]/**/[23]/**/[45]/**/*.txt' --- 9641cb0ef41Sopenharmony_ci~~ sync ~~ 9651cb0ef41Sopenharmony_cinode fast-glob sync 0m0.500s 160 9661cb0ef41Sopenharmony_cinode globby sync 0m0.528s 160 9671cb0ef41Sopenharmony_cinode current globSync mjs 0m0.556s 160 9681cb0ef41Sopenharmony_cinode current glob syncStream 0m0.573s 160 9691cb0ef41Sopenharmony_ci~~ async ~~ 9701cb0ef41Sopenharmony_cinode fast-glob async 0m0.283s 160 9711cb0ef41Sopenharmony_cinode globby async 0m0.301s 160 9721cb0ef41Sopenharmony_cinode current glob async mjs 0m0.306s 160 9731cb0ef41Sopenharmony_cinode current glob stream 0m0.322s 160 9741cb0ef41Sopenharmony_ci 9751cb0ef41Sopenharmony_ci--- pattern: './**/0/**/0/**/*.txt' --- 9761cb0ef41Sopenharmony_ci~~ sync ~~ 9771cb0ef41Sopenharmony_cinode fast-glob sync 0m0.502s 5230 9781cb0ef41Sopenharmony_cinode globby sync 0m0.527s 5230 9791cb0ef41Sopenharmony_cinode current globSync mjs 0m0.544s 5230 9801cb0ef41Sopenharmony_cinode current glob syncStream 0m0.557s 5230 9811cb0ef41Sopenharmony_ci~~ async ~~ 9821cb0ef41Sopenharmony_cinode fast-glob async 0m0.285s 5230 9831cb0ef41Sopenharmony_cinode globby async 0m0.305s 5230 9841cb0ef41Sopenharmony_cinode current glob async mjs 0m0.304s 5230 9851cb0ef41Sopenharmony_cinode current glob stream 0m0.310s 5230 9861cb0ef41Sopenharmony_ci 9871cb0ef41Sopenharmony_ci--- pattern: '**/*.txt' --- 9881cb0ef41Sopenharmony_ci~~ sync ~~ 9891cb0ef41Sopenharmony_cinode fast-glob sync 0m0.580s 200023 9901cb0ef41Sopenharmony_cinode globby sync 0m0.771s 200023 9911cb0ef41Sopenharmony_cinode current globSync mjs 0m0.685s 200023 9921cb0ef41Sopenharmony_cinode current glob syncStream 0m0.649s 200023 9931cb0ef41Sopenharmony_ci~~ async ~~ 9941cb0ef41Sopenharmony_cinode fast-glob async 0m0.349s 200023 9951cb0ef41Sopenharmony_cinode globby async 0m0.509s 200023 9961cb0ef41Sopenharmony_cinode current glob async mjs 0m0.427s 200023 9971cb0ef41Sopenharmony_cinode current glob stream 0m0.388s 200023 9981cb0ef41Sopenharmony_ci 9991cb0ef41Sopenharmony_ci--- pattern: '{**/*.txt,**/?/**/*.txt,**/?/**/?/**/*.txt,**/?/**/?/**/?/**/*.txt,**/?/**/?/**/?/**/?/**/*.txt}' --- 10001cb0ef41Sopenharmony_ci~~ sync ~~ 10011cb0ef41Sopenharmony_cinode fast-glob sync 0m0.589s 200023 10021cb0ef41Sopenharmony_cinode globby sync 0m0.771s 200023 10031cb0ef41Sopenharmony_cinode current globSync mjs 0m0.716s 200023 10041cb0ef41Sopenharmony_cinode current glob syncStream 0m0.684s 200023 10051cb0ef41Sopenharmony_ci~~ async ~~ 10061cb0ef41Sopenharmony_cinode fast-glob async 0m0.351s 200023 10071cb0ef41Sopenharmony_cinode globby async 0m0.518s 200023 10081cb0ef41Sopenharmony_cinode current glob async mjs 0m0.462s 200023 10091cb0ef41Sopenharmony_cinode current glob stream 0m0.468s 200023 10101cb0ef41Sopenharmony_ci 10111cb0ef41Sopenharmony_ci--- pattern: '**/5555/0000/*.txt' --- 10121cb0ef41Sopenharmony_ci~~ sync ~~ 10131cb0ef41Sopenharmony_cinode fast-glob sync 0m0.496s 1000 10141cb0ef41Sopenharmony_cinode globby sync 0m0.519s 1000 10151cb0ef41Sopenharmony_cinode current globSync mjs 0m0.539s 1000 10161cb0ef41Sopenharmony_cinode current glob syncStream 0m0.567s 1000 10171cb0ef41Sopenharmony_ci~~ async ~~ 10181cb0ef41Sopenharmony_cinode fast-glob async 0m0.285s 1000 10191cb0ef41Sopenharmony_cinode globby async 0m0.299s 1000 10201cb0ef41Sopenharmony_cinode current glob async mjs 0m0.305s 1000 10211cb0ef41Sopenharmony_cinode current glob stream 0m0.301s 1000 10221cb0ef41Sopenharmony_ci 10231cb0ef41Sopenharmony_ci--- pattern: './**/0/**/../[01]/**/0/../**/0/*.txt' --- 10241cb0ef41Sopenharmony_ci~~ sync ~~ 10251cb0ef41Sopenharmony_cinode fast-glob sync 0m0.484s 0 10261cb0ef41Sopenharmony_cinode globby sync 0m0.507s 0 10271cb0ef41Sopenharmony_cinode current globSync mjs 0m0.577s 4880 10281cb0ef41Sopenharmony_cinode current glob syncStream 0m0.586s 4880 10291cb0ef41Sopenharmony_ci~~ async ~~ 10301cb0ef41Sopenharmony_cinode fast-glob async 0m0.280s 0 10311cb0ef41Sopenharmony_cinode globby async 0m0.298s 0 10321cb0ef41Sopenharmony_cinode current glob async mjs 0m0.327s 4880 10331cb0ef41Sopenharmony_cinode current glob stream 0m0.324s 4880 10341cb0ef41Sopenharmony_ci 10351cb0ef41Sopenharmony_ci--- pattern: '**/????/????/????/????/*.txt' --- 10361cb0ef41Sopenharmony_ci~~ sync ~~ 10371cb0ef41Sopenharmony_cinode fast-glob sync 0m0.547s 100000 10381cb0ef41Sopenharmony_cinode globby sync 0m0.673s 100000 10391cb0ef41Sopenharmony_cinode current globSync mjs 0m0.626s 100000 10401cb0ef41Sopenharmony_cinode current glob syncStream 0m0.618s 100000 10411cb0ef41Sopenharmony_ci~~ async ~~ 10421cb0ef41Sopenharmony_cinode fast-glob async 0m0.315s 100000 10431cb0ef41Sopenharmony_cinode globby async 0m0.414s 100000 10441cb0ef41Sopenharmony_cinode current glob async mjs 0m0.366s 100000 10451cb0ef41Sopenharmony_cinode current glob stream 0m0.345s 100000 10461cb0ef41Sopenharmony_ci 10471cb0ef41Sopenharmony_ci--- pattern: './{**/?{/**/?{/**/?{/**/?,,,,},,,,},,,,},,,}/**/*.txt' --- 10481cb0ef41Sopenharmony_ci~~ sync ~~ 10491cb0ef41Sopenharmony_cinode fast-glob sync 0m0.588s 100000 10501cb0ef41Sopenharmony_cinode globby sync 0m0.670s 100000 10511cb0ef41Sopenharmony_cinode current globSync mjs 0m0.717s 200023 10521cb0ef41Sopenharmony_cinode current glob syncStream 0m0.687s 200023 10531cb0ef41Sopenharmony_ci~~ async ~~ 10541cb0ef41Sopenharmony_cinode fast-glob async 0m0.343s 100000 10551cb0ef41Sopenharmony_cinode globby async 0m0.418s 100000 10561cb0ef41Sopenharmony_cinode current glob async mjs 0m0.519s 200023 10571cb0ef41Sopenharmony_cinode current glob stream 0m0.451s 200023 10581cb0ef41Sopenharmony_ci 10591cb0ef41Sopenharmony_ci--- pattern: '**/!(0|9).txt' --- 10601cb0ef41Sopenharmony_ci~~ sync ~~ 10611cb0ef41Sopenharmony_cinode fast-glob sync 0m0.573s 160023 10621cb0ef41Sopenharmony_cinode globby sync 0m0.731s 160023 10631cb0ef41Sopenharmony_cinode current globSync mjs 0m0.680s 180023 10641cb0ef41Sopenharmony_cinode current glob syncStream 0m0.659s 180023 10651cb0ef41Sopenharmony_ci~~ async ~~ 10661cb0ef41Sopenharmony_cinode fast-glob async 0m0.345s 160023 10671cb0ef41Sopenharmony_cinode globby async 0m0.476s 160023 10681cb0ef41Sopenharmony_cinode current glob async mjs 0m0.427s 180023 10691cb0ef41Sopenharmony_cinode current glob stream 0m0.388s 180023 10701cb0ef41Sopenharmony_ci 10711cb0ef41Sopenharmony_ci--- pattern: './{*/**/../{*/**/../{*/**/../{*/**/../{*/**,,,,},,,,},,,,},,,,},,,,}/*.txt' --- 10721cb0ef41Sopenharmony_ci~~ sync ~~ 10731cb0ef41Sopenharmony_cinode fast-glob sync 0m0.483s 0 10741cb0ef41Sopenharmony_cinode globby sync 0m0.512s 0 10751cb0ef41Sopenharmony_cinode current globSync mjs 0m0.811s 200023 10761cb0ef41Sopenharmony_cinode current glob syncStream 0m0.773s 200023 10771cb0ef41Sopenharmony_ci~~ async ~~ 10781cb0ef41Sopenharmony_cinode fast-glob async 0m0.280s 0 10791cb0ef41Sopenharmony_cinode globby async 0m0.299s 0 10801cb0ef41Sopenharmony_cinode current glob async mjs 0m0.617s 200023 10811cb0ef41Sopenharmony_cinode current glob stream 0m0.568s 200023 10821cb0ef41Sopenharmony_ci 10831cb0ef41Sopenharmony_ci--- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/*.txt' --- 10841cb0ef41Sopenharmony_ci~~ sync ~~ 10851cb0ef41Sopenharmony_cinode fast-glob sync 0m0.485s 0 10861cb0ef41Sopenharmony_cinode globby sync 0m0.507s 0 10871cb0ef41Sopenharmony_cinode current globSync mjs 0m0.759s 200023 10881cb0ef41Sopenharmony_cinode current glob syncStream 0m0.740s 200023 10891cb0ef41Sopenharmony_ci~~ async ~~ 10901cb0ef41Sopenharmony_cinode fast-glob async 0m0.281s 0 10911cb0ef41Sopenharmony_cinode globby async 0m0.297s 0 10921cb0ef41Sopenharmony_cinode current glob async mjs 0m0.544s 200023 10931cb0ef41Sopenharmony_cinode current glob stream 0m0.464s 200023 10941cb0ef41Sopenharmony_ci 10951cb0ef41Sopenharmony_ci--- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/*.txt' --- 10961cb0ef41Sopenharmony_ci~~ sync ~~ 10971cb0ef41Sopenharmony_cinode fast-glob sync 0m0.486s 0 10981cb0ef41Sopenharmony_cinode globby sync 0m0.513s 0 10991cb0ef41Sopenharmony_cinode current globSync mjs 0m0.734s 200023 11001cb0ef41Sopenharmony_cinode current glob syncStream 0m0.696s 200023 11011cb0ef41Sopenharmony_ci~~ async ~~ 11021cb0ef41Sopenharmony_cinode fast-glob async 0m0.286s 0 11031cb0ef41Sopenharmony_cinode globby async 0m0.296s 0 11041cb0ef41Sopenharmony_cinode current glob async mjs 0m0.506s 200023 11051cb0ef41Sopenharmony_cinode current glob stream 0m0.483s 200023 11061cb0ef41Sopenharmony_ci 11071cb0ef41Sopenharmony_ci--- pattern: './0/**/../1/**/../2/**/../3/**/../4/**/../5/**/../6/**/../7/**/*.txt' --- 11081cb0ef41Sopenharmony_ci~~ sync ~~ 11091cb0ef41Sopenharmony_cinode fast-glob sync 0m0.060s 0 11101cb0ef41Sopenharmony_cinode globby sync 0m0.074s 0 11111cb0ef41Sopenharmony_cinode current globSync mjs 0m0.067s 0 11121cb0ef41Sopenharmony_cinode current glob syncStream 0m0.066s 0 11131cb0ef41Sopenharmony_ci~~ async ~~ 11141cb0ef41Sopenharmony_cinode fast-glob async 0m0.060s 0 11151cb0ef41Sopenharmony_cinode globby async 0m0.075s 0 11161cb0ef41Sopenharmony_cinode current glob async mjs 0m0.066s 0 11171cb0ef41Sopenharmony_cinode current glob stream 0m0.067s 0 11181cb0ef41Sopenharmony_ci 11191cb0ef41Sopenharmony_ci--- pattern: './**/?/**/?/**/?/**/?/**/*.txt' --- 11201cb0ef41Sopenharmony_ci~~ sync ~~ 11211cb0ef41Sopenharmony_cinode fast-glob sync 0m0.568s 100000 11221cb0ef41Sopenharmony_cinode globby sync 0m0.651s 100000 11231cb0ef41Sopenharmony_cinode current globSync mjs 0m0.619s 100000 11241cb0ef41Sopenharmony_cinode current glob syncStream 0m0.617s 100000 11251cb0ef41Sopenharmony_ci~~ async ~~ 11261cb0ef41Sopenharmony_cinode fast-glob async 0m0.332s 100000 11271cb0ef41Sopenharmony_cinode globby async 0m0.409s 100000 11281cb0ef41Sopenharmony_cinode current glob async mjs 0m0.372s 100000 11291cb0ef41Sopenharmony_cinode current glob stream 0m0.351s 100000 11301cb0ef41Sopenharmony_ci 11311cb0ef41Sopenharmony_ci--- pattern: '**/*/**/*/**/*/**/*/**' --- 11321cb0ef41Sopenharmony_ci~~ sync ~~ 11331cb0ef41Sopenharmony_cinode fast-glob sync 0m0.603s 200113 11341cb0ef41Sopenharmony_cinode globby sync 0m0.798s 200113 11351cb0ef41Sopenharmony_cinode current globSync mjs 0m0.730s 222137 11361cb0ef41Sopenharmony_cinode current glob syncStream 0m0.693s 222137 11371cb0ef41Sopenharmony_ci~~ async ~~ 11381cb0ef41Sopenharmony_cinode fast-glob async 0m0.356s 200113 11391cb0ef41Sopenharmony_cinode globby async 0m0.525s 200113 11401cb0ef41Sopenharmony_cinode current glob async mjs 0m0.508s 222137 11411cb0ef41Sopenharmony_cinode current glob stream 0m0.455s 222137 11421cb0ef41Sopenharmony_ci 11431cb0ef41Sopenharmony_ci--- pattern: './**/*/**/*/**/*/**/*/**/*.txt' --- 11441cb0ef41Sopenharmony_ci~~ sync ~~ 11451cb0ef41Sopenharmony_cinode fast-glob sync 0m0.622s 200000 11461cb0ef41Sopenharmony_cinode globby sync 0m0.792s 200000 11471cb0ef41Sopenharmony_cinode current globSync mjs 0m0.722s 200000 11481cb0ef41Sopenharmony_cinode current glob syncStream 0m0.695s 200000 11491cb0ef41Sopenharmony_ci~~ async ~~ 11501cb0ef41Sopenharmony_cinode fast-glob async 0m0.369s 200000 11511cb0ef41Sopenharmony_cinode globby async 0m0.527s 200000 11521cb0ef41Sopenharmony_cinode current glob async mjs 0m0.502s 200000 11531cb0ef41Sopenharmony_cinode current glob stream 0m0.481s 200000 11541cb0ef41Sopenharmony_ci 11551cb0ef41Sopenharmony_ci--- pattern: '**/*.txt' --- 11561cb0ef41Sopenharmony_ci~~ sync ~~ 11571cb0ef41Sopenharmony_cinode fast-glob sync 0m0.588s 200023 11581cb0ef41Sopenharmony_cinode globby sync 0m0.771s 200023 11591cb0ef41Sopenharmony_cinode current globSync mjs 0m0.684s 200023 11601cb0ef41Sopenharmony_cinode current glob syncStream 0m0.658s 200023 11611cb0ef41Sopenharmony_ci~~ async ~~ 11621cb0ef41Sopenharmony_cinode fast-glob async 0m0.352s 200023 11631cb0ef41Sopenharmony_cinode globby async 0m0.516s 200023 11641cb0ef41Sopenharmony_cinode current glob async mjs 0m0.432s 200023 11651cb0ef41Sopenharmony_cinode current glob stream 0m0.384s 200023 11661cb0ef41Sopenharmony_ci 11671cb0ef41Sopenharmony_ci--- pattern: './**/**/**/**/**/**/**/**/*.txt' --- 11681cb0ef41Sopenharmony_ci~~ sync ~~ 11691cb0ef41Sopenharmony_cinode fast-glob sync 0m0.589s 200023 11701cb0ef41Sopenharmony_cinode globby sync 0m0.766s 200023 11711cb0ef41Sopenharmony_cinode current globSync mjs 0m0.682s 200023 11721cb0ef41Sopenharmony_cinode current glob syncStream 0m0.652s 200023 11731cb0ef41Sopenharmony_ci~~ async ~~ 11741cb0ef41Sopenharmony_cinode fast-glob async 0m0.352s 200023 11751cb0ef41Sopenharmony_cinode globby async 0m0.523s 200023 11761cb0ef41Sopenharmony_cinode current glob async mjs 0m0.436s 200023 11771cb0ef41Sopenharmony_cinode current glob stream 0m0.380s 200023 11781cb0ef41Sopenharmony_ci 11791cb0ef41Sopenharmony_ci--- pattern: '**/*/*.txt' --- 11801cb0ef41Sopenharmony_ci~~ sync ~~ 11811cb0ef41Sopenharmony_cinode fast-glob sync 0m0.592s 200023 11821cb0ef41Sopenharmony_cinode globby sync 0m0.776s 200023 11831cb0ef41Sopenharmony_cinode current globSync mjs 0m0.691s 200023 11841cb0ef41Sopenharmony_cinode current glob syncStream 0m0.659s 200023 11851cb0ef41Sopenharmony_ci~~ async ~~ 11861cb0ef41Sopenharmony_cinode fast-glob async 0m0.357s 200023 11871cb0ef41Sopenharmony_cinode globby async 0m0.513s 200023 11881cb0ef41Sopenharmony_cinode current glob async mjs 0m0.471s 200023 11891cb0ef41Sopenharmony_cinode current glob stream 0m0.424s 200023 11901cb0ef41Sopenharmony_ci 11911cb0ef41Sopenharmony_ci--- pattern: '**/*/**/*.txt' --- 11921cb0ef41Sopenharmony_ci~~ sync ~~ 11931cb0ef41Sopenharmony_cinode fast-glob sync 0m0.585s 200023 11941cb0ef41Sopenharmony_cinode globby sync 0m0.766s 200023 11951cb0ef41Sopenharmony_cinode current globSync mjs 0m0.694s 200023 11961cb0ef41Sopenharmony_cinode current glob syncStream 0m0.664s 200023 11971cb0ef41Sopenharmony_ci~~ async ~~ 11981cb0ef41Sopenharmony_cinode fast-glob async 0m0.350s 200023 11991cb0ef41Sopenharmony_cinode globby async 0m0.514s 200023 12001cb0ef41Sopenharmony_cinode current glob async mjs 0m0.472s 200023 12011cb0ef41Sopenharmony_cinode current glob stream 0m0.424s 200023 12021cb0ef41Sopenharmony_ci 12031cb0ef41Sopenharmony_ci--- pattern: '**/[0-9]/**/*.txt' --- 12041cb0ef41Sopenharmony_ci~~ sync ~~ 12051cb0ef41Sopenharmony_cinode fast-glob sync 0m0.544s 100000 12061cb0ef41Sopenharmony_cinode globby sync 0m0.636s 100000 12071cb0ef41Sopenharmony_cinode current globSync mjs 0m0.626s 100000 12081cb0ef41Sopenharmony_cinode current glob syncStream 0m0.621s 100000 12091cb0ef41Sopenharmony_ci~~ async ~~ 12101cb0ef41Sopenharmony_cinode fast-glob async 0m0.322s 100000 12111cb0ef41Sopenharmony_cinode globby async 0m0.404s 100000 12121cb0ef41Sopenharmony_cinode current glob async mjs 0m0.360s 100000 12131cb0ef41Sopenharmony_cinode current glob stream 0m0.352s 100000 12141cb0ef41Sopenharmony_ci``` 1215