utf8-binary

A fast UTF-8 encoding and decoding.

Usage no npm install needed!

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

README

utf8-binary

A fast UTF-8 encoding and decoding.

npm GitHub license Build Status Coverage Status

Future works (not implemented yet)

  • Web browsers

Installation

# npm
npm install utf8-binary

# yarn
yarn add utf8-binary

Usage

const { utf8toBin, binToUtf8 } = require('utf8-binary');

const bin = utf8toBin('\u0080'); // '\xc2\x80'

const buf = Buffer.from(bin, 'binary');
binToUtf8(buf, 0, buf.length); // '\u0080'

Tests

Run tests as follows:

npm run test

License

Copyright © 2018-present Alex Masterov <alex.masterow@gmail.com>

utf8-binary is licensed under MIT and can be used for any personal or commercial project.