https://github.com/shadowspore/fossil-delta
Fossil Delta Compression algorithm written in Go
https://github.com/shadowspore/fossil-delta
Last synced: 3 months ago
JSON representation
Fossil Delta Compression algorithm written in Go
- Host: GitHub
- URL: https://github.com/shadowspore/fossil-delta
- Owner: shadowspore
- License: other
- Created: 2020-08-17T17:04:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-04T22:13:52.000Z (8 months ago)
- Last Synced: 2024-10-05T22:01:27.141Z (8 months ago)
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Delta compression algorithm written in Go
===
Fossil achieves efficient storage and low-bandwidth synchronization through the
use of delta-compression. Instead of storing or transmitting the complete
content of an artifact, fossil stores or transmits only the changes relative to
a related artifact.* [Format](http://www.fossil-scm.org/index.html/doc/tip/www/delta_format.wiki)
* [Algorithm](http://www.fossil-scm.org/index.html/doc/tip/www/delta_encoder_algorithm.wiki)
* [Original implementation](http://www.fossil-scm.org/index.html/artifact/f3002e96cc35f37b)Other implementations:
- [C#](https://github.com/endel/FossilDelta)
- [Haxe](https://github.com/endel/fossil-delta-hx)
- [Python](https://github.com/ggicci/python-fossil-delta)
- [JavaScript](https://github.com/dchest/fossil-delta-js) ([Online demo](https://dchest.github.io/fossil-delta-js/))### Install
```
$ go get -u github.com/shadowspore/fossil-delta
```
### Example
```go
package mainimport (
"fmt"fdelta "github.com/shadowspore/fossil-delta"
)func main() {
origin := []byte("abcdefghijklmnopqrstuvwxyz1234567890")
target := []byte("abcdefghijklmnopqrstuvwxyz0987654321")// Create delta
delta := fdelta.Create(origin, target)// Create target by patching origin with delta
patched, err := fdelta.Apply(origin, delta)
if err != nil {
panic(err)
}fmt.Printf("Origin: `%s`\n", origin)
fmt.Printf("Target: `%s`\n", target)
fmt.Printf("Delta : `%s`\n", delta)
fmt.Printf("Patch : `%s`\n", patched)
}
```