Skip to content

KarpelesLab/gobzip2

Repository files navigation

GoDoc Go Report Card Coverage Status

gobzip2

Pure Go implementation of bzip2 compression and decompression, based on the bzip2 1.0.8 reference C implementation.

Unlike the standard library's compress/bzip2 which only supports decompression, this package provides both compression and decompression.

Install

go get github.com/KarpelesLab/gobzip2

Usage

Compression

var buf bytes.Buffer
w := gobzip2.NewWriter(&buf)
w.Write([]byte("hello, world"))
w.Close()

Decompression

r := gobzip2.NewReader(bytes.NewReader(compressed))
data, err := io.ReadAll(r)

CLI

go install github.com/KarpelesLab/gobzip2/cmd/gobzip2@latest

# Compress
gobzip2 file.txt

# Decompress
gobzip2 -d file.txt.bz2

# Pipe
cat file | gobzip2 | gobzip2 -d

About

Pure Go bzip2 compression and decompression with parallel support

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages