Package Exports
- tiny-glob
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tiny-glob) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tiny glob
Tiny and super fast library to matches files and folders using glob patterns.
"Globs" is the common name for a specific type of pattern used to match files and folders. It's the patterns you type when you do stuff like ls *.js in your shell or put src/* in a .gitignore file. When used to match filenames, it's sometimes called a "wildcard".
Install
npm install tiny-globCore Features
- 🔥 ultra fast: ~250% faster than node-glob and 85.70% faster than fast-glob
- 💪 powerful: supports advanced globbing patterns (
ExtGlob) - 📦 tiny: only ~70 LOC with only 2 small dependencies
- 👫 friendly: simple and easy to use api
Usage
const glob = require('tiny-glob');
(async function(){
let files = await glob('src/*/*.{js,md}');
// => [ ... ] array of matching files
})();API
glob(str, options)
Type: function
Returns: Array
Return array of matching files and folders
This function is async and returns a promise.
str
Type: String
The glob pattern to match against.
options.cwd
Type: String
Default: '.'
Change default working directory.
options.dot
Type: Boolean
Default: false
Allow patterns to match filenames or directories that begin with a period (.).
options.absolute
Type: Boolean
Default: false
Return matches as absolute paths.
options.filesOnly
Type: Boolean
Default: false
Skip directories and return matched files only.
Benchmarks
glob x 14,171 ops/sec ±0.84% (84 runs sampled)
fast-glob x 25,996 ops/sec ±1.57% (85 runs sampled)
tiny-glob x 91,406 ops/sec ±4.29% (81 runs sampled)
Fastest is tiny-glob
┌───────────┬─────────────────────────┬────────────┬────────────────┐
│ Name | Mean time │ Ops/sec │ Diff │
├───────────┼─────────────────────────┼────────────┼────────────────┤
│ glob | 0.00007056743443261285 │ 14,170.843 │ N/A │
├───────────┼─────────────────────────┼────────────┼────────────────┤
│ fast-glob │ 0.00003846778050833284 │ 25,995.781 │ 83.45% faster │
├───────────┼─────────────────────────┼────────────┼────────────────┤
│ tiny-glob │ 0.000010940155968612903 | 91,406.375 │ 251.62% faster │
└───────────┴─────────────────────────┴────────────┴────────────────┘Advanced Globbing
Learn more about advanced globbing
License
MIT © Terkel Gjervig