MCPcopy Index your code
hub / github.com/coder/coder / CreateZipFromTar

Function CreateZipFromTar

archive/archive.go:180–187  ·  view source on GitHub ↗

CreateZipFromTar converts the given tarReader to a zip archive.

(tarReader *tar.Reader, maxSize int64)

Source from the content-addressed store, hash-verified

178
179// CreateZipFromTar converts the given tarReader to a zip archive.
180func 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.
190func WriteZip(w io.Writer, tarReader *tar.Reader, maxSize int64) error {

Callers 5

TestDownloadFunction · 0.92
TestTemplatePull_StdoutFunction · 0.92
CreateZipFunction · 0.92
TestCreateZipFromTarFunction · 0.92

Calls 2

WriteZipFunction · 0.85
BytesMethod · 0.45

Tested by 3

TestDownloadFunction · 0.74
TestTemplatePull_StdoutFunction · 0.74
TestCreateZipFromTarFunction · 0.74