Skip to content

Commit

Permalink
chore: clean up, remove unused function
Browse files Browse the repository at this point in the history
Signed-off-by: João Vanzuita <joao@kubeshop.io>
  • Loading branch information
João Vanzuita committed Jul 26, 2022
1 parent ff1ee41 commit 31b7587
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions internal/downloadManager/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,52 +204,6 @@ func extractFileFromTarGz(gzipStream io.Reader, tarAddress string, targetFilePat
}
}

func extractTarGz(gzipStream io.Reader) {
uncompressedStream, err := gzip.NewReader(gzipStream)
if err != nil {
log.Fatal("extractTarGz: NewReader failed")
}

tarReader := tar.NewReader(uncompressedStream)

for {
header, err := tarReader.Next()

if err == io.EOF {
break
}
if err != nil {
log.Println("extractTarGz: Next() failed: %s", err.Error())
}
p, _ := filepath.Abs(header.Name)
if !strings.Contains(p, "..") {

switch header.Typeflag {
case tar.TypeDir:
if err := os.Mkdir(header.Name, 0755); err != nil {
log.Println("extractTarGz: Mkdir() failed: %s", err.Error())
}
case tar.TypeReg:
outFile, err := os.Create(header.Name)
if err != nil {
log.Println("extractTarGz: Create() failed: %s", err.Error())
}
if _, err := io.Copy(outFile, tarReader); err != nil {
log.Println("extractTarGz: Copy() failed: %s", err.Error())
}
outFile.Close()

default:
log.Println(
"extractTarGz: uknown type: %s in %s",
header.Typeflag,
header.Name)
}
}

}
}

func unzip(zipFilepath string, unzipDirectory string) {
dst := unzipDirectory
archive, err := zip.OpenReader(zipFilepath)
Expand Down

0 comments on commit 31b7587

Please sign in to comment.