# deep-list-dir

> Recursively lists given directory, alternatively filtering results with given options

Latest version **1.4.4** (published 2021-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install deep-list-dir
pnpm add deep-list-dir
yarn add deep-list-dir
bun add deep-list-dir
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.4 |
| Published | 2021-02-06 |
| First published | 2020-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 24.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Martin Rafael Gonzalez |
| Maintainers | tin_r |
| Keywords | deep, deeply, recursive, list, scan, directory, folder, file, filter, glob, pattern |

## Links

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

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4

## 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

- 1.4.4 (latest) — 2021-02-06
- 1.4.3 — 2021-01-26
- 1.4.2 — 2020-11-27
- 1.4.1 — 2020-08-20
- 1.4.0 — 2020-08-04
- 1.3.0 — 2020-06-28
- 1.2.0 — 2020-06-06
- 1.1.0 — 2020-05-27
- 1.0.1 — 2020-05-27
- 1.0.0 — 2020-05-27

## README

# deep-list-dir
> Deeply lists a directory filtering files by given pattern(s)

<a href="https://www.npmjs.com/package/deep-list-dir" target="_blank"><img src="https://img.shields.io/npm/v/deep-list-dir.svg" alt="Version"></a>
[![tests](https://github.com/devtin/deep-list-dir/workflows/test/badge.svg)](https://github.com/devtin/deep-list-dir/actions)

This module recursively lists all files in given directory (including sub-folders) by early filtering the results using the
given `pattern` which can be an array of <a href="https://www.npmjs.com/package/minimatch" target="_blank">minimatch</a>
expressions or `RegExp`.

It will return all matching results. <a href="https://www.npmjs.com/package/minimatch" target="_blank">minimatch</a>
negative patterns are used to explicitly exclude a path from being scan / returned.

## Example

Take the following file structure:

```
<directory>
├── dir1
│   └── README.md
├── dir2
│   └── sub-dir2
│       ├── hi.txt
│       └── index.js
├── index.js
└── README.md
```

...and the following script:

```js
const { deepListDir, deepListDirSync } = require('deep-list-dir')

deepListDir('<directory>',
  {
    pattern: ['*.md'], // minimatch or RegExp
    // base: '', set parent base to something different than given directory
    // minimatchOptions: { matchBase: true } // minimatch options
  }
).then(console.log)
```

Will output

```json
[
  "dir1/README.md",
  "README.md"
]
```

A sync version is also provided:

```js
console.log(deepListDirSync('<directory>', { pattern: '*.js'})) 
```

Output:

```json
[
  "dir2/sub-dir2/index.js",
  "index.js"
]
```

* * *

### License

[MIT](https://opensource.org/licenses/MIT)

&copy; 2020-present Martin Rafael Gonzalez
<tin@devtin.io>

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