Closed caitp closed 6 years ago
The plan is to have uploads be represented by a writable stream that you write to. Then you know the progress: it's the number of bytes you've written divided by the total number of bytes you plan to write.
Imagine a user has a Blob blob
. If the user wants to make a fetch with uploading blob
, is it desirable to create a ReadableStream from blob
just for receiving progress events?
Chrome is able to send a Blob efficiently but creating a ReadableStream from the Blob and sending the ReadableStream manually will disable the optimization. Hence I would like to have a means to receive progress events while sending a Blob directly.
F2F:
.json
.fetch(url, {progressCallback})
blob.toStream()
, formData.toStream()
etc etcNot sure if this is settled or not, but wanted to throw my perspective in.
As an implementer I'd really like progress to be a separate API from the body stream. In order to implement streaming without a perf penalty we need to do some amount of internal buffering. In contrast, progress events currently attempt to provide status based on bytes that are read/write at the OS-level syscalls. Obviously this does not play well with any internal buffering.
So in my mind we must pick one of these:
Yes much needed feature for trace the upload progress.
I hope to see that feature in future release.
Has there been any updates in a year? Working examples?
I haven't worked on this issue. Is https://github.com/whatwg/fetch/issues/65 related?
I think we're still waiting for experimentation on top of streams before figuring out exactly what to expose.
It's clear that you could consume a streaming response body at chunk intervals, as a replacement for progress events.
But this doesn't exactly help if you wanted to track the progress of an upload. Just wondering if anyone has had any ideas about that.