1 | # glob-extra
|
2 |
|
3 | [![NPM version](https://img.shields.io/npm/v/glob-extra.svg?style=flat)](https://www.npmjs.org/package/glob-extra)
|
4 | [![Build Status](https://travis-ci.org/gemini-testing/glob-extra.svg?branch=master)](https://travis-ci.org/gemini-testing/glob-extra)
|
5 | [![Coverage Status](https://img.shields.io/coveralls/gemini-testing/glob-extra.svg?style=flat)](https://coveralls.io/r/gemini-testing/glob-extra?branch=master)
|
6 | [![Dependency Status](https://img.shields.io/david/gemini-testing/glob-extra.svg?style=flat)](https://david-dm.org/gemini-testing/glob-extra)
|
7 |
|
8 | Wrapper for utility [glob](https://github.com/isaacs/node-glob) with promises support which provides expanding of masks, dirs and files to absolute file paths.
|
9 |
|
10 | ## Installation
|
11 |
|
12 | ```bash
|
13 | $ npm install glob-extra
|
14 | ```
|
15 |
|
16 | ## Usage
|
17 |
|
18 | ```js
|
19 | const globExtra = require('glob-extra');
|
20 | const paths = ['some/path', 'other/path/*.js', 'other/deep/path/**/*.js']
|
21 |
|
22 | // options are optional
|
23 | globExtra.expandPaths(paths, options)
|
24 | .then((files) => {
|
25 | // ['/absolute/some/path/file1.js',
|
26 | // '/absolute/other/path/file2.js',
|
27 | // '/absolute/other/deep/path/dir/file3.js']
|
28 | })
|
29 | .done();
|
30 | ```
|
31 |
|
32 | ### Options
|
33 |
|
34 | * **formats** *{String[]}* – files formats to expand; it will expand all files by default. For example:
|
35 |
|
36 | ```js
|
37 | globExtra.expandPaths(paths, {formats: ['.txt', '.js']})
|
38 | .then((files) => {
|
39 | // will expand only js ant txt files
|
40 | })
|
41 | .done();
|
42 | ```
|