MCPcopy Create free account
hub / github.com/coder/coder / CreateTarFromZip

Function CreateTarFromZip

archive/archive.go:33–45  ·  view source on GitHub ↗

CreateTarFromZip converts the given zipReader to a tar archive. maxSize limits the total tar output, including tar metadata.

(zipReader *zip.Reader, maxSize int64)

Source from the content-addressed store, hash-verified

31// CreateTarFromZip converts the given zipReader to a tar archive.
32// maxSize limits the total tar output, including tar metadata.
33func CreateTarFromZip(zipReader *zip.Reader, maxSize int64) ([]byte, error) {
34 err := validateZipArchiveSize(zipReader, maxSize)
35 if err != nil {
36 return nil, err
37 }
38
39 var tarBuffer bytes.Buffer
40 err = writeTarArchive(&tarBuffer, zipReader, maxSize)
41 if err != nil {
42 return nil, err
43 }
44 return tarBuffer.Bytes(), nil
45}
46
47// validateZipArchiveSize performs a metadata-based preflight size
48// check before conversion. The actual tar output limit will still be

Calls 3

validateZipArchiveSizeFunction · 0.85
writeTarArchiveFunction · 0.85
BytesMethod · 0.45