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

Provide support for Binary Data #12

Closed
jonnyreeves opened this issue Jul 28, 2016 · 5 comments
Closed

Provide support for Binary Data #12

jonnyreeves opened this issue Jul 28, 2016 · 5 comments
Milestone

Comments

@jonnyreeves
Copy link
Owner

It would great to use this as a transport for Protobuf.js; this could then be combined with mwitkow/grpc-browser-compat to provide a grpc-client for browsers...

@ariutta
Copy link
Contributor

ariutta commented Aug 10, 2016

This would be pretty cool. But right now, one of the nice things about chunked-request is how small it is, as you can see in this comparison table. Adding protobuf.js as a core dependency would eliminate that advantage.

Would it be possible to extract out the minimal HTTP client functionality as one lib and then build on that in another lib?

@jonnyreeves
Copy link
Owner Author

Ah sorry, I didn't have intentions on adding protobuf.js as a dependency; just making it so the chunk parsers work with ArrayBuffers instead of strings.

@ariutta
Copy link
Contributor

ariutta commented Aug 11, 2016

I see. Would protobuf.js be a parser that a user could specify?

@jonnyreeves
Copy link
Owner Author

Would protobuf.js be a parser that a user could specify?

Yep exactly.

jonnyreeves added a commit that referenced this issue Aug 18, 2016
* Request implementations now supply a `Uint8Array` of binary data through to the `chunkParser`.
* `defaultChunkParser` converts the `chunkBytes` into a string for processing
* Overhauled how parserState is handled; no longer assume that the `chunkParser` will emit a string; instead we use a `state` object whose contract is wholly owned by the parser (we just shuffle it around internally).
* Added test-coverage for UTF-8 characters
* Added dependency on `utf-8` lib for handling (un)marhsalling of binary data to text.
* Updated documentation
* Updated npm dependencies.

Inspiration provided by @mwitkow and @ariutta -- many thanks! :)
@jonnyreeves jonnyreeves added this to the 0.5 milestone Aug 22, 2016
jonnyreeves added a commit that referenced this issue Aug 26, 2016
* Add support for binary data (#12)

* Request implementations now supply a `Uint8Array` of binary data through to the `chunkParser`.
* `defaultChunkParser` converts the `chunkBytes` into a string for processing
* Overhauled how parserState is handled; no longer assume that the `chunkParser` will emit a string; instead we use a `state` object whose contract is wholly owned by the parser (we just shuffle it around internally).
* Added test-coverage for UTF-8 characters
* Added dependency on `utf-8` lib for handling (un)marhsalling of binary data to text.
* Updated documentation
* Updated npm dependencies.

Inspiration provided by @mwitkow and @ariutta -- many thanks! :)

* Use TextEncoder / Decoder over `utf-8`.

* Update README to convey which polyfills are required for crappy browsers.

* Remove typearray polyfill

Would appear that IE10 has typedarray support :)

* Add test to ensure we always get a Uint8Array supplied.

* Instantiate TextEncoder/Decoder only once. Use stream option.

* Patch up flakey test.

Browsers using the fallback `xhr` transport should expect an addtional call to their `chunkParser` as we flush out the state of the `TextEncoder` when the XHR connection is closed.

* Remove left over utility methods.
@jonnyreeves jonnyreeves modified the milestone: 0.5 Aug 29, 2016
@jonnyreeves
Copy link
Owner Author

Landed on v0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants