| Crates.io | rdd |
| lib.rs | rdd |
| version | 0.1.2 |
| created_at | 2025-02-25 12:40:45.97668+00 |
| updated_at | 2025-03-02 11:55:12.899938+00 |
| description | simple library to interact with `dd` tool |
| homepage | https://github.com/kadircy/rdd |
| repository | https://github.com/kadircy/rdd |
| max_upload_size | |
| id | 1569109 |
| size | 24,537 |
rdd
rdd is a simple Rust library to interact with the dd command-line tool. It provides an easy way to configure and execute dd commands from Rust, with options like input and output files, block sizes, and more.
Add rdd to your Cargo.toml:
[dependencies]
rdd = "0.1"
use rdd::Dd;
fn main() {
// Create a new Dd instance with the 'dd' binary path
let mut dd = Dd::new("dd");
// Set input and output files
dd.input("./test.iso");
dd.output("./copied.iso");
// Set block size (bs)
dd.bs("4M");
// Run the 'dd' command and handle the result
match dd.spawn() {
Ok(output) => println!("DD command output: {}", output),
Err(e) => eprintln!("Error: {:?}", e),
}
}
You can set these options for the dd command:
bs): dd.bs("4M");cbs): dd.cbs("1M");dd.count(100);dd.seek(10);dd.skip(10);dd.status("progress");conv): dd.conv("noerror,sync");ibs): dd.ibs("512K");obs): dd.obs("64K");iflag, oflag): dd.iflag("direct"); dd.oflag("sync");Contributions are welcome! If you’d like to contribute, please follow these steps:
git checkout -b feature-branch.git commit -am 'Add new feature'.git push origin feature-branch.Please make sure your code follows the style and guidelines of the project and passes all the tests. You can format codebase, lint it and run tests with this commands:
cargo fmt # format
cargo clippy # lint
cargo test # test
This project is licensed under the MIT License. See the LICENSE file for details.