# biguintle

> Encode / decode unsigned BigInt as little endian

Latest version **1.0.3** (published 2019-06-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install biguintle
pnpm add biguintle
yarn add biguintle
bun add biguintle
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-06-12 |
| First published | 2018-05-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/biguintle) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Emil Bay |
| Maintainers | emilbayes |
| Keywords | bigint, uint, uint64, abstract, encoding, encode, decode |

## Links

- npm: https://www.npmjs.com/package/biguintle
- Repository: https://github.com/emilbayes/biguintle
- Homepage: https://github.com/emilbayes/biguintle#readme
- Issues: https://github.com/emilbayes/biguintle/issues
- npm.io page: https://npm.io/package/biguintle

## Dependencies (1)

- [nanoassert](https://npm.io/package/nanoassert.md) ^1.1.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2019-06-12
- 1.0.1 — 2018-05-03
- 1.0.0 — 2018-05-02

## README

# `biguintle`

[![Build Status](https://travis-ci.org/emilbayes/biguintle.svg?branch=master)](https://travis-ci.org/emilbayes/biguintle)
[![abstract-encoding](https://img.shields.io/badge/abstract--encoding-compliant-brightgreen.svg?style=flat)](https://github.com/mafintosh/abstract-encoding)

> Encode / decode unsigned BigInt as little endian

## Usage

```js
var bigUintLE = require('biguintle')

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

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

var num = bigUintLE.decode()
```

## API

### `var buf = bigUintLE.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 = bigUintLE.encode.bytes`
`Number` of bytes last encoded

### `var bigUint = bigUintLE.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 `BigInt`s do
not have a natural width.

### `var bytes = bigUintLE.decode.bytes`
`Number` of bytes last decoded

### `var bytes = bigUintLE.encodingLength(bu)`
`Number` of bytes required to encode `BigInt` `bu`

## Install

```sh
npm install biguintle
```

## License

[ISC](LICENSE)

---
_Source: https://npm.io/package/biguintle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
