@vekexasia/bigint-buffer-polyfill

1.0.0 • Public • Published

@vekexasia/bigint-buffer-polyfill: Buffer polyfill for BigInt

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.

Documentation

You can find typedoc documentation here.

Installation

Add the library to your project:

npm install @vekexasia/bigint-buffer-polyfill

or

yarn add @vekexasia/bigint-buffer-polyfill

Usage

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

TypeScript

The library is entirely written in TypeScript and comes with its own type definitions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @vekexasia/bigint-buffer-polyfill

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • vekexasia