Crates.io | jwalk-meta |
lib.rs | jwalk-meta |
version | 0.9.4 |
source | src |
created_at | 2023-04-27 04:05:52.469762 |
updated_at | 2024-04-01 16:47:50.825832 |
description | Filesystem walk performed in parallel with streamed and sorted results. |
homepage | https://github.com/brmmm3/jwalk-meta |
repository | https://github.com/brmmm3/jwalk-meta |
max_upload_size | |
id | 850025 |
size | 177,280 |
Filesystem walk.
This is a fork of https://github.com/Byron/jwalk. This project adds optional collecting metadata to improve performance if metadata is needed later.
Add this to your Cargo.toml
:
[dependencies]
jwalk-meta = "0.9"
Lean More: docs.rs/jwalk-meta
Recursively iterate over the "foo" directory sorting by name:
use jwalk_meta::{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
.