children-dirs
Get paths of directories in a directory.
Why?
- Lists only directories, unlike
fs.readdir()
. - Uses
process.cwd()
by default. - Resilient to race conditions involving
process.chdir()
.
Install
npm install children-dirs --save
Usage
Get it into your program.
const childrenDirs = ;
Get a list of directories.
const dirs = await ;console;// => ['/home/me/my-project/.git', '/home/me/my-project/lib']
API
childrenDirs(cwd)
Returns a Promise
for an Array
of absolute paths for directories that are immediate children of cwd
.
cwd
Type: string
Default: process.cwd()
The directory to search.
Contributing
See our contributing guidelines for more details.
- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
License
Go make something, dang it.