Polyfill for BigInt support in Buffer
import '@vekexasia/bigint-buffer-polyfill';const buf = Buffer.alloc(16);buf.writeBigIntBE(-42n, 8);buf.writeBigUIntLE(69n, 8, 8);console.log(buf.readBigIntBE(8)); // -42nconsole.log(buf.readBigUIntLE(8, 8)); // 69n Copy
import '@vekexasia/bigint-buffer-polyfill';const buf = Buffer.alloc(16);buf.writeBigIntBE(-42n, 8);buf.writeBigUIntLE(69n, 8, 8);console.log(buf.readBigIntBE(8)); // -42nconsole.log(buf.readBigUIntLE(8, 8)); // 69n
Read a signed BigInt from a buffer in Big Endian format
the number of bytes to read
Optional
the offset to read from
the value read
Read a signed BigInt from a buffer in Little Endian format
Read an unsigned BigInt from a buffer in Big Endian format
Read an unsigned BigInt from a buffer in Little Endian format
Write a signed BigInt to a buffer in Big Endian format
the value to write
the number of bytes to write
the offset to write at
the number of bytes written
Write a signed BigInt to a buffer in Little Endian format
Write an unsigned BigInt to a buffer in Big Endian format
Write an unsigned BigInt to a buffer in Little Endian format
Generated using TypeDoc
Polyfill for BigInt support in Buffer
Example