MCPcopy Create free account
hub / github.com/DNAProject/DNA / ZLibCompress

Function ZLibCompress

cmd/utils/export.go:136–145  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

134}
135
136func ZLibCompress(data []byte) ([]byte, error) {
137 buf := bytes.NewBuffer(nil)
138 zlibWriter := zlib.NewWriter(buf)
139 _, err := zlibWriter.Write(data)
140 if err != nil {
141 return nil, fmt.Errorf("zlibWriter.Write error %s", err)
142 }
143 zlibWriter.Close()
144 return buf.Bytes(), nil
145}
146
147func ZLibDecompress(data []byte) ([]byte, error) {
148 buf := bytes.NewReader(data)

Callers 1

CompressBlockDataFunction · 0.85

Calls 4

WriteMethod · 0.80
ErrorfMethod · 0.80
CloseMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected