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

Support for node streams? #680

Open
everett1992 opened this issue Feb 10, 2021 · 5 comments
Open

Support for node streams? #680

everett1992 opened this issue Feb 10, 2021 · 5 comments

Comments

@everett1992
Copy link
Contributor

Does this library support, or plan to support, node's stream module? The makeReader function only accepts buffers. That requires reading the whole ion document into memory before beginning to parse.

@zslayton
Copy link
Contributor

ion-js needs to support both node and browser runtimes. Is there a common stream API we could code against for both?

@everett1992
Copy link
Contributor Author

Looking at the library I don't think it would be easy to target node's stream api because it is async and callback based, while next and stepin are sync.

I see an experimental web streams api, but it's not the same as nodes. https://developer.mozilla.org/en-US/docs/Web/API/Streams_API

I'm going to try reading the stream in a worker_thread, pushing data into a SharedArrayBuffer, and using Atomics.wait to block the main thread.

@everett1992
Copy link
Contributor Author

@jimmywarting
Copy link

jimmywarting commented Oct 22, 2022

i would say iterators are the common factor, and it's easy to create a node stream from it

stream.Readable.from(iterator)

think there was some proposal also about ReadableStream.from(iterable) too (for web)

@desaikd
Copy link
Contributor

desaikd commented Oct 25, 2022

@jimmywarting Can you please elaborate maybe with an example of using an iterator for reader API? Did you mean to provide an iterator for DOM values (It does mean materializing Ion data to DOM values)?

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

4 participants