From 48dffdff3266a13e92e426d4aaa6478cd9567cf5 Mon Sep 17 00:00:00 2001
From: Krzysztof Tomecki <152964795+chris-4chain@users.noreply.github.com>
Date: Wed, 7 Feb 2024 07:34:09 +0100
Subject: [PATCH] chore(BUX-000): unused DownloadAndUnzipFile function

---
 utils/download.go | 64 -----------------------------------------------
 1 file changed, 64 deletions(-)
 delete mode 100644 utils/download.go

diff --git a/utils/download.go b/utils/download.go
deleted file mode 100644
index f488b32b..00000000
--- a/utils/download.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package utils
-
-import (
-	"archive/zip"
-	"context"
-	"io"
-	"io/ioutil"
-	"net/http"
-	"os"
-	"path/filepath"
-)
-
-// DownloadAndUnzipFile download the zip file from the URL and put it's content in the file
-func DownloadAndUnzipFile(ctx context.Context, client HTTPInterface, file *os.File, URL string) error {
-
-	req, err := http.NewRequestWithContext(ctx, http.MethodGet, URL, nil)
-	if err != nil {
-		return err
-	}
-
-	var resp *http.Response
-	if resp, err = client.Do(req); err != nil {
-		return err
-	}
-	defer func() {
-		_ = resp.Body.Close()
-	}()
-
-	zipFileName := filepath.Base(file.Name()) + ".zip"
-
-	var zipFile *os.File
-	zipFile, err = ioutil.TempFile("", zipFileName)
-	if err != nil {
-		return err
-	}
-	defer func() {
-		_ = os.Remove(zipFile.Name())
-	}()
-
-	// Write the body to file
-	_, err = io.Copy(zipFile, resp.Body)
-	if err != nil {
-		return err
-	}
-
-	var reader *zip.ReadCloser
-	reader, err = zip.OpenReader(zipFile.Name())
-	if err != nil {
-		return err
-	}
-	defer func() {
-		_ = reader.Close()
-	}()
-
-	if len(reader.File) == 1 {
-		in, _ := reader.File[0].Open()
-		defer func() {
-			_ = in.Close()
-		}()
-		_, err = io.Copy(file, in)
-	}
-
-	return err
-}