Skip to content

your-local-developer/walker

Repository files navigation

🚶🌳📁

A small and simple library for traversing nested directories.

Usage

A very simple example:

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:

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 - see the LICENSE file for details.

About

A small and simple library for traversing nested directories.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published