-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match Fetch and WHATWG Streams Spec #16
Comments
Here's a demo of this ( |
We want to dedup code for XHR, but I'm not sure how to best do this, because the patch for Also, do we want to use |
Changing the milestone to 0.6; looking to land 0.5 with binary data support (and fix for chrome) in the mean time as real-life keeps getting in the way :( |
Implemented in https://github.com/jonnyreeves/fetch-readablestream |
We've discussed matching the WHATWG streams spec: async
read
method returns a Promise, which is fulfilled by an ArrayBuffer. I'm understanding that to mean we want to build an abstraction over the variousfetch
andxhr
implementations so that they all give areader
with an asyncread
method to the parsers. Here's what it would look like for various implementations:reader
fromfetch
responseType
tomoz-chunked-arraybuffer
, get ArrayBuffer(s) fromxhr.response
progress
event(s), accumulate if needed, resolvereader.read
PromiseresponseType
toms-stream
, callreadAsArrayBuffer
onxhr.response
to get aneventemitter
, get ArrayBuffer(s) fromeventemitter
progress
event(s), accumulate if needed, resolvereader.read
PromiseresponseType
totext
, slicexhr.responseText
onprogress
event(s) to get chunk(s), convert to ArrayBuffer(s) usingtext-encoding-utf-8
, accumulate if needed, resolvereader.read
Promisefetch
, basically do the same thing as for IE9, except use nativeUint8Array
when converting to ArrayBuffer like this.Are we on the same page with this?
The text was updated successfully, but these errors were encountered: