2022-05-05 16:08:49 +00:00
|
|
|
//go:build !solution
|
|
|
|
|
2022-05-05 16:20:16 +00:00
|
|
|
package gzep
|
2022-05-05 16:08:49 +00:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|