Files
kubeshark/api/pkg/utils/zip.go
gadotroee 2f33f9229a TRA-3234 Fetch command (#54)
* preparation to fetch command

* get har as zip from server

* no message

* no message
2021-05-24 19:29:46 +03:00

21 lines
418 B
Go

package utils
import (
"archive/zip"
"bytes"
)
func ZipData(files map[string][]byte) *bytes.Buffer {
// Create a buffer to write our archive to.
buf := new(bytes.Buffer)
// Create a new zip archive.
zipWriter := zip.NewWriter(buf)
defer func() { _ = zipWriter.Close() }()
for fileName, fileBytes := range files {
zipFile, _ := zipWriter.Create(fileName)
_, _ = zipFile.Write(fileBytes)
}
return buf
}