Crates.io | jwalk |
lib.rs | jwalk |
version | 0.8.1 |
source | src |
created_at | 2019-02-09 16:51:01.006676 |
updated_at | 2022-12-15 12:32:21.820633 |
description | Filesystem walk performed in parallel with streamed and sorted results. |
homepage | https://github.com/byron/jwalk |
repository | https://github.com/byron/jwalk |
max_upload_size | |
id | 113765 |
size | 164,973 |
Filesystem walk.
Add this to your Cargo.toml
:
[dependencies]
jwalk = "0.5"
Lean More: docs.rs/jwalk
Recursively iterate over the "foo" directory sorting by name:
use jwalk::{WalkDir};
for entry in WalkDir::new("foo").sort(true) {
println!("{}", entry?.path().display());
}
This crate is inspired by both walkdir
and
ignore
. It attempts to combine the
parallelism of ignore
with walkdir
's streaming iterator API. Some code and
comments are copied directly from walkdir
.
This crate is particularly good when you want streamed sorted results. In my
tests it's about 4x walkdir
speed for sorted results with metadata. Also this
crate's process_read_dir
callback allows you to arbitrarily
sort/filter/skip/state entries before they are yielded.
Directory traversal is already pretty fast. If you don't need this crate's speed
then walkdir
provides a smaller and more tested single threaded
implementation.
This crates parallelism happens at the directory level. It will help when walking deep file systems with many directories. It wont help when reading a single directory with many files.
Benchmarks
comparing this crate with walkdir
and ignore
.