A fast and minimal alternative to globby and fast-glob, meant to behave the same way.
Both globby and fast-glob present some behavior no other globbing lib has, which makes it hard to manually replace with something smaller and better.
This library uses only two subdependencies, compared to globby's 23
and fast-glob's 17.
import { glob, globSync } from 'tinyglobby';
await glob(['files/*.ts', '!**/*.d.ts'], { cwd: 'src' });
globSync('src/**/*.ts', { ignore: '**/*.d.ts' });glob(patterns: string | string[], options: GlobOptions): Promise<string[]>: Returns a promise with an array of matches.globSync(patterns: string | string[], options: GlobOptions): string[]: Returns an array of matches.convertPathToPattern(path: string): string: Converts a path to a pattern depending on the platform.escapePath(path: string): string: Escapes a path's special characters depending on the platform.isDynamicPattern(pattern: string, options?: GlobOptions): boolean: Checks if a pattern is dynamic.
absolute: Whether to return absolute paths. Defaults tofalse.caseSensitiveMatch: Whether to match in case-sensitive mode. Defaults totrue.cwd: The current working directory in which to search. Defaults toprocess.cwd().debug: Enable debug logs. Useful for development purposes.dot: Whether to allow entries starting with a dot. Defaults tofalse.deep: Maximum depth of a directory. Defaults toInfinity.expandDirectories: Whether to expand directories. Disable to best matchfast-glob. Defaults totrue.followSymbolicLinks: Whether to traverse and include symbolic links. Defaults totrue.globstar: Enables support for matching nested directories with globstars (**). If false,**behaves exactly like*. Defaults totrue.ignore: An array of glob patterns to ignore.onlyDirectories: Enable to only return directories. DisablesonlyFilesif set. Defaults tofalse.onlyFiles: Enable to only return files. Defaults totrue.signal: AnAbortSignalto abort crawling the file system.
tinyglobby is downloaded many times by projects all around the world. Here's a partial list of notable projects that use it:
vitepnpmnode-gypeslint-import-resolver-typescriptvitestcopy-webpack-pluginstorybookts-morphnxsort-package-jsonunimporttsuplernacspellnuxtpostcss-mixinsastrounocssvitepresspkg-pr-new- Your own project? Open an issue if you feel like this list is incomplete.