class
Glob
class Glob
Match files using glob patterns.
The supported pattern syntax is:
?Matches any single character.*Matches zero or more characters, except for path separators ('/' or '').**Matches zero or more characters, including path separators. Must match a complete path segment (followed by a path separator or at the end of the pattern).[ab]Matches one of the characters contained in the brackets. Character ranges like "[a-z]" are also supported. Use "[!ab]" or "[^ab]" to match any character except those contained in the brackets.{a,b}Match one of the patterns contained in the braces. The sub-patterns can use any of the other wildcards. Braces may be nested up to 10 levels deep.!Negates the result when at the start of the pattern. Multiple "!" characters negate the pattern multiple times.- `` Escapes any of the special characters listed here.
const glob = new Glob("*.{ts,tsx}");
const scannedFiles = await Array.fromAsync(glob.scan({ cwd: './src' }))const glob = new Glob("*.{ts,tsx}"); expect(glob.match('foo.ts')).toBeTrue();- scan(): AsyncIterableIterator<string>;
Scan a root directory recursively for files that match this glob pattern. Returns an async iterator.
const glob = new Glob("*.{ts,tsx}"); const scannedFiles = await Array.fromAsync(glob.scan({ cwd: './src' })) - ): IterableIterator<string>;
Synchronously scan a root directory recursively for files that match this glob pattern. Returns an iterator.
const glob = new Glob("*.{ts,tsx}"); const scannedFiles = Array.from(glob.scan({ cwd: './src' }))