# uint4

> Read and write half-bytes to buffers

Latest version **0.1.2** (published 2015-04-16) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2015-04-16 |
| First published | 2015-03-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Will Franzen |
| Maintainers | wtfaremyinitials |
| Keywords | buffer, buf, int, half, byte, uint, uint4 |

## Links

- npm: https://www.npmjs.com/package/uint4
- Repository: https://github.com/wtfaremyinitials/uint4
- Issues: https://github.com/wtfaremyinitials/uint4/issues
- npm.io page: https://npm.io/package/uint4

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2015-04-16
- 0.1.1 — 2015-04-15
- 0.0.0 — 2015-03-16

## README

UInt4
===

Read and write half-bytes to buffers

Usage
===

**Basic usage**

ES5
```js
var readUInt4  = require('uint4').read;
var writeUint4 = require('uint4').write;

var buffer = new Buffer(4);

writeUInt4(buffer, 3, 0.0);
writeUInt4(buffer, 7, 0.5);

readUInt4(buffer, 0.0); // 3
readUint4(buffer, 0.5); // 7
```

ES6
```js
var {readUInt4, writeUint4} = require('uint4');

var buffer = new Buffer(4);

writeUInt4(buffer, 5, 0.0);
writeUInt4(buffer, 4, 0.5);

readUInt4(buffer, 0.0); // 5
readUint4(buffer, 0.5); // 4
```

**BE and LE APIs**

ES6

```js
var { readUInt4LE, writeUInt4BE, readUInt4BE, writeUInt4BE } = require('uint4');

var buffer = new Buffer(4);

// BE

buffer.fill(0);
writeUInt4BE(buffer, 4, 0);

buffer; // <Buffer 40 00 00 00>
readUInt4BE(buffer, 0); // 4

// LE

buffer.fill(0);
writeUInt4LE(buffer, 4, 0);

buffer; // <Buffer 04 00 00 00>
readUInt4LE(buffer, 0); // 4
```

License
===

MIT

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