Replacements for fast-glob
tinyglobby
tinyglobby is a modern, lightweight alternative that provides similar functionality with better performance.
Example:
ts
import fg from 'fast-glob'
import { glob } from 'tinyglobby'
const files = await fg('**/*.ts', {
const files = await glob('**/*.ts', {
cwd: process.cwd(),
ignore: ['**/node_modules/**'],
expandDirectories: false
})Most options from fast-glob have direct equivalents in tinyglobby. Check the tinyglobby documentation for the complete list of supported options.
fs.glob (native, since Node 22.x)
fs.glob is built into modern versions of Node.
Example:
ts
import fg from 'fast-glob'
import { glob } from 'node:fs/promises'
const files = await fg('src/**/*.ts', {
const files = await Array.fromAsync(glob('src/**/*.ts', {
cwd,
})
})) You can also iterate over the results asynchronously:
ts
for await (const result of glob('src/**/*.ts', { cwd })) {
// result is an individual path
console.log(result)
}NOTE
Node's built-in glob is more minimal and does not support negation patterns or fine-grained options like setting a max depth out of the box.