@@ -22,7 +22,7 @@ import (
22
22
"os"
23
23
24
24
paths "github.com/arduino/go-paths-helper"
25
- "github.com/cavaliercoder/grab "
25
+ "go.bug.st/downloader "
26
26
)
27
27
28
28
// ArchivePath returns the path of the Archive of the specified DownloadResource relative
@@ -45,7 +45,7 @@ func (r *DownloadResource) IsCached(downloadDir *paths.Path) (bool, error) {
45
45
}
46
46
47
47
// Download a DownloadResource.
48
- func (r * DownloadResource ) Download (downloadDir * paths.Path ) (* grab. Response , error ) {
48
+ func (r * DownloadResource ) Download (downloadDir * paths.Path ) (* downloader. Downloader , error ) {
49
49
cached , err := r .TestLocalArchiveIntegrity (downloadDir )
50
50
if err != nil {
51
51
return nil , fmt .Errorf ("testing local archive integrity: %s" , err )
@@ -73,10 +73,5 @@ func (r *DownloadResource) Download(downloadDir *paths.Path) (*grab.Response, er
73
73
return nil , fmt .Errorf ("getting archive file info: %s" , err )
74
74
}
75
75
76
- req , err := grab .NewRequest (path .String (), r .URL )
77
- if err != nil {
78
- return nil , fmt .Errorf ("creating HTTP request: %s" , err )
79
- }
80
- client := grab .NewClient ()
81
- return client .Do (req ), nil
76
+ return downloader .Download (path .String (), r .URL )
82
77
}
0 commit comments