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

glob-cmd

v0.0.7

Published

This is a glob implementation in JavaScript for command line use.

Downloads

1

Readme

Match files using the patterns the shell uses, like stars and stuff. This is a glob implementation in JavaScript for command line use.

Install globally

If you require() this module, it will return just glob.

npm i glob-cmd -g

Help

A list of all currently possible options.

glob --help

  Usage: glob [options]

  Options:

    -V, --version                output the version number
    -j, --json                   JSON encode matches (default separates by newline)
    -m, --module                 Modulify matches to JS_COMMON module (module.exports)
    -s, --delimiter [separator]  Separate matches by delimiter (default separator is newline)
    -o, --output [filename]      Write to file (write to stdout by default)
    -c, --cwd [directory]        The current working directory in which to search
    -n, --nodir                  Do not match directories, only files (Note: to match only directories, simply put a / at the end of the pattern)
    -h, --help                   output usage information

Examples

Simplest

List all .js files in current directory.

Command:

glob *.js

Output:

index.js
utils.js
cli.js
someotherstuff.js

JSON

List mp3 files in current directory and JSON encode matches.

Command:

glob --json *.mp3

Output:

[
   "01. SIR DRUMSALOT.mp3",
   "02. BRAVE.mp3",
   "03. WAKE UP FOOL.mp3",
   "04. THE FEVER IS GROWING.mp3",
   "05. THE LIFE FOR ME.mp3",
   "06. MAKE BELIEVE.mp3",
   "07. FUNNY KIND OF LOVE.mp3",
   "08. WITHOUT YOU.mp3",
   "09. RUNNING.mp3",
   "10. REALITY.mp3",
   "11. IT WILL NOT END.mp3",
   "12. SCREW IT.mp3"
]

Module

List mp3 files in current directory and modulify matches.

Command:

glob --m *.mp3

Output:

module.exports = [
   "01. SIR DRUMSALOT.mp3",
   "02. BRAVE.mp3",
   "03. WAKE UP FOOL.mp3",
   "04. THE FEVER IS GROWING.mp3",
   "05. THE LIFE FOR ME.mp3",
   "06. MAKE BELIEVE.mp3",
   "07. FUNNY KIND OF LOVE.mp3",
   "08. WITHOUT YOU.mp3",
   "09. RUNNING.mp3",
   "10. REALITY.mp3",
   "11. IT WILL NOT END.mp3",
   "12. SCREW IT.mp3"
]

Recursive

List all .js files in all (sub)directories of current directory (c:\codegroundjs).

Command:

glob **/*.js

Outut:

dist/Codeground.js
dist/Codeground.min.js
dist/examples/es5/demo/script.js
dist/examples/es5/script.js
dist/examples/es6/demo/script.js
dist/examples/es6/script.js
dist/examples/fullscreen/demo/script.js
dist/examples/fullscreen/script.js
gulpfile.js
src/Codeground.js
test/test.js

Delimiter (separator)

Use a delimiter to separate matches. In this case, a semi colon.

Command:

glob --delimiter ; *.mp3

Output:

01. SIR DRUMSALOT.mp3;02. BRAVE.mp3;03. WAKE UP FOOL.mp3;04. THE FEVER IS GROWING.mp3;05. THE LIFE FOR ME.mp3;06. MAKE BELIEVE.mp3;07. FUNNY KIND OF LOVE.mp3;08. WITHOUT YOU.mp3;09. RUNNING.mp3;10. REALITY.mp3;11. IT WILL NOT END.mp3;12. SCREW IT.mp3;

Working directory

List all files, directories and subdirectories in node_modules/codegroundjs.

Command:

glob --cwd "e:/npm/node_modules/codegroundjs" **/*

Output:

_config.yml
assets
assets/codeground-rows.png
assets/codeground.png
bower.json
dist
dist/codeground.css
dist/Codeground.js
dist/codeground.min.css
dist/Codeground.min.js
dist/examples
dist/examples/es5
dist/examples/es5/demo
dist/examples/es5/demo/demo.html
dist/examples/es5/demo/script.js
dist/examples/es5/demo/style.css
dist/examples/es5/index.html
dist/examples/es5/script.js
dist/examples/es5/style.css
dist/examples/es6
dist/examples/es6/demo
dist/examples/es6/demo/demo.html
dist/examples/es6/demo/script.js
dist/examples/es6/demo/style.css
dist/examples/es6/index.html
dist/examples/es6/script.js
dist/examples/fullscreen
dist/examples/fullscreen/demo
dist/examples/fullscreen/demo/demo.html
dist/examples/fullscreen/demo/script.js
dist/examples/fullscreen/demo/style.css
dist/examples/fullscreen/index.html
dist/examples/fullscreen/script.js
dist/examples/fullscreen/style.css
gulpfile.js
package.json
README.md
src
src/codeground.css
src/Codeground.js
test
test/test.js

Match only files/directories

Recursively list only files (no directories) in C:\files and write the results as JSON to found.json

Command:

glob --nodir --json --cwd "c:\files" --output found.json **/*