This project is part of the bigint-swissknife project. It aims to monkeypatch the Buffer native class adding support for BigInts. This is useful when working with Node.js.
You can find typedoc documentation here.
Add the library to your project:
npm install @vekexasia/bigint-buffer-polyfill
or
yarn add @vekexasia/bigint-buffer-polyfill
Simply import the library and start using it on your Buffers.
import '@vekexasia/bigint-buffer-polyfill';
const buf = Buffer.alloc(16);
buf.writeBigIntBE(-42n, 8);
buf.writeBigUIntLE(69n, 8, 8);
console.log(buf.readBigIntBE(8)); // -42n
console.log(buf.readBigUIntLE(8, 8)); // 69n
The library is entirely written in TypeScript and comes with its own type definitions.
This project is licensed under the MIT License - see the LICENSE file for details.