| Crates.io | file-crawler |
| lib.rs | file-crawler |
| version | 0.1.5 |
| created_at | 2025-09-09 15:02:13.420039+00 |
| updated_at | 2025-10-05 20:01:35.435851+00 |
| description | A fast, concurrent, async and customisable file crawler |
| homepage | |
| repository | https://github.com/HQ2000-Rust/Custom-File-Crawler |
| max_upload_size | |
| id | 1831020 |
| size | 49,336 |
Features:
fn main() -> Box<dyn Error> {
use file_crawler::prelude::*;
use std::fs::File;
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::atomic::AtomicU32;
let a_count =
Crawler::new()
.start_dir("C\\user\\foo")
.context(AtomicU32::new(0))
.run(|ctx: Arc<AtomicU32>, path: PathBuf| {
let mut contents = String::new();
let file = File::open(path)?;
//NOTE: this can cause an error for files not readable as UTF-8
//which returns an error and therefore terminates the crawler
file.read_to_string(&mut contents)?;
contents.chars().for_each(|char| if char == 'a' { ctx.fetch_add(1); });
Ok(())
})?;
println!("Appearance of the letter 'a' in \"C\\user\\foo\": {}", a_count);
}