darrachequesne / notepack

A fast Node.js implementation of the latest MessagePack spec
MIT License
75 stars 19 forks source link

add support for encoding int64-buffer #22

Open rochdev opened 3 years ago

rochdev commented 3 years ago

This PR adds support for encoding actual 64bit integers instead of the maximum of 53bit supported natively by JavaScript. It does so by detecting that the value is an int64-buffer object. This is the same library that is used by msgpack-lite to support 64bit integers.

Right now the change is limited to encoding since decoding would require adding int64-buffer as a dependency, which is a change that should likely be discussed, and might have to be added as a configuration option. I also only added support for big endian right now since decoding always uses big endian. This might be configured as well, but it might be enough to support only big endian.