MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / ZlibCompress

Function ZlibCompress

utils/binary/utils.go:39–47  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

37}
38
39func ZlibCompress(data []byte) []byte {
40 zw := acquireZlibWriter()
41 _, _ = zw.w.Write(data)
42 _ = zw.w.Close()
43 ret := make([]byte, len(zw.buf.Bytes()))
44 copy(ret, zw.buf.Bytes())
45 releaseZlibWriter(zw)
46 return ret
47}
48
49func GZipCompress(data []byte) []byte {
50 gw := acquireGzipWriter()

Callers 2

BuildElementMethod · 0.92
BuildElementMethod · 0.92

Calls 5

acquireZlibWriterFunction · 0.85
releaseZlibWriterFunction · 0.85
BytesMethod · 0.80
WriteMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected