const (
MimeType = "application/x-binary-patch"
)
type PatchHeader struct { Offset int64 OldSize, NewSize uint32 }
type PatchSet struct { Patches []PatchHeader Blobs [][]byte }
func Load(blob []byte) (*PatchSet, error)
Unmarshal a PatchSet from bytes
func New() *PatchSet
Create a new, empty PatchSet
func (p *PatchSet) Add(offset, oldSize int64, blob []byte)
Add a new patch region to a PatchSet. The bytes beginning at "offset" and running for "oldSize" are removed and replaced with "blob". oldSize may be 0.
func (p *PatchSet) Apply(infile *os.File, outpath string) error
Apply a PatchSet by taking the input file, transforming it, and writing the result to outpath. If outpath is the same name as infile then the file will be updated in-place if a direct overwrite is possible. If they are not the same file, or the patch requires moving parts of the old file, then the output will be written to a temporary file then renamed over the destination path.
func (p *PatchSet) Dump() []byte
Marshal a PatchSet to bytes
type PatchSetHeader struct { Version, NumPatches uint32 }