Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Don't add streams support? #25

Closed
ronag opened this issue Feb 16, 2021 · 9 comments
Closed

Don't add streams support? #25

ronag opened this issue Feb 16, 2021 · 9 comments
Labels
question Further information is requested

Comments

@ronag
Copy link
Collaborator

ronag commented Feb 16, 2021

One way to make things more spec compliant would be to not add support for Node streams and only AsyncIterables. That way developers that want to be cross platform compatible just have to avoid whatwg/Node streams and instead use AsyncIterable API's and it will work the same.

@ronag ronag added the question Further information is requested label Feb 16, 2021
@Ethan-Arrowood
Copy link
Owner

I'm +1 for this if we have a goal to be cross-plat

@ronag
Copy link
Collaborator Author

ronag commented Feb 16, 2021

@mcollina @jasnell WDYT?

@jasnell
Copy link

jasnell commented Feb 16, 2021

I would agree.

@mcollina
Copy link
Collaborator

I agree!

@ronag
Copy link
Collaborator Author

ronag commented Feb 17, 2021

We should probably revive (nodejs/undici#363). In the meantime undici-fetch can always use Readable.from(iterable).

@jimmywarting
Copy link

jimmywarting commented Mar 1, 2021

I have just recently tried to suggest/strive away from using either node or whatwg streams in node-fetch also, will see how far it goes if it can eventually operate on only AsyncIterator instead. (this would mean treating `blob.stream() as a iterator also)

@mcollina
Copy link
Collaborator

mcollina commented Mar 1, 2021

I have just recently tried to suggest/strive away from using either node or whatwg streams in node-fetch also, will see how far it goes if it can eventually operate on only AsyncIterator instead. (this would mean treating `blob.stream() as a iterator also)

I think that'd be best. Have you got a link?

@jimmywarting
Copy link

jimmywarting commented Mar 1, 2021

Don't have a exact issue/link for it - more scattered around bit of places

All of it is more about supporting/accepting a AsyncIterator as an input then it is about returning something that should be a stream, eg we might still want response.body to still be the same underlying http response stream - don't see any reason to downgrade it to only be a AsyncIterator when it already is a async iterator in itself.

@Ethan-Arrowood
Copy link
Owner

with #43 the api is now going to accept any AsyncIterator as a body; meaning we can support either WHATWG or Node.js stream implementation. More work to be done on the body itself but this is a great step towards spec-compat

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants