CreateZipFileHeader creates a zip file header with optional password protection.
(filename string, password string)
| 10 | |
| 11 | // CreateZipFileHeader creates a zip file header with optional password protection. |
| 12 | func 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. |
| 25 | func WriteZipEntry(zipw *zip.Writer, filename string, content []byte, password string) error { |
no test coverage detected