All Projects → micromatch → bash-glob

micromatch / bash-glob

Licence: MIT License
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to bash-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 (+315.38%)
Mutual labels:  files, fs, match, glob, node-glob
matched
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.
Stars: ✭ 25 (+92.31%)
Mutual labels:  files, pattern, fs, glob, file-system
Micromatch
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Stars: ✭ 1,979 (+15123.08%)
Mutual labels:  glob, matcher, extglob, node-glob
glob
Pure Nim library for matching file paths against Unix style glob patterns.
Stars: ✭ 58 (+346.15%)
Mutual labels:  pattern, match, glob
extglob
Extended globs. Add (almost) the expressive power of regular expressions to glob patterns.
Stars: ✭ 25 (+92.31%)
Mutual labels:  pattern, glob, extglob
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+20507.69%)
Mutual labels:  files, glob
spec-pattern
Specification design pattern for JavaScript and TypeScript with bonus classes
Stars: ✭ 43 (+230.77%)
Mutual labels:  pattern, matcher
route pattern generator
A Dart static code generator that produces matchers and builders from route uri patterns.
Stars: ✭ 31 (+138.46%)
Mutual labels:  pattern, match
html-comment-regex
Regular expression for matching HTML comments
Stars: ✭ 15 (+15.38%)
Mutual labels:  pattern, match
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (+569.23%)
Mutual labels:  files, fs
write-yaml
Basic node.js utility for converting JSON to YAML and writing formatting YAML files to disk.
Stars: ✭ 38 (+192.31%)
Mutual labels:  fs, file-system
regXwild
⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.
Stars: ✭ 20 (+53.85%)
Mutual labels:  match, glob
Xcv
✂️ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (+1007.69%)
Mutual labels:  files, glob
Globby
User-friendly glob matching
Stars: ✭ 1,864 (+14238.46%)
Mutual labels:  files, glob
Write Files Atomic
Write many files atomically
Stars: ✭ 126 (+869.23%)
Mutual labels:  files, fs
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+2876.92%)
Mutual labels:  files, fs
globrex
Glob to regular expression with support for extended globs.
Stars: ✭ 52 (+300%)
Mutual labels:  pattern, glob
dir-glob
Convert directories to glob compatible strings
Stars: ✭ 41 (+215.38%)
Mutual labels:  pattern, glob
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (+2307.69%)
Mutual labels:  files, fs
Temperment
Get a random temporary file or directory path that will delete itself
Stars: ✭ 21 (+61.54%)
Mutual labels:  files, fs

bash-glob NPM version NPM monthly downloads NPM total downloads Linux Build Status

Bash-powered globbing for node.js

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save bash-glob

Install bash 4.3 or later

I recommend using homebrew to install/upgrade bash:

$ brew upgrade bash

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 Bash-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.

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.

Example

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

.each

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

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.

Example

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

.sync

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

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.

Example

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

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 advice on opening issues, pull requests, and coding standards.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

  • bash-match: Match strings using bash. Does not work on windows, and does not read from the… more | homepage
  • braces: Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… more | homepage
  • micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | homepage
  • nanomatch: Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… more | homepage

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on October 22, 2017.

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].