file_traverser

Crates.iofile_traverser
lib.rsfile_traverser
version0.1.2
sourcesrc
created_at2024-10-16 15:30:22.919771
updated_at2024-10-17 05:04:46.080994
descriptionfile_traverser is a Rust crate designed for efficient file system traversal. It allows users to recursively explore directories and filter files based on customizable criteria. The crate supports both standard library `mpsc` and `crossbeam` channels through a trait, enabling flexible communication patterns for sending file paths. Ideal for applications that require asynchronous file processing, it combines ease of use with powerful functionality.
homepage
repositoryhttps://github.com/itsscb/file_traverser
max_upload_size
id1411937
size46,695
(itsscb)

documentation

README

file_traverser

file_traverser is a Rust crate that provides an efficient way to traverse file systems recursively while applying customizable filters to files. It supports both standard library mpsc and crossbeam channels, allowing you to choose the best communication method for your application.

Features

  • Recursive Directory Traversal: Explore directories and their subdirectories.
  • Customizable Filtering: Apply user-defined filters to select specific files.
  • Channel Support: Use either standard library mpsc or crossbeam channels for sending file paths.
  • Asynchronous Processing: Designed for efficient asynchronous file handling.

Installation

Add the following line to your Cargo.toml:

[dependencies]
file_traverser = "0.1"

Usage

Here's a basic example of how to use file_traverser:

use std::path::PathBuf;
use std::sync::mpsc::channel;
use file_traverser::filter_and_send_files;

fn main() {
    let (tx, rx) = channel();

    // Define a filter function
    let filter = |path: &Path| path.extension().map(|ext| ext == "txt").unwrap_or(false);

    // Start traversing
    filter_and_send_files(&PathBuf::from("path/to/directory"), tx, filter);

    // Receive paths
    for received in rx {
        println!("Received file: {:?}", received);
    }
}
Commit count: 7

cargo fmt