Re: [fetch] Feed a Response to existing APIs (#49)

> There is an additional paradigm where you pipe the response body stream to a writable stream.

Sorry to raise the readable-vs-writable thing again, but it seems this:

> <img>.srcObject = responseInstance

Could accept a ReadableStream object or anything that can be unwrapped to a ReadableStream (like Response).  This would keep the processing loop in the C++ code where it currently lives today for these APIs.  You also get the backpressure for free, of course.

This doesn't preclude having a WritableStream mechanism as well, though.  I expect the C++ code would just create a pipe, expose the writer end, and just do its current read loop internally.  So in effect it would probably just be a convenience to avoid manually creating a pipe.

Another way to describe what I'm saying, is things with a .src attribute are designed to consume sources.  A ReadableStream is a source.  A WriteableStream is a sink.  Converting APIs from consume-a-source to expose-a-sink is an extra amount of work.

In the end it would probably be nice to have both.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/49#issuecomment-100410152

Received on Saturday, 9 May 2015 01:38:33 UTC