File tree Expand file tree Collapse file tree 2 files changed +23
-20
lines changed
mithril-client-cli/src/utils/http_downloader Expand file tree Collapse file tree 2 files changed +23
-20
lines changed Original file line number Diff line number Diff line change
1
+ use std:: path:: { Path , PathBuf } ;
2
+
3
+ use async_trait:: async_trait;
4
+ use reqwest:: Url ;
5
+
6
+ use mithril_client:: MithrilResult ;
7
+
8
+ /// Trait for downloading a file over HTTP from a URL,
9
+ /// saving it to a target directory with the given filename.
10
+ ///
11
+ /// Returns the path to the downloaded file.
12
+ #[ cfg_attr( test, mockall:: automock) ]
13
+ #[ async_trait]
14
+ pub trait HttpDownloader {
15
+ async fn download_file (
16
+ & self ,
17
+ url : Url ,
18
+ download_dir : & Path ,
19
+ filename : & str ,
20
+ ) -> MithrilResult < PathBuf > ;
21
+ }
Original file line number Diff line number Diff line change
1
+ mod interface;
1
2
mod reqwest_http_downloader;
2
3
4
+ pub use interface:: * ;
3
5
pub use reqwest_http_downloader:: * ;
4
-
5
- use async_trait:: async_trait;
6
- use mithril_client:: MithrilResult ;
7
- use reqwest:: Url ;
8
- use std:: path:: { Path , PathBuf } ;
9
-
10
- /// Trait for downloading a file over HTTP from a URL,
11
- /// saving it to a target directory with the given filename.
12
- ///
13
- /// Returns the path to the downloaded file.
14
- #[ cfg_attr( test, mockall:: automock) ]
15
- #[ async_trait]
16
- pub trait HttpDownloader {
17
- async fn download_file (
18
- & self ,
19
- url : Url ,
20
- download_dir : & Path ,
21
- filename : & str ,
22
- ) -> MithrilResult < PathBuf > ;
23
- }
You can’t perform that action at this time.
0 commit comments