CreateZipFromTar converts the given tarReader to a zip archive.
(tarReader *tar.Reader, maxSize int64)
| 178 | |
| 179 | // CreateZipFromTar converts the given tarReader to a zip archive. |
| 180 | func CreateZipFromTar(tarReader *tar.Reader, maxSize int64) ([]byte, error) { |
| 181 | var zipBuffer bytes.Buffer |
| 182 | err := WriteZip(&zipBuffer, tarReader, maxSize) |
| 183 | if err != nil { |
| 184 | return nil, err |
| 185 | } |
| 186 | return zipBuffer.Bytes(), nil |
| 187 | } |
| 188 | |
| 189 | // WriteZip writes the given tarReader to w. |
| 190 | func WriteZip(w io.Writer, tarReader *tar.Reader, maxSize int64) error { |