Add Lzo decompressor and Xz decompressor with filters

This commit is contained in:
Caleb Gardner
2021-09-12 05:26:47 -05:00
parent 70e3d81427
commit 305f261d10
12 changed files with 60 additions and 784 deletions
+30
View File
@@ -0,0 +1,30 @@
package compression
import (
"encoding/binary"
"io"
lzo "github.com/rasky/go-lzo"
)
type Lzo struct {
Algorithm int32
Level int32
}
func NewLzoCompressorWithOptions(rdr io.Reader) (*Lzo, error) {
var lz Lzo
err := binary.Read(rdr, binary.LittleEndian, &lz)
if err != nil {
return nil, err
}
return &lz, nil
}
func (l Lzo) Decompress(rdr io.Reader) ([]byte, error) {
byt, err := lzo.Decompress1X(rdr, 0, 0)
if err != nil {
return nil, err
}
return byt, nil
}