Streaming File Uploads
Specific Demand
The current FileEngine exposes two ways to read a file: Reading the file to a string or reading the file to a byte array. Both of these methods perform poorly with large files. In addition to poor performance, you cannot provide updates to the user based on file upload progress.
Implement Suggestion
We should expose a third API that returns the size of the file (depending on the platform) and a stream with the file data
Related to https://github.com/DioxusLabs/dioxus/pull/1181
Reminder on file size visibility: https://github.com/DioxusLabs/dioxus/pull/2323
And for the stream part, in my own web only project with file uploads, I use: web_file: web_sys::File and with https://github.com/MattiasBuelens/wasm-streams :
let mut stream = ReadableStream::from_raw(web_file.stream());
let reader = stream.get_byob_reader();