Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bash-glob

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bash-glob

Bash-powered globbing for node.js

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105K
decreased by-2.2%
Maintainers
1
Weekly downloads
 
Created
Source

bash-glob NPM version NPM downloads Build Status

Bash-powered globbing for node.js

Install

Install with npm:

$ npm install --save bash-glob

Why?

The initial motivation was to use this for generating the expected values for comparisons in tests. But as it turns out, this is faster than node-glob in most cases I've tested.

Moreover, this supports the majority of the feature-functionaly in node-glob, and it's more Base-compliant since, well, it is Bash.

Edge cases

Inevitably there will be edge cases. Thus far, however, I've found that many of the edge cases that seem to be problematic are already addressed or not problematic for Bash.

Please feel free to create an issue if you find a bug or have a feature request.

Usage

var glob = require('bash-glob');
glob(pattern[, options]);

API

glob

Asynchronously returns an array of files that match the given pattern or patterns.

Example

var glob = require('bash-glob');
glob('*.js', function(err, files) {
  if (err) return console.log(err);
  console.log(files);
});

Params

  • patterns {String|Array}: One or more glob patterns to use for matching.
  • options {Object}: Options to pass to bash. See available options.
  • cb {Function}: Callback function, with err and files array.

.each

Asynchronously glob an array of files that match any of the given patterns.

Example

var glob = require('bash-glob');
glob.each(['*.js', '*.md'], {dot: true}, function(err, files) {
  if (err) return console.log(err);
  console.log(files);
});

Params

  • patterns {String}: One or more glob patterns to use for matching.
  • options {Object}: Options to pass to bash. See available options.
  • cb {Function}: Callback function, with err and files array.

.sync

Returns an array of files that match the given patterns or patterns.

Example

var glob = require('bash-glob');
console.log(glob.sync('*.js', {cwd: 'foo'}));
console.log(glob.sync(['*.js'], {cwd: 'bar'}));

Params

  • patterns {String}: One or more glob patterns to use for matching.
  • options {Object}: Options to pass to bash. See available options.
  • returns {Array}: Returns an array of files.

Options

The following options may be used with the main glob function or any other method:

  • dotglob: (or dot, for node-glob compatibility) Includes filenames beginning with a . (dot) in the results of pathname expansion.
  • extglob: Enable extended pattern matching features.
  • failglob: If set, patterns that fail to match filenames during pathname expansion result in an error message.
  • globstar: Enable recursive globbing with **.
  • nocaseglob: (or nocase, for node-glob compatibility) Enable case-insensitive matching in filenames when performing pathname expansion.
  • nullglob: If set, Bash allows patterns which match no files to expand to a null string, rather than themselves.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for avice on opening issues, pull requests, and coding standards.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.31, on October 01, 2016.

Keywords

FAQs

Package last updated on 02 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc