All Projects → terkelg → Tiny Glob

terkelg / Tiny Glob

Licence: mit
Super tiny and ~350% faster alternative to node-glob

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Tiny Glob

Fast Glob
🚀 It's a very fast and efficient glob library for Node.js
Stars: ✭ 1,150 (+61.97%)
Mutual labels:  patterns, filesystem, glob
Glob
Glob for C++17
Stars: ✭ 74 (-89.58%)
Mutual labels:  pattern-matching, filesystem, glob
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+277.32%)
Mutual labels:  filesystem, glob
Globby
User-friendly glob matching
Stars: ✭ 1,864 (+162.54%)
Mutual labels:  patterns, glob
Expat
Reusable, composable patterns across Elixir libraries
Stars: ✭ 157 (-77.89%)
Mutual labels:  pattern-matching, patterns
Xcv
✂️ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (-79.72%)
Mutual labels:  filesystem, glob
Draxt
draxt.js – NodeList/jQuery-like package for File System (node.js)
Stars: ✭ 192 (-72.96%)
Mutual labels:  filesystem, glob
Nanomatch
Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but without support for extended globs (extglobs), posix brackets or braces, and with complete Bash 4.3 wildcard support: ("*", "**", and "?").
Stars: ✭ 79 (-88.87%)
Mutual labels:  pattern-matching, glob
deglob
📂 Take a list of glob patterns and return an array of file locations, respecting `.gitignore` and allowing for ignore patterns via `package.json`.
Stars: ✭ 38 (-94.65%)
Mutual labels:  patterns, glob
tartifacts
📦 Create artifacts for your assemblies
Stars: ✭ 20 (-97.18%)
Mutual labels:  patterns, glob
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (-92.39%)
Mutual labels:  patterns, glob
Fdir
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
Stars: ✭ 777 (+9.44%)
Mutual labels:  filesystem, glob
Sig
The most powerful and customizable binary pattern scanner
Stars: ✭ 131 (-81.55%)
Mutual labels:  patterns, pattern-matching
glob
Pure Nim library for matching file paths against Unix style glob patterns.
Stars: ✭ 58 (-91.83%)
Mutual labels:  filesystem, glob
librxvm
non-backtracking NFA-based regular expression library, for C and Python
Stars: ✭ 57 (-91.97%)
Mutual labels:  patterns, pattern-matching
replace-in-files
Replace text in one or more files or globs.
Stars: ✭ 21 (-97.04%)
Mutual labels:  filesystem, glob
S5cmd
Parallel S3 and local filesystem execution tool.
Stars: ✭ 565 (-20.42%)
Mutual labels:  filesystem
Fsmon
monitor filesystem on iOS / OS X / Android / FirefoxOS / Linux
Stars: ✭ 635 (-10.56%)
Mutual labels:  filesystem
React Best Practices
A comprehensive reference guide to kickstart your React architecting career!
Stars: ✭ 566 (-20.28%)
Mutual labels:  patterns
Zsh Z
Jump quickly to directories that you have visited "frecently." A native ZSH port of z.sh.
Stars: ✭ 562 (-20.85%)
Mutual labels:  filesystem

Tiny Glob

tiny glob

version travis AppVeyor downloads install size

Tiny and extremely fast library to match 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-glob

Core Features

  • 🔥 extremely fast: ~350% faster than node-glob and ~230% faster than fast-glob
  • 💪 powerful: supports advanced globbing patterns (ExtGlob)
  • 📦 tiny: only ~45 LOC with 2 small dependencies
  • 👫 friendly: simple and easy to use api
  • 🎭 cross-platform: supports both unix and windows

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.

OBS: Please only use forward-slashes in glob expressions. Even on windows

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.

options.flush

Type: Boolean
Default: false

Flush the internal cache object.

Windows

Though Windows may use /, \, or \\ as path separators, you can only use forward-slashes (/) when specifying glob expressions. Any back-slashes (\) will be interpreted as escape characters instead of path separators.

This is common across many glob-based modules; see node-glob for corroboration.

Benchmarks

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 │
└───────────┴─────────────────────────┴─────────────┴────────────────┘

Advanced Globbing

Learn more about advanced globbing

License

MIT © Terkel Gjervig

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].