github.com/keygen-sh/go-update@v1.0.0/internal/binarydist/doc.go (about)

     1  // Package binarydist implements binary diff and patch as described on
     2  // http://www.daemonology.net/bsdiff/. It reads and writes files
     3  // compatible with the tools there.
     4  package binarydist
     5  
     6  var magic = [8]byte{'B', 'S', 'D', 'I', 'F', 'F', '4', '0'}
     7  
     8  // File format:
     9  //   0       8    "BSDIFF40"
    10  //   8       8    X
    11  //   16      8    Y
    12  //   24      8    sizeof(newfile)
    13  //   32      X    bzip2(control block)
    14  //   32+X    Y    bzip2(diff block)
    15  //   32+X+Y  ???  bzip2(extra block)
    16  // with control block a set of triples (x,y,z) meaning "add x bytes
    17  // from oldfile to x bytes from the diff block; copy y bytes from the
    18  // extra block; seek forwards in oldfile by z bytes".
    19  type header struct {
    20  	Magic   [8]byte
    21  	CtrlLen int64
    22  	DiffLen int64
    23  	NewSize int64
    24  }