Expand description
Parallel file operations for concurrent processing of multiple files and directories.
This module provides async functions that perform file operations in parallel using Tokio’s thread pool. These functions are optimized for:
- Processing multiple files or directories simultaneously
- Avoiding blocking the async runtime with I/O operations
- Scaling with available CPU cores
§Examples
use agpm_cli::utils::fs::parallel::copy_files_parallel;
use std::path::PathBuf;
let copy_operations = vec![
(PathBuf::from("src/agent1.md"), PathBuf::from("output/agent1.md")),
(PathBuf::from("src/agent2.md"), PathBuf::from("output/agent2.md")),
];
copy_files_parallel(©_operations).await?;
println!("All files copied successfully!");Functions§
- copy_
dirs_ parallel - Copies multiple directories concurrently.
- copy_
files_ parallel - Copies multiple files concurrently using parallel processing.
- read_
files_ parallel - Reads multiple files concurrently and returns their contents.