https://github.com/your-local-developer/walker
A small and simple library for traversing nested directories.
https://github.com/your-local-developer/walker
Last synced: 11 months ago
JSON representation
A small and simple library for traversing nested directories.
- Host: GitHub
- URL: https://github.com/your-local-developer/walker
- Owner: your-local-developer
- License: mit
- Created: 2022-09-14T13:37:18.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T18:08:08.000Z (over 3 years ago)
- Last Synced: 2025-03-05T07:45:55.285Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 1020 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# πΆπ³π
A small and simple library for traversing nested directories.
## Usage
A very simple example:
```js
import {walk, WalkError} from '@bode.fun/walker'
for (const dirent of walk({rootPath: new URL('./node_modules', import.meta.url)})) {
if (dirent instanceof WalkError) {
console.error(dirent.path)
} else {
// This will be a lot π₯²
console.log(dirent.path)
}
}
```
Limiting the depth to only one subdirectory:
```js
import {walk, WalkError} from '@bode.fun/walker'
for (const dirent of walk({rootPath: new URL('./node_modules', import.meta.url), depthLimit: 1})) {
if (dirent instanceof WalkError) {
console.error(dirent.path)
} else {
// This will not be as much π₯³
console.log(dirent.path)
}
}
```
## π License
This library is licensed under [the MIT License](https://mit-license.org/) - see the [LICENSE](LICENSE) file for details.