Upload progress indicators for fetch?

Streams are starting to land in the web platform (https://jakearchibald.com/2016/streams-ftw/) but it’s still early days.

Soon you’ll be able to provide a stream as the body of a request, but the open question is whether the consumption of that stream relates to bytes uploaded.

Particular redirects can result in data being retransmitted to the new location, but streams cannot “restart”. We can fix this by turning the body into a callback which can be called multiple times, but we need to be sure that exposing the number of redirects isn’t a security leak, since it’d be the first time on the platform JS could detect that.

Some are questioning whether it even makes sense to link stream consumption to bytes uploaded.

Long story short: this isn’t possible yet, but in future this will be handled either by streams, or some kind of higher-level callback passed into fetch().

Leave a Comment