You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Advanage of properly handling Uint8Array as bin type: When you have a Uint8Array which is a view into an ArrayBuffer, then you cannot simply pass u8a.buffer to msgpack, since then the byteOffset and byteLength will be lost. The only way to properly encode the data is to copy it into a new ArrayBuffer like so:
I'd be in favor of Uint8Array, ArrayBuffer and Buffer being encoded to 'bin', but bin decoded to Uint8Array by default. that would likely need a major version bump, but it would mean not needing Buffer in the browser. node's Buffer is an Uint8Array under the hood anyway I believe.
Currently, with the
binarybuffer
option,ArrayBuffer
instances are converted tobin
bytes.However, when passing an Uint8Array directly, it gets converted to a map (or to an extension type when turning on the preset):
Could you maybe add an option to treat an UInt8Array like an ArrayBuffer when encoding?
The text was updated successfully, but these errors were encountered: