npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tiny-glob

v0.2.9

Published

Tiny and extremely fast globbing

Downloads

7,052,224

Readme

"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