msgpack encoder and decoder in pure javascript based on creationix/msgpack-js updated to match the new v5 specification with string support.
npm install msgpack-js-v5**Please see the [original README.md][1] from the source repository for more
information.**
This is a port of [creationix/msgpack-js][0] to support the new MsgPack v5
specification.
* New spec: https://github.com/msgpack/msgpack/blob/master/spec.md
* Old spec: https://github.com/msgpack/msgpack/blob/master/spec-old.md
Please feel free to open issues/pull requests for support/discussion.
``sh`
$ npm i msgpack-js-v5 --save
Since there is no way to encode undefined inside the msgpack spec, an extension point isfixext 1
used for this purpose. Specifically, the type is used with all values being 0undefined
to indicate . On the wire, it requires 3 bytes and should looks like this:
``
0xd4 | 0x00 | 0x00
Where | is byte separator.
Extensions are encoded/decoded to and from a simple 2-elements array tuple of the form
[type, Buffer]. Where type is the msgpack extension type identifier and Buffer is
the raw decoded value.
Special case for fixext 1 since it will always be 1-byte long a simple [type, value]Buffer
is returned directly instead of wrapping it in node.js .
This package will follows msgpack-js version for the time being. The version string willv5
simply be appended with .
If and when this package diverges from the original, we can start our own versioning. Or
this module could just be merged into the original msgpack-js` module.
[0]: https://github.com/creationix/msgpack-js
[1]: https://github.com/creationix/msgpack-js/blob/master/README.markdown