https://github.com/tiaanduplessis/read-dir-recur
Recursively read directories
https://github.com/tiaanduplessis/read-dir-recur
fs read readdir recursive
Last synced: 11 months ago
JSON representation
Recursively read directories
- Host: GitHub
- URL: https://github.com/tiaanduplessis/read-dir-recur
- Owner: tiaanduplessis
- License: mit
- Created: 2018-11-17T08:48:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-02T22:37:02.000Z (about 7 years ago)
- Last Synced: 2025-07-31T13:32:48.180Z (11 months ago)
- Topics: fs, read, readdir, recursive
- Language: JavaScript
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# read-dir-recur
[](https://npmjs.org/package/read-dir-recur)
[](https://npmjs.org/package/read-dir-recur)
[](https://github.com/RichardLitt/standard-readme)
[](https://npmjs.org/package/read-dir-recur)
[](http://makeapullrequest.com)
> Recursively read directories
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#License)
## Install
This project uses [node](https://nodejs.org) and [npm](https://www.npmjs.com).
```sh
$ npm install read-dir-recur
$ # OR
$ yarn add read-dir-recur
```
## Usage
When reading `dir` with this structure:
```
bar/
├── baaa
├── baz.js
├── ping.js
└── pong.md
```
```js
const readDirRecur = require('read-dir-recur')
console.log(readDirRecur({ readFile: false, pattern: '*.js', ignore: ['baaa'], base: ROOT_DIR }))
// { bar:
// [ { base: 'bar', name: 'baz.js', ext: '.js', size: 0 },
// { base: 'bar', name: 'ping.js', ext: '.js', size: 0 } ] }
```
Uses [micromatch](https://github.com/micromatch/micromatch) for `pattern` and `ignore` of files.
## Contribute
1. Fork it and create your feature branch: `git checkout -b my-new-feature`
2. Commit your changes: `git commit -am "Add some feature"`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request
## License
MIT