{"id":17294686,"url":"https://github.com/mbrt/librsync-rs","last_synced_at":"2025-08-13T02:44:06.914Z","repository":{"id":52286100,"uuid":"49822193","full_name":"mbrt/librsync-rs","owner":"mbrt","description":"Rust bindings to librsync","archived":false,"fork":false,"pushed_at":"2023-10-30T10:36:28.000Z","size":83,"stargazers_count":37,"open_issues_count":3,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T10:04:06.462Z","etag":null,"topics":["librsync","rsync-protocol","rust-bindings"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbrt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-17T15:09:57.000Z","updated_at":"2025-03-27T12:28:03.000Z","dependencies_parsed_at":"2023-01-31T22:30:58.266Z","dependency_job_id":"68bab3fb-fb6f-4dd6-b612-8d8b494f4b41","html_url":"https://github.com/mbrt/librsync-rs","commit_stats":{"total_commits":97,"total_committers":6,"mean_commits":"16.166666666666668","dds":0.08247422680412375,"last_synced_commit":"dff9380299d4beca5582eac41e75ffca3eda8607"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrt%2Flibrsync-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrt%2Flibrsync-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrt%2Flibrsync-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrt%2Flibrsync-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbrt","download_url":"https://codeload.github.com/mbrt/librsync-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860298,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["librsync","rsync-protocol","rust-bindings"],"created_at":"2024-10-15T11:07:33.837Z","updated_at":"2025-04-14T10:04:43.961Z","avatar_url":"https://github.com/mbrt.png","language":"Rust","readme":"# librsync-rs\n[![Build Status](https://travis-ci.org/mbrt/librsync-rs.svg?branch=master)](https://travis-ci.org/mbrt/librsync-rs)\n[![Coverage Status](https://coveralls.io/repos/github/mbrt/librsync-rs/badge.svg?branch=master)](https://coveralls.io/github/mbrt/librsync-rs?branch=master)\n[![](http://meritbadge.herokuapp.com/librsync)](https://crates.io/crates/librsync)\n\nRust bindings to [librsync](https://github.com/librsync/librsync).\n\n[API Documentation](https://docs.rs/librsync)\n\n\n## Introduction\n\nThis library contains bindings to librsync [1], to support computation and application of\nnetwork deltas, used in rsync and duplicity backup applications. This library encapsulates the\nalgorithms of the rsync protocol, which computes differences between files efficiently.\n\nThe rsync protocol, when computes differences, does not require the presence of both files.\nIt needs instead the new file and a set of checksums of the first file (namely the signature).\nComputed differences can be stored in a delta file. The rsync protocol is then able to\nreproduce the new file, by having the old one and the delta.\n\n[1]: http://librsync.sourcefrog.net/\n\n\n## Installation\n\nSimply add a corresponding entry to your `Cargo.toml` dependency list:\n\n```toml\n[dependencies]\nlibrsync = \"0.2\"\n```\n\nAnd add this to your crate root:\n\n```rust\nextern crate librsync;\n```\n\n\n## Overview of types and modules\n\nThis crate provides the streaming operations to produce signatures, delta and patches in the\ntop-level module, with `Signature`, `Delta` and `Patch` structs. Those structs take some input\nstream (`Read` or `Read + Seek` traits) and implement another stream (`Read` trait) from which\nthe output can be read.\n\nHigher level operations are provided within the `whole` submodule. If the application does not\nneed fine-grained control over IO operations, `sig`, `delta` and `patch` submodules can be\nused. Those functions apply the algorithms to an output stream (implementing the `Write` trait)\nin a single call.\n\n\n## Example: streams\n\nThis example shows how to go through the streaming APIs, starting from an input string and a\nmodified string which act as old and new files. The example simulates a real world scenario, in\nwhich the signature of a base file is computed, used as input to compute differences between\nthe base file and the new one, and finally the new file is reconstructed, by using the patch\nand the base file.\n\n```rust\nextern crate librsync;\n\nuse std::io::prelude::*;\nuse std::io::Cursor;\nuse librsync::{Delta, Patch, Signature};\n\nfn main() {\n    let base = \"base file\".as_bytes();\n    let new = \"modified base file\".as_bytes();\n\n    // create signature starting from base file\n    let mut sig = Signature::new(base).unwrap();\n    // create delta from new file and the base signature\n    let delta = Delta::new(new, \u0026mut sig).unwrap();\n    // create and store the new file from the base one and the delta\n    let mut patch = Patch::new(Cursor::new(base), delta).unwrap();\n    let mut computed_new = Vec::new();\n    patch.read_to_end(\u0026mut computed_new).unwrap();\n\n    // test whether the computed file is exactly the new file, as expected\n    assert_eq!(computed_new, new);\n}\n```\n\nNote that intermediate results are not stored in temporary containers. This is possible because\nthe operations implement the `Read` trait. In this way the results does not need to be fully in\nmemory, during computation.\n\n\n## Example: whole file API\n\nThis example shows how to go trough the whole file APIs, starting from an input string and a\nmodified string which act as old and new files. Unlike the streaming example, here we call a\nsingle function, to get the computation result of signature, delta and patch operations. This\nis convenient when an output stream (like a network socket or a file) is used as output for an\noperation.\n\n```rust\nextern crate librsync;\n\nuse std::io::Cursor;\nuse librsync::whole::*;\n\nfn main() {\n    let base = \"base file\".as_bytes();\n    let new = \"modified base file\".as_bytes();\n\n    // signature\n    let mut sig = Vec::new();\n    signature(\u0026mut Cursor::new(base), \u0026mut sig).unwrap();\n\n    // delta\n    let mut dlt = Vec::new();\n    delta(\u0026mut Cursor::new(new), \u0026mut Cursor::new(sig), \u0026mut dlt).unwrap();\n\n    // patch\n    let mut out = Vec::new();\n    patch(\u0026mut Cursor::new(base), \u0026mut Cursor::new(dlt), \u0026mut out).unwrap();\n\n    assert_eq!(out, new);\n}\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nThis library uses [librsync](https://github.com/librsync/librsync), which comes with an\n[LGPL-2.0](https://github.com/librsync/librsync/blob/master/COPYING) license. Please, be sure to fulfill librsync\nlicensing requirements before to use this library.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrt%2Flibrsync-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbrt%2Flibrsync-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrt%2Flibrsync-rs/lists"}