Skip to content
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

Able to send/receive a native browser stream #112

Open
jimmywarting opened this issue Dec 18, 2017 · 1 comment
Open

Able to send/receive a native browser stream #112

jimmywarting opened this issue Dec 18, 2017 · 1 comment

Comments

@jimmywarting
Copy link

jimmywarting commented Dec 18, 2017

On the client side i feel like the native stream api is the way to go...

https://streams.spec.whatwg.org/

for instance you can get a readable stream from a blob by just doing:

var stream = new Response(blob).body

// and you can get the blob back by doing:
new Response(stream).blob().then(complete)

You may even choose if you want to it as a json, arraybuffer or text if you pass it into a Response constructor. but it can only accept a ReadableStream

@jimmywarting jimmywarting changed the title Able to accept/recive a native browser stream Able to send/receive a native browser stream Dec 18, 2017
@jimmywarting
Copy link
Author

jimmywarting commented Dec 18, 2017

One usecase could be to pipe a request to socket

fetch('http://example.com').then(res => { 
  ss(socket).emit('response', res.body)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant