-
Notifications
You must be signed in to change notification settings - Fork 339
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
Request should allow WritableStream as body #378
Comments
Duplicate of #88. I think we might offer |
Yeah, we're actively working on this, although as you can see from #88 and other issues at https://github.com/yutakahirano/fetch-with-streams/issues, there are some complexities :-/. Also, FYI writable streams are getting much closer to finalized :). |
Emh, just why is WritableStream unclear? Feels weird to have a ReadableStream based upload When you are writing to a stream that are sending stuff. I'm trying to think of this like node's http server request http.createServer((req, res) => {
// here you have both a readable (req) from which you read what has been written by the client
// and a writeable (res) that you write back to the client
}) Should be similar but the other way around, You write to the server and read from the response |
The problem essentially is that The design we settled on was instead that you could have a |
And if you want to you can create pipe (identity transform, etc) to give yourself a WritableStream with a ReadableStream for the Response. This is explicitly opt'ing in to the buffering that this approach would require instead of the browser implicitly sticking a bunch of buffering in the path magically. |
I think i would use the identity transform trick... But it's true that in most cases you send non-streamable object and often you have everything before making a ajax call so those need to be readable so just passing a readable is okey i guess. But for something like JSZip it would have been nice if the lib could just write directly to the |
I may also comment on the other issue, but this is exactly the design I came up with in https://github.com/socketry/async-http/blob/master/lib/async/http/body/writable.rb I think the design works well. |
Just as an aside, the feature is still broken. See here for the commit and associated discussion: #425 |
Now we can get a readable stream from the response, which is cool! But i think it needs a complementary WriteableStream for the request as well. Imagine being able to post more then what can fit into the memory or were you simply just don't have everything you need to post.
But i guess the WritableStream has to be implemented first ^^
The text was updated successfully, but these errors were encountered: