utf8-uint8array

Conversion between utf8 string and uint8array

Usage no npm install needed!

<script type="module">
  import utf8Uint8array from 'https://cdn.skypack.dev/utf8-uint8array';
</script>

README

utf8-uint8array

Installation

npm install utf8-uint8array

or

yarn add utf8-uint8array

Encode UTF-8 string as Uint8Array

import { toBytes } from "utf8-uint8array";

const bytes: Uint8Array = toBytes("Привет 🌎");

Decode Uint8Array as UTF-8 string

import { fromBytes } from "utf8-uint8array";

const bytes: Uint8Array;

const string: string = fromBytes(bytes);