- Add stream reader and writer (@jxsl13)
- Fix license (@heinrich5991)
This is a breaking change! The new api now looks like this.
package main
import (
"fmt"
"github.com/teeworlds-go/huffman"
)
func main() {
data, err := huffman.Compress([]byte("hello world"))
if err != nil {
panic(err)
}
// data: [174 149 19 92 9 87 194 22 177 86 220 218 34 56 185 18 156 168 184 1]
fmt.Printf("data: %v\n", data)
data, err = huffman.Decompress([]byte{174, 149, 19, 92, 9, 87, 194, 22, 177, 86, 220, 218, 34, 56, 185, 18, 156, 168, 184, 1})
if err != nil {
panic(err)
}
// data: hello world
fmt.Printf("data: %v\n", string(data))
}