msgpack-lite icon indicating copy to clipboard operation
msgpack-lite copied to clipboard

Serialize binary from browser

Open dabretin opened this issue 7 years ago • 1 comments

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.

dabretin avatar Apr 28 '18 17:04 dabretin

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.

dbrgn avatar May 17 '18 09:05 dbrgn