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

biguintbe

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

biguintbe

Encode / decode unsigned BigInt as big endian

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

biguintbe

abstract-encoding

Encode / decode unsigned BigInt as big endian

Usage

var bigUintBE = require('biguintbe')

var bigUint = 2n ** 64n - 1n // UINT64_MAX

assert(bigUintBE.encodingLength(bigUint) === 8)
var buf = bigUintBE.encode(bigUint)
assert(bigUintBE.encode.bytes === 8 && buf.byteLength === 8)

var num = bigUintBE.decode()

API

var buf = bigUintBE.encode(bu, [buf, [byteOffset]])

Write BigInt bu to optional Buffer or TypedArray buf at optional Number byteOffset. If buf is not set a new Buffer is allocated the size of the byte width of bu. byteOffset defaults to 0.

var bytes = bigUintBE.encode.bytes

Number of bytes last encoded

var bigUint = bigUintBE.decode(buf, [byteOffset], [byteLength])

Read BigInt from Buffer or TypedArray buf at optional Number byteOffset for optional Number byteLength bytes. Note that if you do not give a byteLength all of buf will be decoded, since BigInts do not have a natural width.

var bytes = bigUintBE.decode.bytes

Number of bytes last decoded

var bytes = bigUintBE.encodingLength(bu)

Number of bytes required to encode BigInt bu

Install

npm install biguintbe

License

ISC

Keywords

FAQs

Package last updated on 02 Mar 2020

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