Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

your-local-developer/walker

Open more actions menu

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.