Git Product home page Git Product logo

bsdiff4's Introduction

bsdiff4: binary diff and patch using the BSDIFF4-format

The code is mostly derived from cx_bsdiff (written by Anthony Tuininga, http://cx-bsdiff.sourceforge.net/). The cx_bsdiff code in turn was derived from bsdiff, the standalone utility produced for BSD which can be found at http://www.daemonology.net/bsdiff. In addition to the two functions (diff and patch) cx_bsdiff provides, this package includes:

  • an interface to the BSDIFF4-format
  • command line interfaces: bsdiff4 and bspatch4
  • tests

The bsdiff4 package defines the following high level functions:

diff(src_bytes, dst_bytes) -> bytes
Return a BSDIFF4-format patch (from src_bytes to dst_bytes) as bytes.
patch(src_bytes, patch_bytes) -> bytes
Apply the BSDIFF4-format patch_bytes to src_bytes and return the bytes.
file_diff(src_path, dst_path, patch_path)
Write a BSDIFF4-format patch (from the file src_path to the file dst_path) to the file patch_path.
file_patch(src_path, dst_path, patch_path)
Apply the BSDIFF4-format file patch_path to the file src_path and write the result to the file dst_path.
file_patch_inplace(path, patch_path)
Apply the BSDIFF4-format file patch_path to the file path in place.

Example:

>>> import bsdiff4
>>> a = bytes(100000 * 'a')
>>> b = bytearray(a)
>>> b[100:106] = ' diff '
>>> p = bsdiff4.diff(a, bytes(b))
>>> len(p)
154
>>> bsdiff4.patch(a, p) == b
True

bsdiff4's People

Contributors

ilanschnell avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.