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

Streaming/chunked inputs? #41

Open
danvk opened this issue Mar 24, 2015 · 3 comments
Open

Streaming/chunked inputs? #41

danvk opened this issue Mar 24, 2015 · 3 comments

Comments

@danvk
Copy link

danvk commented Mar 24, 2015

I'm getting my input as a sequence of ArrayBuffers. I can merge them all into a single ArrayBuffer for jBinary, but I'd save time & memory if I could feed the individual ArrayBuffers in one at a time. Is this possible with jBinary/jDataView?

@RReverser
Copy link
Member

Not currently possible but I definitely thought on that kind of thing. The main problem is that much of data structures rely on knowing at least size of entire data, so making jBinary streaming would make parsing those impossible/inconsistent with other structures. Not sure how to properly address both kind of cases (where generic streaming mode is needed + where byteLength is needed) now, but PRs are welcome!

@danvk
Copy link
Author

danvk commented Mar 24, 2015

This would be easiest to implement in jDataView. The method to read one byte, for example, would read it either from the current buffer or advance to the next if there were no remaining bytes in the current buffer.

Streaming parsing would be harder—some of the APIs might have to become async.

@RReverser
Copy link
Member

Even in jDataView, advancing mode is completely optional, and you still need to have ability to read/write stuff at any offset. Thus, all the APIs become async and so breaking+slower :(

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

2 participants