compress

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
data := []byte("zhang how, zhang how, zhang how, zhang how,")
compressed := HuffmanCompress(data)
fmt.Printf("performance %.4f\n", float64(len(compressed))/float64(len(data)))
de, _ := HuffmanDecompress(compressed)
fmt.Println(string(de))
Output:

performance 0.7674
zhang how, zhang how, zhang how, zhang how,

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func HuffmanCompress

func HuffmanCompress(data []byte) []byte

HuffmanCompress data using huffman algorithm

func HuffmanDecompress

func HuffmanDecompress(data []byte) ([]byte, error)

HuffmanDecompress data compressed by huffman algorithm

func LzwCompress

func LzwCompress(data []byte) (out []byte)

LzwCompress data using LZW algorithm

func LzwDecompress

func LzwDecompress(data []byte) (out []byte)

LzwDecompress data compressed by LZW algorithm

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL