MCPcopy Create free account
hub / github.com/jetkvm/kvm / addFileToZip

Function addFileToZip

web.go:1020–1034  ·  view source on GitHub ↗
(zw *zip.Writer, name, srcPath string)

Source from the content-addressed store, hash-verified

1018}
1019
1020func addFileToZip(zw *zip.Writer, name, srcPath string) error {
1021 f, err := os.Open(srcPath)
1022 if err != nil {
1023 return err
1024 }
1025 defer f.Close()
1026
1027 w, err := zw.Create(name)
1028 if err != nil {
1029 return err
1030 }
1031
1032 _, err = io.Copy(w, f)
1033 return err
1034}
1035
1036func addBytesToZip(zw *zip.Writer, name string, data []byte) error {
1037 w, err := zw.Create(name)

Callers 1

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected