dir2
Version:
Get all directories within a directory.
50 lines (31 loc) • 916 B
Markdown
# dir2 [](https://npmjs.com/package/dir2) [](https://npmjs.com/package/dir2) [](https://circleci.com/gh/egoist/dir2)
> Get all directories within a directory.
## Install
```bash
$ npm install --save dir2
```
## Usage
```js
const dir2 = require('dir2')
// async
dir2('.')
.then(dirs => {
console.log(dirs)
// => ['.git', 'node_modules']
})
// sync
dir2.sync('.')
```
## API
### dir2(sourceDirectory, [options])
#### sourceDirectory
Type: `string`<br>
Required: `true`
The directory to look into.
#### options
##### prefix
Type: `Boolean`<br>
Default: `false`
Prefixing source path to returned directory name. Like `.git` => `/source/path/.git`.
## License
MIT © [EGOIST](https://github.com/egoist)