kriszyp/cbor-x

How can I encode JS `BigInt`s with cbor-x?

Closed this issue · 1 comments

I would expect this to work:

decode(encode(1234567890123456789012345678901234567890n)) == 1234567890123456789012345678901234567890n

Instead I get RangeError: 1234567890123456789012345678901234567890 was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64

Converting to float-64 won't work because I need an integer, not a float. CBOR itself supports BigInts of course, how can I work with them using cbor-x?

Thank you!

Should be addressed in v1.6.