FileKit icon indicating copy to clipboard operation
FileKit copied to clipboard

cancelling saving file dialog on wasm should return null instead of platform file.

Open fethij opened this issue 1 year ago • 1 comments

We are using the library to save files on Rijksmuseum. We would like to know when the saving dialog is cancelled. For dektop we checking whether FileKit.saveFile(...) is returning null, unfortunately on wasm it's always returning NOT null PlatformFile.

fethij avatar Oct 06 '24 17:10 fethij

Hi @fethij! Actually, on web platforms, I'm not sure if it's possible to know if the user cancelled the download or not.

In the majority of the cases, by default, the files are downloaded in the downloads folder without letting the user change the path / name. It will download the file directly. During the downloading, the user can still cancel this process in the browser.

Another case, if the user enables the option in his browser like "Always ask where to save files", when a download starts, it will show a dialog to the user. In this case, he can cancel the download.

In all cases, I not sure if it's possible to know if the user canceled or not the download. That's why FileKit always returns a non null PlatformFile.

https://stackoverflow.com/questions/9710887/click-ok-or-cancel-of-file-download-in-javascript

Do you have any idea how we could improve that point?

vinceglb avatar Oct 06 '24 18:10 vinceglb

@vinceglb thanks for the reply. i'm not sure whether it's possible as well. you can close the issue.

fethij avatar Oct 28 '24 16:10 fethij