mcollina / msgpack5

A msgpack v5 implementation for node.js, with extension points / msgpack.org[Node]
MIT License
493 stars 76 forks source link

BigInt not supported #80

Open mzedeler opened 4 years ago

mzedeler commented 4 years ago
require('msgpack5')().encode({a: 10n})
Uncaught Error: not implemented yet

I am a bit surprised that it isn't possible to write a decoder for this. I tried, but I get the same error, since msgpack5 never seems to try to get the value converted:

const m = require('msgpack5')()
m.registerEncoder((t) => (t instanceof BigInt), t => t.toString(10))
m..encode({a: 10n})
Uncaught Error: not implemented yet
mcollina commented 4 years ago

This library was written way before BigInt was a thing. Feel free to send a PR to add support for this.