Commit a4aad7fe authored by Ajit Jagtap's avatar Ajit Jagtap
Browse files

Merge branch 'dwnloadhelper_SSS' into 'master'

download helper

See merge request !34
parents eb2eb387 8fb93dd4
Branches
1 merge request!34download helper
Showing with 9 additions and 0 deletions
......@@ -31,6 +31,15 @@ func DownloadFile(sourcePath, destinationPath, jwtToken string, retryCnt int) (b
if strings.Trim(sourcePath, EMPTY_STR) == EMPTY_STR || strings.Trim(destinationPath, EMPTY_STR) == EMPTY_STR || !strings.HasPrefix(sourcePath, HTTP_PROTOCOL) {
return false, errors.New("Either Source/Destination url is empty or source url does not start with 'http'")
}
// dest directory must be a string. check for the same.
destInfo, infoError := filehelper.FileInfo(destinationPath)
if infoError != nil {
return false, errors.New("error occured while getting innformation of destination directory : " + destinationPath)
}
if destInfo.IsDir() {
return false, errors.New("destination path must be a file path, got directory : " + destinationPath)
}
client := grab.NewClient()
req, _ := grab.NewRequest(destinationPath, sourcePath)
if jwtToken != "NA" {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment