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

@agebrock/glob

v1.0.7

Published

fast glob lib optimized for easy usage

Downloads

13

Readme

_glob

A Versatile CLI Tool for Efficient File Globbing

Globbing made easy! _glob is a command-line interface (CLI) tool designed to swiftly search and manipulate files based on patterns. Whether you're hunting for specific files, directories, or both, _glob has got you covered with its extensive feature set and intuitive usage.

Usage

_glob [options] <pattern>

Options

  • -a, --absolute: Return absolute paths for entries
  • -b, --baseNameMatch: Match the base name of the path
  • -c, --caseSensitiveMatch: Perform a case-sensitive match
  • -C, --concurrency <number>: Set the maximum number of concurrent requests
  • -f, --followSymbolicLinks: Follow symbolic links
  • -i, --ignore <pattern>: Add a pattern to exclude
  • -m, --markDirectories: Append / to directories
  • -o, --objectMode: Return objects instead of strings
  • -D, --onlyDirectories: Return only directories
  • -F, --onlyFiles: Return only files
  • -B, --uniqueBaseName: Return only unique filenames even if they are in different directories
  • -S, --stats: Return stats for entries
  • -s, --suppressErrors: Suppress errors
  • -t, --throwErrorOnBrokenSymbolicLink: Throw an error on broken symbolic links
  • -u, --unique: Ensure that the returned entries are unique
  • --cwd <path>: The current working directory for the glob
  • --dot: Include entries that begin with a .
  • -O --outputCollection <outputCollection>: Output the collection to a file or stdout by passing "stdout"
  • -h, --help: Display help for command

Example Usage as Library

// Use with relative paths
const stream = _glob('../!(node_modules)**/!(*.d)*.ts', { outputCollection: "./files.json" });

// Use with Windows drives or Linux
// The following example will search for all .ts files in the C:/Users directory, excluding the node_modules directory and excluding .d.ts files
const stream = _glob('C:/Users/!(node_modules)**/!(*.d)*.ts', { outputCollection: "./files.json" });

stream.pipe(process.stdout);

stream.on('data', (chunk) => {
    console.log(chunk.toString());
});

// This will be triggered when the stream is done and collect equals to true or outputCollection is set
stream.on('files', (files) => {
    console.log(files);
});

Example Usage in the CLI

 _glob.cmd *.json -O stdout

 will output all matching files in a JSON format to the console

## PowerShell Autocomplete

For easy usage with PowerShell autocomplete, _glob normalizes Windows paths. Here's an example:

```powershell
# Use with PowerShell
_glob D:\agebrock\**\* 

Example Usage in PowerShell

# Glob all JSON files and read their contents
_glob '**/*.json' | ForEach-Object { Get-Content $_ }

Installation

Install _glob globally to access it from anywhere:

npm install -g @agebrock/glob

Contribution

Contributions are welcome! Feel free to open issues or pull requests on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Get globbing with _glob and experience the power of effortless file searching and manipulation. Happy coding! 🚀

Available Scripts

  • clean - remove coverage data, Jest cache and transpiled files,
  • prebuild - lint source files and tests before building,
  • build - transpile TypeScript to ES6,
  • build:watch - interactive watch mode to automatically transpile source files,
  • lint - lint source files and tests,
  • prettier - reformat files,
  • test - run tests,
  • test:watch - interactive watch mode to automatically re-run tests