Skip to content

v2.0.0

Latest
Compare
Choose a tag to compare
@ChillerDragon ChillerDragon released this 03 Jul 23:57
· 7 commits to master since this release
051c09b

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))
}