go-bsdiff: github.com/gabstv/go-bsdiff Index | Files | Directories

package bsdiff

import "github.com/gabstv/go-bsdiff"

Package bsdiff is a pure Go implementation of Bsdiff 4.

Example:

package main

import (
  "fmt"
  "bytes"

  "github.com/gabstv/go-bsdiff/pkg/bsdiff"
  "github.com/gabstv/go-bsdiff/pkg/bspatch"
)

func main(){
  // example files
  oldfile := []byte{0xfa, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}
  newfile := []byte{0xfa, 0xdd, 0x00, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xff, 0xfe, 0xfe}

  // generate a BSDIFF4 patch
  patch, err := bsdiff.Bytes(oldfile, newfile)
  if err != nil {
    panic(err)
  }
  fmt.Println(patch)

  // Apply a BSDIFF4 patch
  newfile2, err := bspatch.Bytes(oldfile, patch)
  if err != nil {
    panic(err)
  }
  if !bytes.Equal(newfile, newfile2) {
    panic()
  }
}

Index

Package Files

n.go

Directories

PathSynopsis
pkg/bsdiffPackage bsdiff is a binary diff program using suffix sorting.
pkg/bspatchPackage bspatch is a binary diff program using suffix sorting.
pkg/util

Updated 2019-05-10. Refresh now. Tools for package owners.