MCPcopy Index your code
hub / github.com/syncthing/syncthing / writeZip

Function writeZip

lib/api/support_bundle.go:39–56  ·  view source on GitHub ↗

writeZip writes a zip file containing the given entries

(writer io.Writer, files []fileEntry)

Source from the content-addressed store, hash-verified

37
38// writeZip writes a zip file containing the given entries
39func writeZip(writer io.Writer, files []fileEntry) error {
40 zipWriter := zip.NewWriter(writer)
41 defer zipWriter.Close()
42
43 for _, file := range files {
44 zipFile, err := zipWriter.Create(file.name)
45 if err != nil {
46 return err
47 }
48
49 _, err = zipFile.Write(file.data)
50 if err != nil {
51 return err
52 }
53 }
54
55 return zipWriter.Close()
56}

Callers 1

getSupportBundleMethod · 0.85

Calls 3

CloseMethod · 0.65
CreateMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected