diff --git a/aws-experiment-launch/experiment/utils/utils.go b/aws-experiment-launch/experiment/utils/utils.go new file mode 100644 index 000000000..a50b2f8f4 --- /dev/null +++ b/aws-experiment-launch/experiment/utils/utils.go @@ -0,0 +1,29 @@ +package utils + +import ( + "io" + "net/http" + "os" +) + +func DownloadFile(filepath string, url string) { + // Create the file + out, err := os.Create(filepath) + if err != nil { + panic(err) + } + defer out.Close() + + // Get the data + resp, err := http.Get(url) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + // Write the body to file + _, err = io.Copy(out, resp.Body) + if err != nil { + panic(err) + } +}