rdd

Crates.iordd
lib.rsrdd
version0.1.2
created_at2025-02-25 12:40:45.97668+00
updated_at2025-03-02 11:55:12.899938+00
descriptionsimple library to interact with `dd` tool
homepagehttps://github.com/kadircy/rdd
repositoryhttps://github.com/kadircy/rdd
max_upload_size
id1569109
size24,537
Kadir (kadircy)

documentation

https://docs.rs/rdd/latest/rdd

README

rdd

Crates.io License Crates.io Version GitHub Actions Workflow Status

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.

Installation

Add rdd to your Cargo.toml:

[dependencies]
rdd = "0.1"

Usage

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),
    }
}

Options

You can set these options for the dd command:

  • Block size (bs): dd.bs("4M");
  • Conversion block size (cbs): dd.cbs("1M");
  • Count: dd.count(100);
  • Seek: dd.seek(10);
  • Skip: dd.skip(10);
  • Status: dd.status("progress");
  • Conversion (conv): dd.conv("noerror,sync");
  • Input block size (ibs): dd.ibs("512K");
  • Output block size (obs): dd.obs("64K");
  • Flags (iflag, oflag): dd.iflag("direct"); dd.oflag("sync");

Contributing

Contributions are welcome! If you’d like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch git checkout -b feature-branch.
  3. Make your changes and commit them git commit -am 'Add new feature'.
  4. Push to your fork git push origin feature-branch.
  5. Open a pull request to the main repository.

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

License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 27

cargo fmt