Handling BigInts larger than 64 bits with DataView?

42 Views Asked by At

I want to transport BigInt values (along with way more information) over Websockets with packets that are made with DataView.

From this page of the Mozilla docs, I can see that you can only safely set BigInt values that can fit within 64 bits.

The problem is that I intend my BigInt number to be of a larger value than what can fit in the specified 64 bits limit.

How do I use DataView to set and get BigInt values that are larger than what can fit in these limits?

I could just stringify it and then append it to the buffer I want to send, or just JSON.stringify() all the package information and then send that string, but I do not want to do that for reasons that do not need to be told.

What would I need to do to achieve my goal?

0

There are 0 best solutions below