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

Serialize binary from browser #88

Open
dabretin opened this issue Apr 28, 2018 · 1 comment
Open

Serialize binary from browser #88

dabretin opened this issue Apr 28, 2018 · 1 comment

Comments

@dabretin
Copy link

Hello !
Perhaps I don't understand something but... It seems to me that binary format (c4 c5 c6) is not used from browser...
msgpack-lite only recognize Buffer (of course, we can use a shim to make it available to the browser).

Could it be more elegant that a specific format (Uint8Array for exemple) is serialize in binary format ?

We can use preset but it will become an extension (which must be implemented on the server side) while binary format is only use with Buffer class which is natively not implemented on the browser.

@dbrgn
Copy link

dbrgn commented May 17, 2018

You probably need the binarraybuffer codec option:

https://github.com/kawanet/msgpack-lite#custom-codec-options

var codec = msgpack.createCodec({binarraybuffer: true});

...then you need to pass the underlying buffer to msgpack-lite instead of the Uint8array directly.

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