msgpack-lite
msgpack-lite copied to clipboard
Serialize binary from browser
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.
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.