# read-uint

> read an unsigned integer from buffer

Latest version **2.0.0** (published 2020-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install read-uint
pnpm add read-uint
yarn add read-uint
bun add read-uint
```

## 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 | 2.0.0 |
| Published | 2020-07-03 |
| First published | 2018-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | read, uint, buffer |

## Links

- npm: https://www.npmjs.com/package/read-uint
- Repository: https://github.com/coderaiser/read-uint
- Issues: https://github.com/coderaiser/read-uint/issues
- npm.io page: https://npm.io/package/read-uint

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-07-03
- 1.1.1 — 2018-08-08
- 1.1.0 — 2018-08-02
- 1.0.4 — 2018-08-01
- 1.0.3 — 2018-08-01
- 1.0.2 — 2018-08-01
- 1.0.1 — 2018-08-01
- 1.0.0 — 2018-07-31

## README

# Read UInt [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]

Read an unsigned integer from `buffer`. Similar to [buf.readIntBE](https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html#buffer_buf_readintbe_offset_bytelength) but without `byteLength` limitation.

## Install

```
npm i read-uint
```

## How to use?

```js
const {readUIntBE, readUIntLE} = require('read-uint');
const buf = Buffer.from([0xff, 0xfe, 0xff, 0xfd, 0xfb, 0xfa, 0xf0, 0xf1]);

readUIntBE(buf, 0);
// returns
'0xfffefffdfbfaf0f1';

readUIntLE(buf, 0);
// returns
'0xf1f0fafbfdfffe';

// same with array
const array = [0xff, 0xfe, 0xff, 0xfd, 0xfb, 0xfa, 0xf0, 0xf1];
readUIntBE(array, 0);
// returns
'0xfffefffdfbfaf0f1';

// set byte length
readUIntBE(buf, 0, 4);
// returns
'0xfffefffd';

readUIntLE(buf, 0, 4);
// returns
'0xf1f0fafb';

// convert to BigInt
const a = readUIntBE(buf, 0);
const number = BigInt(parseInt(a, 16));
```

## License

MIT

[NPMIMGURL]:                https://img.shields.io/npm/v/read-uint.svg?style=flat&longCache=true
[BuildStatusIMGURL]:        https://img.shields.io/travis/coderaiser/read-uint/master.svg?style=flat&longCache=true
[DependencyStatusIMGURL]:   https://img.shields.io/david/coderaiser/read-uint.svg?style=flat&longCache=true
[LicenseIMGURL]:            https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat&longCache=true
[NPMURL]:                   https://npmjs.org/package/read-uint "npm"
[BuildStatusURL]:           https://travis-ci.org/coderaiser/read-uint  "Build Status"
[DependencyStatusURL]:      https://david-dm.org/coderaiser/read-uint "Dependency Status"
[LicenseURL]:               https://tldrlegal.com/license/mit-license "MIT License"

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