uint8array-tools
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

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.

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

Readme

Keywords

Package Sidebar

Install

npm i uint8array-tools

Weekly Downloads

20,463

Version

0.0.7

License

MIT

Unpacked Size

9.58 kB

Total Files

8

Last publish

Collaborators

  • junderw