hi, I want to make an animation, so when the download begins the animation too, and the download ends and also the animation, but the function saveAs() is not a promise and returns void(or undefined), so, the only way to know if the download is ready is when the file explorer appears.
how I can know when the download begins and ends??
I'm just downloading images
It's impossible to figure out with FileSaver.
Saving a blob is pretty much instant. and you have no way of knowing if the user even started the download
However StreamSaver have some degree of figuring out different state of the download progress based on stream. it's not elegant but you can figure out if the stream was canceled. if the stream was back pressured (writing to much/to fast) no decrease === user paused the download. if user ask for more data that should be written and when the stream is ended
Here is an example where desiredSize is lowered as you pause the download (only works with transferable stream)
You know, we can pass a url to saveAs. In that case, we might need a promise as return value.
Most helpful comment
You know, we can pass a url to
saveAs. In that case, we might need a promise as return value.