Dev Helpers
← Back

Preserve a BigInt

Preserve a BigInt using Node.js.

Open this example in the interactive library

Source code

import { serialize, deserialize, Serializer, Deserializer } from "node:v8";
const roundTrip = (value) => deserialize(serialize(value));
console.log(roundTrip(9007199254740993n).toString());

Sample output

9007199254740993