3 releases (1 stable)

1.0.0 Jan 4, 2024
0.2.0 Sep 7, 2020
0.1.0 Aug 31, 2020

#77 in Asynchronous

Download history 2795/week @ 2023-12-23 3320/week @ 2023-12-30 5666/week @ 2024-01-06 6074/week @ 2024-01-13 5164/week @ 2024-01-20 5753/week @ 2024-01-27 6063/week @ 2024-02-03 7312/week @ 2024-02-10 4710/week @ 2024-02-17 5984/week @ 2024-02-24 8364/week @ 2024-03-02 11230/week @ 2024-03-09 10312/week @ 2024-03-16 11418/week @ 2024-03-23 10550/week @ 2024-03-30 11925/week @ 2024-04-06

45,160 downloads per month
Used in 32 crates (16 directly)

Apache-2.0

15KB
257 lines

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,
        }
    }
});

Dependencies

~1.5MB
~21K SLoC