Gzip
Overview
Gzip compresses data with gzip.
If you are coming from Node.js, the closest pattern is gzipSync.
Signature
go
func Gzip(data []byte) ([]byte, error)Compare: Node.js · Standard Go · gox
js
zlib.gzipSync(data);go
// compress/gzip NewWriter / NewReadergo
import "github.com/sahilkhaire/gox/compress"
compressed, err := compress.Gzip(data)Example
go
import "github.com/sahilkhaire/gox/compress"
compressed, err := compress.Gzip(data)Tips
Import github.com/sahilkhaire/gox/compress and call Gzip directly. See the comparison below for the standard library equivalent.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.