Rewritten in go and python

This commit is contained in:
2024-11-06 01:25:27 +04:00
parent 9f22d9678d
commit d8449237bb
50 changed files with 3824 additions and 879 deletions

View File

@@ -0,0 +1,31 @@
package dto
import (
"io"
"net/http"
"os"
)
func DownloadAndExtractGz(url, downloadFilepath, extractFilepath string) error {
if err := Download(url, downloadFilepath); err != nil {
return err
}
return ExtractGzFile(downloadFilepath, extractFilepath)
}
func Download(url, filepath string) error {
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
out, err := os.Create(filepath)
if err != nil {
return err
}
defer out.Close()
_, err = io.Copy(out, resp.Body)
return err
}