tinyglobby (source, npm)
A fast and minimal alternative to globby and fast-glob
import { glob, globSync } from 'tinyglobby';
await glob(['files/*.ts', '!**/*.d.ts'], { cwd: 'src' });
globSync('src/**/*.ts', { ignore: '**/*.d.ts' });
This package was created as a minimal glob library that's as tiny and fast as possible, as most glob libraries nowadays are bloated and indirectly depend on code that isn't too optimal.
It aims to be as close to a drop-in replacement to globby
and fast-glob
as possible, since they both have certain behaviors not present in any other glob libraries, which aren't straightforward to recreate manually. You can read the migration guide for an in-depth explanation on how to switch.
Documentation
See the documentation page for an overview of the library's API.
Speed and Size
tinyglobby
is faster than other glob libraries in the vast majority of use cases. The difference gets bigger the more files you match.
The reason it's so fast is not only because it was coded with performance in mind, but also because it relies on two extremely fast libraries, fdir
, the fastest file system crawler and picomatch
, (almost) the fastest matcher. Both use zero dependencies.
In terms of size, tinyglobby
currently has 170KB of package size, compared to globby
's 631KB and fast-glob
's 513KB.
It only has two subdependencies while globby
has 23 and fast-glob
has 17. This makes install times noticeably faster and means less code and libraries to install and depend on.
Used by
tinyglobby
is used by many projects of the JavaScript ecosystem, leading to over 25 million weekly downloads. It's being developed in my spare time. Consider sponsoring if you'd like to support the development of this project and make my involvement more sustainable.