Reorganization.

This commit is contained in:
Caleb Gardner
2020-11-28 05:03:56 -06:00
parent edd63a422b
commit e20213c3f7
8 changed files with 117 additions and 170 deletions
+24
View File
@@ -0,0 +1,24 @@
package compression
import (
"bytes"
"compress/zlib"
"io"
)
//Zlib is a decompressor for gzip type compression
type Zlib struct{}
//Decompress reads the entirety of the given reader and returns it uncompressed as a byte slice.
func (z *Zlib) Decompress(r io.Reader) ([]byte, error) {
rdr, err := zlib.NewReader(r)
if err != nil {
return nil, err
}
var data bytes.Buffer
_, err = io.Copy(&data, rdr)
if err != nil {
return nil, err
}
return data.Bytes(), nil
}