# uint8array-tools

> A library for dealing with Uint8Arrays.

Latest version **0.0.10** (published 2026-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install uint8array-tools
pnpm add uint8array-tools
yarn add uint8array-tools
bun add uint8array-tools
```

## 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; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2026-09-07 |
| First published | 2021-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 0 |
| Unpacked size | 58.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jonathan Underwood |
| Maintainers | junderw, jl.landabaso |
| Keywords | uint8array, hex, tools |

## Links

- npm: https://www.npmjs.com/package/uint8array-tools
- Repository: https://github.com/bitcoinjs/uint8array-tools
- Homepage: https://github.com/bitcoinjs/uint8array-tools#readme
- Issues: https://github.com/bitcoinjs/uint8array-tools/issues
- npm.io page: https://npm.io/package/uint8array-tools

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 0.0.10 (latest) — 2026-09-07
- 0.0.9 — 2024-08-29
- 0.0.8 — 2024-08-01
- 0.0.7 — 2022-02-21
- 0.0.6 — 2021-10-19
- 0.0.5 — 2021-10-18
- 0.0.4 — 2021-10-18
- 0.0.3 — 2021-10-17
- 0.0.2 — 2021-10-17

## README

# Uint8Array Tools

This library is licensed under MIT.

## Usage

Note: `fromHex` and `compare` mimic the `Buffer.from('ff', 'hex')` and
`buf1.compare(buf2)` API. Their behavior should be the same in the browser
as well as in Node.

```js
import * as uint8arraytools from "uint8array-tools";
uint8arraytools.fromHex("ff");
// Uint8Array(1) [ 255 ]
uint8arraytools.toHex(Uint8Array.from([0xff]));
// 'ff'
uint8arraytools.compare(Uint8Array.from([0xff]), Uint8Array.from([0x01]));
// 1
uint8arraytools.compare(Uint8Array.from([0xff]), Uint8Array.from([0xff]));
// 0
uint8arraytools.compare(Uint8Array.from([0x01]), Uint8Array.from([0xff]));
// -1
uint8arraytools.fromUtf8("tools");
// Uint8Array(5) [ 116, 111, 111, 108, 115 ]
uint8arraytools.toUtf8(Uint8Array.from([116, 111, 111, 108, 115]));
// tools
uint8arraytools.concat([Uint8Array.from([1]), Uint8Array.from([2])]);
// Uint8Array(2) [ 1, 2 ]
uint8arraytools.fromBase64("dG9vbHM=");
// Uint8Array(3) [ 182, 138, 37 ]
uint8arraytools.toBase64(Uint8Array.from([116, 111, 111, 108, 115]));
// dG9vbHM=

const uint8array = new Uint8Array(2);
uint8arraytools.writeUInt16(uint8array, 0, 0xffff - 1, "LE");
uint8array;
// Uint8Array(2) [ 254, 255 ]
uint8arraytools.readUInt16(uint8array, 0, "LE");
// 65534
```

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