Re: [whatwg/fetch] Allow request/response.blob() to resolve before reading the full stream (#556)

Although upon seeing this issue initially I was sympathetic, thinking that the spec should not prohibit interesting optimizations, now I am not so sure. It really comes to down the question of, what does `response.blob()` fulfilling *mean*? Or, from another angle, what does having a `Blob` object in hand mean?

I see two possibilities:

- It means you have a handle to some data that could in theory be read, perhaps even successfully, by the browser/the FileReader API/etc.
- It means that you have some assurance that the data is a known, readable quantity, that (modulo transient filesystem errors) can be read successfully at any time.

If we say that having a Blob/a fulfilled `response.blob()` promise means the latter, then we really do need to wait to read the response stream to the end first.

> What if we just added some kind of "skip" operation to ReadableStream? This would let you efficiently seek forwards to the part you want without necessarily loading it all into memory.

I feel like we discussed this before. I am amenable. IIRC last time we talked the idea was the default implementation would throw away data but the underlying byte source could provide a specialized skip operation to be more efficient.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/556#issuecomment-309799517

Received on Tuesday, 20 June 2017 15:40:45 UTC