#walk #directory-traversal #walk-dir

async-walkdir

Asynchronous directory traversal for Rust

4 releases (2 stable)

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

#100 in Asynchronous

Download history 17170/week @ 2024-06-27 16917/week @ 2024-07-04 16932/week @ 2024-07-11 11887/week @ 2024-07-18 16395/week @ 2024-07-25 18817/week @ 2024-08-01 16781/week @ 2024-08-08 19683/week @ 2024-08-15 22528/week @ 2024-08-22 19685/week @ 2024-08-29 13660/week @ 2024-09-05 11840/week @ 2024-09-12 9380/week @ 2024-09-19 11200/week @ 2024-09-26 11029/week @ 2024-10-03 7948/week @ 2024-10-10

41,598 downloads per month
Used in 32 crates (14 directly)

Apache-2.0

19KB
338 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.3–1.8MB
~34K SLoC