Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

uint8-varint

achingbrain427.7kApache-2.0 OR MIT2.0.4TypeScript support: included

Read/write unsigned varints from Uint8Arrays and Uint8ArrayLists

readme

uint8-varint

codecov CI

Read/write unsigned varints from Uint8Arrays and Uint8ArrayLists

Table of contents

Install

$ npm i uint8-varint

Browser <script> tag

Loading this module through a script tag will make it's exports available as Uint8Varint in the global namespace.

<script src="https://unpkg.com/uint8-varint/dist/index.min.js"></script>

Usage

import { Uint8ArrayList } from 'uint8arraylist'
import * as varint from 'uint8-varint'

const value = 12345

const buf = new Uint8ArrayList(
  new Uint8Array(2)
)
varint.encode(value, buf)

varint.decode(buf) // 12345

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

changelog

2.0.4 (2024-01-30)

Dependencies

  • dev: bump aegir from 41.3.5 to 42.2.2 (#47) (568a0df)

2.0.3 (2023-12-28)

Trivial Changes

Dependencies

  • bump uint8arrays from 4.0.10 to 5.0.0 (#40) (6ebf2f8)

2.0.2 (2023-10-26)

Dependencies

  • dev: bump aegir from 40.0.13 to 41.0.11 (#38) (ba625d6)

2.0.1 (2023-08-16)

Bug Fixes

  • ensure Uint8Array type is returned by default (#31) (4bed840)

Trivial Changes

2.0.0 (2023-08-15)

⚠ BREAKING CHANGES

  • zigzag, signed and long encodings have been removed, import * for unsigned encode/decode

Features

  • remove zigzag, signed and long, now only supports unsigned varints (#30) (29efeac), closes #27

1.0.8 (2023-08-15)

Bug Fixes

1.0.7 (2023-08-15)

Dependencies

  • dev: bump aegir from 38.1.8 to 40.0.0 (#26) (ec88ec0)

1.0.6 (2023-03-31)

Bug Fixes

1.0.5 (2023-03-31)

Dependencies

  • dev: bump aegir from 37.12.1 to 38.1.8 (#14) (98c1b7b)

1.0.4 (2022-10-12)

Dependencies

  • update uint8arrays from 3.x.x to 4.x.x (#6) (87c2307)

1.0.3 (2022-08-05)

Bug Fixes

  • improve derived return type of encode method (#5) (298894c)

1.0.2 (2022-07-30)

Bug Fixes

1.0.1 (2022-07-30)

Bug Fixes

1.0.0 (2022-07-28)

Features

Trivial Changes