async-walkdir

Crates.ioasync-walkdir
lib.rsasync-walkdir
version2.0.0
sourcesrc
created_at2020-08-31 09:08:06.611118
updated_at2024-06-16 14:15:42.787476
descriptionAsynchronous directory traversal for Rust.
homepagehttps://github.com/ririsoft/async-walkdir
repositoryhttps://github.com/ririsoft/async-walkdir
max_upload_size
id282990
size30,570
Ririsoft (ririsoft)

documentation

https://docs.rs/async-walkdir/

README

Github CI docs.rs

async-walkdir

Asynchronous directory traversal for Rust.

Based on async-fs and blocking, it uses a thread pool to handle blocking IOs. Please refere to those crates for the rationale. This crate is compatible with async runtimes tokio, async-std, smol and potentially any runtime based on futures 0.3

We do not plan to be as feature full as Walkdir crate in the synchronous world, but do not hesitate to open an issue or a PR.

Example

use async_walkdir::WalkDir;
use futures_lite::future::block_on;
use futures_lite::stream::StreamExt;

block_on(async {
    let mut entries = WalkDir::new("my_directory");
    loop {
        match entries.next().await {
            Some(Ok(entry)) => println!("file: {}", entry.path().display()),
            Some(Err(e)) => {
                eprintln!("error: {}", e);
                break;
            },
            None => break,
        }
    }
});
Commit count: 15

cargo fmt