mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
chore: Merge branch v1 into v2 (#702)
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "2.6.0"
|
||||
"tslib": "2.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-alpha.11"
|
||||
|
||||
@@ -21,7 +21,10 @@ use tauri::{
|
||||
plugin::{Builder as PluginBuilder, TauriPlugin},
|
||||
Runtime,
|
||||
};
|
||||
use tokio::{fs::File, io::AsyncWriteExt};
|
||||
use tokio::{
|
||||
fs::File,
|
||||
io::{AsyncWriteExt, BufWriter},
|
||||
};
|
||||
use tokio_util::codec::{BytesCodec, FramedRead};
|
||||
|
||||
use read_progress_stream::ReadProgressStream;
|
||||
@@ -74,7 +77,7 @@ async fn download(
|
||||
let response = request.send().await?;
|
||||
let total = response.content_length().unwrap_or(0);
|
||||
|
||||
let mut file = File::create(file_path).await?;
|
||||
let mut file = BufWriter::new(File::create(file_path).await?);
|
||||
let mut stream = response.bytes_stream();
|
||||
|
||||
while let Some(chunk) = stream.try_next().await? {
|
||||
@@ -84,6 +87,7 @@ async fn download(
|
||||
total,
|
||||
});
|
||||
}
|
||||
file.flush().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user