cbor-x icon indicating copy to clipboard operation
cbor-x copied to clipboard

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

Open RogerPodacter opened this issue 1 year ago • 0 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!

RogerPodacter avatar May 31 '24 15:05 RogerPodacter