MCPcopy Create free account
hub / github.com/antonmedv/gitmal / writeGzip

Function writeGzip

post_process.go:123–139  ·  view source on GitHub ↗
(path string, data []byte)

Source from the content-addressed store, hash-verified

121}
122
123func writeGzip(path string, data []byte) error {
124 f, err := os.Create(path)
125 if err != nil {
126 return err
127 }
128 defer func() { _ = f.Close() }()
129 gw := gzip.NewWriter(f)
130 gw.Name = filepath.Base(strings.TrimSuffix(path, ".gz"))
131 if _, err := io.Copy(gw, bytes.NewReader(data)); err != nil {
132 _ = gw.Close()
133 return err
134 }
135 if err := gw.Close(); err != nil {
136 return err
137 }
138 return nil
139}

Callers 1

postProcessHTMLFunction · 0.85

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected