# @minhducsun2002/leb128

> LEB128 numbers, done right

Latest version **1.0.0** (published 2022-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @minhducsun2002/leb128
pnpm add @minhducsun2002/leb128
yarn add @minhducsun2002/leb128
bun add @minhducsun2002/leb128
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-09-28 |
| First published | 2020-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Minh Duc Vo |
| Maintainers | minhducsun2002 |
| Keywords | leb128, leb |

## Links

- npm: https://www.npmjs.com/package/@minhducsun2002/leb128
- Repository: https://github.com/minhducsun2002/leb128
- Issues: https://github.com/minhducsun2002/leb128/issues
- npm.io page: https://npm.io/package/@minhducsun2002/leb128

## Recent versions

- 1.0.0 (latest) — 2022-09-28
- 0.3.0 — 2022-09-28
- 0.2.0 — 2020-01-12
- 0.1.0-1 — 2020-01-10
- 0.1.0 — 2020-01-10
- 0.0.2-1 — 2020-01-10
- 0.0.2 — 2020-01-10
- 0.0.1 — 2020-01-10

## README

# `leb128`
###### A parser for LEB128-formatted numbers.
![](https://img.shields.io/github/workflow/status/minhducsun2002/leb128/Jest%20tests?label=Jest%20tests)
![](https://img.shields.io/github/workflow/status/minhducsun2002/leb128/TypeScript%20compilation)
[![](https://img.shields.io/npm/v/@minhducsun2002/leb128)](https://www.npmjs.com/package/@minhducsun2002/leb128)

### Usage
```js
// ES6 imports
import { LEB128 } from '@minhducsun2002/leb128';
// CommonJS thingy
const { LEB128 } = require('@minhducsun2002/leb128');

// Unsigned integers
var a = LEB128.encode(462644);
// Uint8Array (3) [ 180, 158, 28 ]
var b = LEB128.decode(a);
// 462644
var c = LEB128.decode([0xA6, 0x87, 0x90, 0x04])
// 8651686

// Signed (negative) integers
var d = LEB128.encode(-128383);
// Uint8Array(3) [ 129, 149, 120 ]
var e = LEB128.decode(d, 0, true); /* offset = 0, negative number */
// 8651686
var f = LEB128.decode([0x01, 0x81, 0x95, 0x78], 1, true)
// -128383
```

### License

MIT License. See [here](./LICENSE)

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