wod
wod stands for "write on diff". It's a small Rust library that provides utilities to write files or directories only when their content has changed.
This can be useful to avoid unnecessary writes and updates, for example, in build systems or data synchronization tools.
Features
write_on_bytes_diff: Writes a slice of bytes to a file path if the content is different.write_on_file_diff: Copies a file to a destination path if the content is different.write_on_dir_diff: Recursively copies a directory to a destination path, only writing files that have different content.
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Example: write_on_bytes_diff
use write_on_bytes_diff;
use FxHasher;
use fs;
use io;
Example: write_on_dir_diff
use write_on_dir_diff;
use FxHasher;
use ;
use ;
use tempdir;
Generic Hasher
You can use any std::hash::Hasher implementation. rustc_hash::FxHasher is a fast non-cryptographic hasher and a good default choice.
use write_on_bytes_diff;
use FxHasher; // or any other hasher
// ...
.unwrap;