# dir-glob

> Convert directories to glob compatible strings

Latest version **3.0.1** (published 2019-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install dir-glob
pnpm add dir-glob
yarn add dir-glob
bun add dir-glob
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2019-06-29 |
| First published | 2016-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/dir-glob) |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Kevin Mårtensson |
| Maintainers | kevva, sindresorhus |
| Keywords | convert, directory, extensions, files, glob |

## Links

- npm: https://www.npmjs.com/package/dir-glob
- Repository: https://github.com/kevva/dir-glob
- Homepage: https://github.com/kevva/dir-glob#readme
- Issues: https://github.com/kevva/dir-glob/issues
- npm.io page: https://npm.io/package/dir-glob

## Dependencies (1)

- [path-type](https://npm.io/package/path-type.md) ^4.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 3.0.1 (latest) — 2019-06-29
- 3.0.0 — 2019-06-27
- 2.2.2 — 2019-01-20
- 2.2.1 — 2019-01-10
- 2.2.0 — 2019-01-09
- 2.0.0 — 2017-07-24
- 1.1.0 — 2016-01-08
- 1.0.2 — 2016-01-08
- 1.0.1 — 2016-01-08
- 1.0.0 — 2016-01-08

## README

# dir-glob [![Build Status](https://travis-ci.org/kevva/dir-glob.svg?branch=master)](https://travis-ci.org/kevva/dir-glob)

> Convert directories to glob compatible strings


## Install

```
$ npm install dir-glob
```


## Usage

```js
const dirGlob = require('dir-glob');

(async () => {
	console.log(await dirGlob(['index.js', 'test.js', 'fixtures']));
	//=> ['index.js', 'test.js', 'fixtures/**']

	console.log(await dirGlob(['index.js', 'inner_folder'], {cwd: 'fixtures'}));
	//=> ['index.js', 'inner_folder/**']

	console.log(await dirGlob(['lib/**', 'fixtures'], {
		files: ['test', 'unicorn']
		extensions: ['js']
	}));
	//=> ['lib/**', 'fixtures/**/test.js', 'fixtures/**/unicorn.js']

	console.log(await dirGlob(['lib/**', 'fixtures'], {
		files: ['test', 'unicorn', '*.jsx'],
		extensions: ['js', 'png']
	}));
	//=> ['lib/**', 'fixtures/**/test.{js,png}', 'fixtures/**/unicorn.{js,png}', 'fixtures/**/*.jsx']
})();
```


## API

### dirGlob(input, options?)

Returns a `Promise<string[]>` with globs.

### dirGlob.sync(input, options?)

Returns a `string[]` with globs.

#### input

Type: `string | string[]`

Paths.

#### options

Type: `object`

##### extensions

Type: `string[]`

Append extensions to the end of your globs.

##### files

Type: `string[]`

Only glob for certain files.

##### cwd

Type: `string[]`

Test in specific directory.

---
_Source: https://npm.io/package/dir-glob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
