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

feat(io/streams): Add readerFromIterable() #752

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

nayeemrmn
Copy link
Contributor

No description provided.

io/streams.ts Outdated Show resolved Hide resolved
@nayeemrmn nayeemrmn force-pushed the reader-from-iterable branch from e99df50 to 4828d87 Compare February 25, 2021 04:59
@nayeemrmn nayeemrmn force-pushed the reader-from-iterable branch from 4828d87 to f2aa9ff Compare February 26, 2021 15:02
@kt3k
Copy link
Member

kt3k commented Mar 16, 2021

I think this can be implemented like in the following way:

function readerFromIterable(
  iterable: Iterable<Uint8Array> | AsyncIterable<Uint8Array>,
) {
  return readerFromStreamReader(
    readableStreamFromIterable(iterable).getReader(),
  );  
}

But this involves a lot of unnecessary overhead. I think it's nice to have this simpler version of this utility.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k kt3k merged commit 99fe3a6 into denoland:main Mar 16, 2021
@nayeemrmn nayeemrmn deleted the reader-from-iterable branch March 16, 2021 06:37
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

Successfully merging this pull request may close these issues.

2 participants