{"id":19503331,"url":"https://github.com/space-wizards/bsdiff-rs","last_synced_at":"2025-05-09T01:46:31.631Z","repository":{"id":44339332,"uuid":"95262287","full_name":"space-wizards/bsdiff-rs","owner":"space-wizards","description":"Binary diffing algorithm implemented in Rust","archived":false,"fork":false,"pushed_at":"2025-03-31T11:54:18.000Z","size":1510,"stargazers_count":45,"open_issues_count":1,"forks_count":13,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-09T01:46:26.566Z","etag":null,"topics":["bsdiff","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/space-wizards.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2017-06-23T23:01:18.000Z","updated_at":"2025-03-31T11:54:01.000Z","dependencies_parsed_at":"2025-04-20T07:01:49.876Z","dependency_job_id":null,"html_url":"https://github.com/space-wizards/bsdiff-rs","commit_stats":{"total_commits":36,"total_committers":6,"mean_commits":6.0,"dds":0.5,"last_synced_commit":"b7eadb4c7ca7c7ab65c0dbaa435d2beecd574831"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-wizards%2Fbsdiff-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-wizards%2Fbsdiff-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-wizards%2Fbsdiff-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-wizards%2Fbsdiff-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/space-wizards","download_url":"https://codeload.github.com/space-wizards/bsdiff-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176443,"owners_count":21866142,"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":["bsdiff","rust"],"created_at":"2024-11-10T22:20:40.804Z","updated_at":"2025-05-09T01:46:31.612Z","avatar_url":"https://github.com/space-wizards.png","language":"Rust","readme":"# bsdiff-rs\n\n[![GitHub](https://img.shields.io/badge/github-bsdiff-8da0cb?logo=github)](https://github.com/space-wizards/bsdiff-rs)\n[![crates.io version](https://img.shields.io/crates/v/bsdiff.svg)](https://crates.io/crates/bsdiff)\n[![docs.rs docs](https://docs.rs/bsdiff/badge.svg)](https://docs.rs/bsdiff)\n[![crates.io version](https://img.shields.io/crates/l/bsdiff.svg)](https://github.comspace-wizards/bsdiff-rss/blob/main/LICENSE-APACHE)\n[![CI build](https://github.com/space-wizards/bsdiff-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/space-wizards/bsdiff-rs/actions)\n\nBsdiff is a method of diffing files. This crate is a port of a [bsdiff library](https://github.com/mendsley/bsdiff).\nHigh performance patching. All written in safe\nRust.\n\nIt is usually a good idea to use bsdiff alongside a compression algorithm like bzip2.\n\n## Usage\n\n```rust\nfn main() {\n    let one = vec![1, 2, 3, 4, 5];\n    let two = vec![1, 2, 4, 6];\n    let mut patch = Vec::new();\n\n    bsdiff::diff(\u0026one, \u0026two, \u0026mut patch).unwrap();\n\n    let mut patched = Vec::with_capacity(two.len());\n    bsdiff::patch(\u0026one, \u0026mut patch.as_slice(), \u0026mut patched).unwrap();\n    assert_eq!(patched, two);\n}\n```\n\n## Diffing Files\n\n```rust\nfn diff_files(file_a: \u0026str, file_b: \u0026str, patch_file: \u0026str) -\u003e std::io::Result\u003c()\u003e {\n    let old = std::fs::read(file_a)?;\n    let new = std::fs::read(file_b)?;\n    let mut patch = Vec::new();\n\n    bsdiff::diff(\u0026old, \u0026new, \u0026mut patch)?;\n    // TODO: compress `patch` here\n    std::fs::write(patch_file, \u0026patch)\n}\n```\n\n## Patching Files\n\n```rust\nfn patch_file(file_a: \u0026str, patch_file: \u0026str, file_b: \u0026str) -\u003e std::io::Result\u003c()\u003e {\n    let old = std::fs::read(file_a)?;\n    let patch = std::fs::read(patch_file)?;\n    // TODO: decompress `patch` here\n    let mut new = Vec::new();\n\n    bsdiff::patch(\u0026old, \u0026mut patch.as_slice(), \u0026mut new)?;\n    std::fs::write(file_b, \u0026new)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-wizards%2Fbsdiff-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspace-wizards%2Fbsdiff-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-wizards%2Fbsdiff-rs/lists"}