shad-go/vegz/encode.go
2022-05-05 19:08:49 +03:00

17 lines
257 B
Go

//go:build !solution
package vegz
import (
"compress/gzip"
"io"
)
func Encode(data []byte, w io.Writer) error {
ww := gzip.NewWriter(w)
defer func() { _ = ww.Close() }()
if _, err := ww.Write(data); err != nil {
return err
}
return ww.Flush()
}