Expand description
§Snapcat
snapcat is a library for recursively walking a directory tree, building a tree representation,
and reading the contents of files with options for binary detection, size limits, and more.
It provides both a simple blocking API (snapcat) and a streaming API ([SnapcatStream]) when the
streaming feature is enabled. Parallel file processing is available with the parallel feature.
§Features
parallel: Enables parallel processing of files using Rayon.streaming: Enables a streaming iterator API for processing files one by one.logging: Enables debug logging via thetracingcrate.
§Example
use snapcat::{SnapcatBuilder, BinaryDetection, snapcat};
let options = SnapcatBuilder::new(".")
.respect_gitignore(true)
.include_hidden(false)
.binary_detection(BinaryDetection::Accurate)
.file_size_limit(Some(10 * 1024 * 1024)) // 10 MB
.build();
let result = snapcat(options).expect("Failed to scan directory");
println!("Directory tree:\n{}", result.tree);
for file in result.files {
println!("File: {} (binary: {})", file.path.display(), file.is_binary);
}Re-exports§
pub use engine::snapcat;pub use error::SnapcatError;pub use options::BinaryDetection;pub use options::SnapcatBuilder;pub use options::SnapcatOptions;pub use output::OutputFormat;pub use output::format_result;pub use output::write_result_to_file;pub use types::FileEntry;pub use types::SnapcatResult;