topgun-textencoder
v1.0.1
Published
An isomorphic encode/decode Uint8Arrays to strings for Javascript in Node and the browser
Downloads
173
Maintainers
Readme
What?
Encode/decode Uint8Arrays to strings.
This is just a thin wrapper that provides an isomorphic API.
- To perform UTF8 conversion in the browser it uses the native TextEncoder.
- In Node it uses Buffer and Uint8Array.
Install
npm install topgun-textencoder
Usage
const textencoder = require('topgun-textencoder')
// or
import textencoder from 'topgun-textencoder';
textencoder.encode('Hello') // Uint8Array [ 72, 101, 108, 108, 111 ]
License
MIT