# varuint-bitcoin

> encode/decode number as bitcoin variable length integer

Latest version **2.0.1** (published 2026-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install varuint-bitcoin
pnpm add varuint-bitcoin
yarn add varuint-bitcoin
bun add varuint-bitcoin
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-09-08 |
| First published | 2016-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Kirill Fomichev |
| Maintainers | mappum, fanatid, jprichardson, junderw, jl.landabaso |

## Links

- npm: https://www.npmjs.com/package/varuint-bitcoin
- Repository: https://github.com/bitcoinjs/varuint-bitcoin
- Issues: https://github.com/bitcoinjs/varuint-bitcoin/issues
- npm.io page: https://npm.io/package/varuint-bitcoin

## Dependencies (1)

- [uint8array-tools](https://npm.io/package/uint8array-tools.md) ^0.0.10

## Recent versions

- 2.0.1 (latest) — 2026-09-08
- 2.0.0 — 2024-08-29
- 1.1.2 — 2019-08-28
- 1.1.0 — 2018-01-15
- 1.0.4 — 2016-04-26
- 1.0.3 — 2016-04-08
- 1.0.2 — 2016-04-08
- 1.0.1 — 2016-03-02
- 1.0.0 — 2016-03-02

## README

# varuint-bitcoin

[![NPM Package](https://img.shields.io/npm/v/varuint-bitcoin.svg?style=flat-square)](https://www.npmjs.org/package/varuint-bitcoin)
[![Build Status](https://img.shields.io/travis/bitcoinjs/varuint-bitcoin.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/varuint-bitcoin)

[![abstract-encoding](https://img.shields.io/badge/abstract--encoding-compliant-brightgreen.svg?style=flat-square)](https://github.com/mafintosh/abstract-encoding)

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

encode/decode number as [bitcoin variable length integer](https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer)

| value | storage length (bytes) |
|:------:|:--------------:|
| [0, 0xfd) | 1 |
| [0xfd, 0xffff] | 3 |
| [0x010000, 0xffffffff] | 5 |
| [0x0100000000, 0x1fffffffffffff] | 9 |

## License

MIT

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