fix jar files downloading incorrectly
This commit is contained in:
parent
3de0fc53b9
commit
8939d1195d
1 changed files with 9 additions and 4 deletions
|
@ -66,11 +66,16 @@ impl<C: Callback> Downloader<C> {
|
|||
|
||||
let res = client.get(url.clone()).send().await?;
|
||||
let status = res.status();
|
||||
let mut stream = res.bytes_stream();
|
||||
// this doesn't work for downloading jar files
|
||||
|
||||
if let Some(b) = stream.next().await {
|
||||
file.write_all_buf(&mut b?).await?;
|
||||
}
|
||||
// let mut stream = res.bytes_stream();
|
||||
|
||||
// if let Some(b) = stream.next().await {
|
||||
// file.write_all_buf(&mut b?).await?;
|
||||
//}
|
||||
|
||||
let body = res.bytes().await?;
|
||||
file.write_all(&body).await?;
|
||||
|
||||
Ok(DownloadInfo {
|
||||
from: url,
|
||||
|
|
Loading…
Reference in a new issue