JSPM

uint8-encoding

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5553
  • Score
    100M100P100Q169648F
  • License MIT

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

Package Exports

  • uint8-encoding

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (uint8-encoding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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