✨ 整理下下载功能
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::fs;
|
||||
use tauri::{api, command, AppHandle, Manager};
|
||||
|
||||
#[command]
|
||||
@@ -19,3 +20,9 @@ pub fn fullscreen(app: AppHandle) {
|
||||
pub fn open_browser(app: AppHandle, url: String) {
|
||||
api::shell::open(&app.shell_scope(), url, None).unwrap();
|
||||
}
|
||||
|
||||
#[command]
|
||||
pub fn download(_app: AppHandle, name: String, blob: Vec<u8>) {
|
||||
let path = api::path::download_dir().unwrap().join(name);
|
||||
fs::write(&path, blob).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user