MCPcopy Index your code
hub / github.com/devspace-sh/devspace / compress

Method compress

pkg/devspace/sync/upstream.go:942–963  ·  view source on GitHub ↗
(writer io.WriteCloser, files []*FileInformation, ignoreMatcher ignoreparser.IgnoreParser)

Source from the content-addressed store, hash-verified

940}
941
942func (u *upstream) compress(writer io.WriteCloser, files []*FileInformation, ignoreMatcher ignoreparser.IgnoreParser) (*Archiver, error) {
943 defer writer.Close()
944
945 // Use compression
946 gw := gzip.NewWriter(writer)
947 defer gw.Close()
948
949 // Create tar writer
950 tarWriter := tar.NewWriter(gw)
951 defer tarWriter.Close()
952
953 // Archive the given files
954 archiver := NewArchiver(u.sync.LocalPath, tarWriter, ignoreMatcher)
955 for _, file := range files {
956 err := archiver.AddToArchive(file.Name)
957 if err != nil {
958 return nil, errors.Wrapf(err, "compress %s", file.Name)
959 }
960 }
961
962 return archiver, nil
963}
964
965func (u *upstream) uploadArchive(reader io.ReadCloser) error {
966 defer reader.Close()

Callers 1

applyCreatesMethod · 0.95

Calls 3

AddToArchiveMethod · 0.95
NewArchiverFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected