An open API service indexing awesome lists of open source software.

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.

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.