github.com/lulzWill/go-agent@v2.1.2+incompatible/internal/compress.go (about) 1 package internal 2 3 import ( 4 "bytes" 5 "compress/zlib" 6 ) 7 8 func compress(b []byte) (*bytes.Buffer, error) { 9 var buf bytes.Buffer 10 w := zlib.NewWriter(&buf) 11 _, err := w.Write(b) 12 w.Close() 13 14 if nil != err { 15 return nil, err 16 } 17 18 return &buf, nil 19 }