uint8-encoding
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Uint8 Encoding

Uint8 encoding, a simple way to convert strings to Uint8Arrays and vice versa.

Features

It's just a simple wrapper around TextEncoder and TextDecoder, but it provides a cleaner API and it handles nuances like the BOM character for you.

Install

npm install --save uint8-encoding

Usage

import U8 from 'uint8-encoding';

const raw = 'Hello 😃';
const encoded = U8.encode ( raw );
console.log ( encoded ); // => Uint8Array(10) [72, 101, 108, 108, 111,  32, 240, 159, 152, 131]

const decoded = U8.decode ( encoded );
console.log ( decoded ); // => 'Hello 😃'

License

MIT © Fabio Spampinato

Package Sidebar

Install

npm i uint8-encoding

Weekly Downloads

390

Version

2.0.0

License

none

Unpacked Size

4.32 kB

Total Files

9

Last publish

Collaborators

  • fabiospampinato