Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bigint-buffer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigint-buffer

bigint to buffer conversion with native support

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
326K
decreased by-1.79%
Maintainers
1
Weekly downloads
 
Created

What is bigint-buffer?

The bigint-buffer npm package provides utilities for converting between Node.js Buffers and BigInt values. This is particularly useful for handling large integers that exceed the safe integer limit in JavaScript.

What are bigint-buffer's main functionalities?

BigInt to Buffer

Converts a BigInt value to a Buffer in both big-endian and little-endian formats.

const { toBufferBE, toBufferLE } = require('bigint-buffer');
const bigIntValue = 12345678901234567890n;
const bufferBE = toBufferBE(bigIntValue, 8); // Big-endian
const bufferLE = toBufferLE(bigIntValue, 8); // Little-endian
console.log(bufferBE); // <Buffer 00 ab 54 a9 8c eb 1f 0e>
console.log(bufferLE); // <Buffer 0e 1f eb 8c a9 54 ab 00>

Buffer to BigInt

Converts a Buffer to a BigInt value in both big-endian and little-endian formats.

const { toBigIntBE, toBigIntLE } = require('bigint-buffer');
const bufferBE = Buffer.from([0x00, 0xab, 0x54, 0xa9, 0x8c, 0xeb, 0x1f, 0x0e]);
const bufferLE = Buffer.from([0x0e, 0x1f, 0xeb, 0x8c, 0xa9, 0x54, 0xab, 0x00]);
const bigIntBE = toBigIntBE(bufferBE);
const bigIntLE = toBigIntLE(bufferLE);
console.log(bigIntBE); // 12345678901234567890n
console.log(bigIntLE); // 12345678901234567890n

Other packages similar to bigint-buffer

Keywords

FAQs

Package last updated on 17 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc