MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / GzipDecode

Function GzipDecode

pkg/encoding/json_encoding.go:90–104  ·  view source on GitHub ↗

GzipDecode decode

(in []byte)

Source from the content-addressed store, hash-verified

88
89// GzipDecode decode
90func GzipDecode(in []byte) ([]byte, error) {
91 reader, err := gzip.NewReader(bytes.NewReader(in))
92 if err != nil {
93 var out []byte
94 return out, err
95 }
96 defer func() {
97 err = reader.Close()
98 if err != nil {
99 fmt.Printf("reader close err: %+v", err)
100 }
101 }()
102
103 return io.ReadAll(reader)
104}
105
106// JSONSnappyEncoding json format and snappy compression
107type JSONSnappyEncoding struct{}

Callers 2

UnmarshalMethod · 0.85
TestEncodingErrorFunction · 0.85

Calls 2

PrintfMethod · 0.80
CloseMethod · 0.65

Tested by 1

TestEncodingErrorFunction · 0.68