rfd icon indicating copy to clipboard operation
rfd copied to clipboard

AsyncFileDialog in web context show some kind of progress bar ?

Open fmartinsons opened this issue 7 months ago • 0 comments

Hello,

I'm using egui for building a web app and I use rfd to offer the user to pick a file. Some of file candidate can be big and/or hosted on a low bandwith network drive so when I do something like:

let task = rfd::AsyncFileDialog::new()
    .set_title("Choose a file please")
    .pick_file();
wasm_bindgen_futures::spawn_local(async move {
    let file = task.await;
    if let Some(file) = file {
        let contents = file.read().await;
    }
});

The call to file.read() can take several dozen of seconds (even more) , in the UI, I'm currently showing a spinner saying "loading in progress" but I would like to display some kind of progress bar showing the percentage of file downloaded.

I see rfd used web_sys FileReader and this class seems to have some kind of "progress" support with set_onprogress.

I must admit that I know very little in the web/js world so it may be a silly question but do you think it is something achievable ?

Thanks

fmartinsons avatar Jul 04 '24 13:07 fmartinsons