feat: initial goget release — modern IPv6-first download utility
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//go:build linux || freebsd
|
||||
// +build linux freebsd
|
||||
|
||||
package compression
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io"
|
||||
)
|
||||
|
||||
type gzipDecompressor struct{ *BaseDecompressor }
|
||||
|
||||
func NewGzipDecompressor() *gzipDecompressor {
|
||||
return &gzipDecompressor{NewBaseDecompressor("gzip", []string{"gzip"}, []string{".gz"})}
|
||||
}
|
||||
|
||||
// ✅ Oprava: returns (io.Reader, error)
|
||||
func (g *gzipDecompressor) Reader(r io.Reader) (io.ReadCloser, error) {
|
||||
return gzip.NewReader(r)
|
||||
}
|
||||
|
||||
type gzipCompressor struct{ name string }
|
||||
|
||||
func NewGzipCompressor() *gzipCompressor { return &gzipCompressor{name: "gzip"} }
|
||||
func (g *gzipCompressor) Name() string { return g.name }
|
||||
func (g *gzipCompressor) Writer(w io.Writer) (io.WriteCloser, error) {
|
||||
return gzip.NewWriter(w), nil
|
||||
}
|
||||
|
||||
func init() { Register(NewGzipDecompressor()) }
|
||||
Reference in New Issue
Block a user