Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terkelg/powerwalker
πWalk directories recursively.
https://github.com/terkelg/powerwalker
directory filesystem io nodejs walker
Last synced: 3 months ago
JSON representation
πWalk directories recursively.
- Host: GitHub
- URL: https://github.com/terkelg/powerwalker
- Owner: terkelg
- License: mit
- Created: 2018-05-19T23:27:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T13:19:39.000Z (over 4 years ago)
- Last Synced: 2024-07-20T00:44:29.092Z (4 months ago)
- Topics: directory, filesystem, io, nodejs, walker
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 28
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
Awesome Lists containing this project
README
Power Walker
Walk directories recursively
> "All truly great thoughts are conceived by walking"
> β Friedrich Nietzsche## Installation
```
npm install powerwalker
```## Usage
```js
const walk = require('powerwalker');let files = await walk('path/to/walk');
```## API
### walk(dir, options)
Type: `Promise`
Returns: `Array`List all files and directories in `dir` recursively.
#### dir
Type: `String`
A directory path to walk recursively.
#### options
Type: `Object`
Default: `{ maxdepth: Infinity, flatten: true, filesonly: false }`Optional options object.
#### options.maxdepth
Type: `Number`
Default: `Infinity`Max number of directories to walk before stopping.
#### options.flatten
Type: `Boolean`
Default: `true`Option to flatten the output to a 1D array.
#### options.filesonly
Type: `Boolean`
Default: `false`Exclude directories from result.
#### options.relative
Type: `Boolean`
Default: `true`Return relative paths, or absolute paths.
#### options.cwd
Type: `String`
Default: `'.'`Custom working directory. All paths are relative to this.
## License
MIT Β© [Terkel Gjervig](https://terkel.com)