Quickstart
Scan a directory for files matching*.ts:
Glob is a class which implements the following interface:
Supported Glob Patterns
Bun supports the following glob patterns:? - Match any single character
* - Matches zero or more characters, except for path separators (/ or \)
** - Match any number of characters including /
[ab] - Matches one of the characters contained in the brackets, as well as character ranges
[0-9], [a-z]) as well as the negation operators ^ or ! to match anything except the characters contained within the braces (e.g [^ab], [!a-z])
{a,b,c} - Match any of the given patterns
! - Negates the result at the start of a pattern
\ - Escapes any of the special characters above
Node.js fs.glob() compatibility
Bun also implements Node.js’s fs.glob() functions with additional features:
fs.glob(), fs.globSync(), fs.promises.glob()) support:
- Array of patterns as the first argument
excludeoption to filter results