rdd 0.1.2

simple library to interact with `dd` tool
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 1 items with examples
  • Size
  • Source code size: 24.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • kadircy/rdd
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kadircy

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.