Match files and dirs using glob patterns.
tiny-glob
is 🔥 extremely fast, 💪 powerful, 📦 tiny util to match files and folders using glob patterns.
Get it: npm install tiny-glob
Sample usage:
1
2
3
4
5
6
| const glob = require('tiny-glob');
(async function(){
let files = await glob('src/*/*.{js,md}');
// => [ ... ] array of matching files
})();
|
Benchmark results:
1
2
3
4
5
6
7
8
9
10
11
12
13
| glob x 13,405 ops/sec ±1.80% (85 runs sampled)
fast-glob x 25,745 ops/sec ±2.76% (59 runs sampled)
tiny-glob x 102,658 ops/sec ±0.79% (91 runs sampled)
Fastest is tiny-glob
┌───────────┬─────────────────────────┬─────────────┬────────────────┐
│ Name │ Mean time │ Ops/sec │ Diff │
├───────────┼─────────────────────────┼─────────────┼────────────────┤
│ glob │ 0.00007459990597268128 │ 13,404.843 │ N/A │
├───────────┼─────────────────────────┼─────────────┼────────────────┤
│ fast-glob │ 0.000038842529587611705 │ 25,744.976 │ 92.06% faster │
├───────────┼─────────────────────────┼─────────────┼────────────────┤
│ tiny-glob │ 0.00000974110141018254 │ 102,657.796 │ 298.75% faster │
└───────────┴─────────────────────────┴─────────────┴────────────────┘
|
GIF FTW!