mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-24 19:43:25 +00:00
* Renamed aggregator -> apiServer. * Format errors with container names. * Renamed collector -> apiServer. * Rephrased help messages. * Moved api -> agent. * Continue renameing api -> agent in Makefile and Dockerfiles.
21 lines
418 B
Go
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
|
|
}
|