MCPcopy
hub / github.com/apache/devlake / toGzip

Function toGzip

backend/core/utils/io.go:114–128  ·  view source on GitHub ↗
(archivePath string)

Source from the content-addressed store, hash-verified

112}
113
114func toGzip(archivePath string) errors.Error {
115 info, _ := os.Stat(archivePath)
116 b, err := os.ReadFile(archivePath)
117 if err != nil {
118 return errors.Convert(err)
119 }
120 var buf bytes.Buffer
121 w := gzip.NewWriter(&buf)
122 _, err = w.Write(b)
123 _ = w.Close()
124 if err != nil {
125 return errors.Convert(err)
126 }
127 return errors.Convert(os.WriteFile(archivePath, buf.Bytes(), info.Mode().Perm()))
128}

Callers 1

CreateGZipArchiveFunction · 0.85

Calls 3

CloseMethod · 0.65
ConvertMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected