[whatwg/fetch] How should the ReadableStream from response.body work when it's multipart? (#1021)

Opening here at the request of @domenic -- while looking into providing an [ImageDecoder API](https://github.com/dalecurtis/image-decoder-api/blob/master/explainer.md) I've hit an issue with streaming multipart MJPEG resources and the ReadableStream returned by response.body.

Downstream streams don't know the multipart boundary specified in the Content-Type header, so they can't parse headers out of the ReadableStream to get at the binary data. E.g., Using [cam2web](https://github.com/cvsandbox/cam2web/), the multipart Content-Type is:

> Content-Type=multipart/x-mixed-replace; boundary=--myboundary

And each chunk of the response looks like this:

> '--myboundary\r\nContent-Type: image/jpeg\r\nContent-Length: $SIZE\r\n\r\n$JPEG_DATA'

So multipart ReadableStreams today require a user supplied TransformStream to reform the data into contiguous blocks. @domenic indicated there may be some interest in providing a browser-supplied solution to this, so opening this issue for discussion. Thanks!

-- 
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/1021

Received on Thursday, 16 April 2020 17:59:58 UTC