MCPcopy Create free account
hub / github.com/bytebase/bytebase / WriteZipEntry

Function WriteZipEntry

backend/component/export/zip.go:25–35  ·  view source on GitHub ↗

WriteZipEntry writes content to a zip file entry.

(zipw *zip.Writer, filename string, content []byte, password string)

Source from the content-addressed store, hash-verified

23
24// WriteZipEntry writes content to a zip file entry.
25func WriteZipEntry(zipw *zip.Writer, filename string, content []byte, password string) error {
26 fh := CreateZipFileHeader(filename, password)
27 writer, err := zipw.CreateHeader(fh)
28 if err != nil {
29 return errors.Wrapf(err, "failed to create zip entry for %s", filename)
30 }
31 if _, err := writer.Write(content); err != nil {
32 return errors.Wrapf(err, "failed to write zip entry for %s", filename)
33 }
34 return nil
35}
36
37// CreateZipWriter creates a zip writer for the given writer with a file header.
38func CreateZipWriter(zipw *zip.Writer, filename string, password string) (io.Writer, error) {

Callers 3

exportResultToZipMethod · 0.92
exportResultToZipFunction · 0.92
doEncryptFunction · 0.92

Calls 1

CreateZipFileHeaderFunction · 0.85

Tested by

no test coverage detected