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

refactor web streams to async iterator/generators #3

Open
Sec-ant opened this issue Nov 23, 2022 · 2 comments
Open

refactor web streams to async iterator/generators #3

Sec-ant opened this issue Nov 23, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Sec-ant
Copy link
Owner

Sec-ant commented Nov 23, 2022

Some related links

Basically, there're two functions that need implementing:

Other works left including refactoring transformers to async generators are already done in another branch of this repo. But they still need testing as I also refactored many other places.

@Sec-ant Sec-ant self-assigned this Nov 23, 2022
@Sec-ant Sec-ant added the enhancement New feature or request label Nov 23, 2022
@ThaUnknown
Copy link

rauschma/iterable-to-readable-stream.mjs is bad as it never closes the iterator if the stream is cancelled see for a safer implementation: https://github.com/webtorrent/webtorrent/pull/2414/files#diff-387904f6b07263914bc1b0cb291a27832cc6963e01b5d44b75460771fc25ee8fR153 this doesn't implement lazy loading iterators via start, but you can pretty much cop-paste that

dy/readable-stream-async-iterator.js, see https://github.com/ThaUnknown/fast-readable-async-iterator/blob/main/index.js which also caches 1 value ahead for streams without hwm, both are good

@Sec-ant
Copy link
Owner Author

Sec-ant commented Dec 7, 2022

@ThaUnknown Again, thanks for your tips! Yeah, I simply gathered all the related discussions/implementations as a reminder. I went through some of the links and realized some of them might not be what I need but nevertheless steps guiding me to the right direction😄. I really appreciate that many of your repos have offered me much help! I'm currently using a simple implementation written by myself: Sec-ant/readable-stream.

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

No branches or pull requests

2 participants