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

Function CreateZipFileHeader

backend/component/export/zip.go:12–22  ·  view source on GitHub ↗

CreateZipFileHeader creates a zip file header with optional password protection.

(filename string, password string)

Source from the content-addressed store, hash-verified

10
11// CreateZipFileHeader creates a zip file header with optional password protection.
12func CreateZipFileHeader(filename string, password string) *zip.FileHeader {
13 fh := &zip.FileHeader{
14 Name: filename,
15 Method: zip.Deflate,
16 }
17 fh.ModifiedDate, fh.ModifiedTime = timeToMsDosTime(time.Now())
18 if password != "" {
19 fh.SetPassword(password)
20 }
21 return fh
22}
23
24// WriteZipEntry writes content to a zip file entry.
25func WriteZipEntry(zipw *zip.Writer, filename string, content []byte, password string) error {

Callers 2

WriteZipEntryFunction · 0.85
CreateZipWriterFunction · 0.85

Calls 1

timeToMsDosTimeFunction · 0.85

Tested by

no test coverage detected