#directory #parallel #walk #scan #recursion

folder

The package allows for scanning directories in parallel

12 releases (breaking)

new 0.9.0 Dec 28, 2024
0.7.0 Dec 26, 2024
0.6.0 Feb 20, 2024
0.5.1 Oct 20, 2023
0.5.0 Mar 7, 2023

#428 in Filesystem

Download history 15/week @ 2024-09-20 9/week @ 2024-09-27 30/week @ 2024-10-04 103/week @ 2024-10-11 84/week @ 2024-10-18 8/week @ 2024-10-25 8/week @ 2024-11-01 1/week @ 2024-11-08 25/week @ 2024-11-22 19/week @ 2024-11-29 11/week @ 2024-12-06 23/week @ 2024-12-13 126/week @ 2024-12-20 343/week @ 2024-12-27

504 downloads per month
Used in founder

Apache-2.0/MIT

9KB
88 lines

Folder Package Documentation Build

The package allows for scanning directories in parallel.

Examples

Synchronously:

use std::path::{Path, PathBuf};

use folder::scan;

let filter = |path: &Path| path.ends_with(".rs");
let map = |path: PathBuf, _| path.metadata().unwrap().len();
let fold = |sum, value| sum   value;
let _ = scan("src", filter, map, (), None).fold(0, fold);

Asynchronously:

use std::path::{Path, PathBuf};

use folder::asynchronous::scan;
use futures::stream::StreamExt;

let filter = |path: &Path| path.ends_with(".rs");
let map = |path: PathBuf, _| async move { path.metadata().unwrap().len() };
let fold = |sum, value| async move { sum   value };
let _ = scan("src", filter, map, (), None).fold(0, fold).await;

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.

Dependencies

~0.1–7.5MB
~56K SLoC