An open API service indexing awesome lists of open source software.

https://github.com/topgunbuild/textencoder

An isomorphic TextEncoder for Javascript in Node and the browser
https://github.com/topgunbuild/textencoder

browser decode encode isomorphic nodejs textencoder

Last synced: about 1 year ago
JSON representation

An isomorphic TextEncoder for Javascript in Node and the browser

Awesome Lists containing this project

README

          

✨ @topgunbuild/textencoder


An isomorphic TextEncoder for Javascript in Node and the browser, used in TopGun



npm


bundlephobia


License: MIT

## 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

```bash
npm install @topgunbuild/textencoder
```

## Usage

```javascript
const textencoder = require('@topgunbuild/textencoder')
// or
import textencoder from '@topgunbuild/textencoder';

textencoder.encode('Hello') // Uint8Array [ 72, 101, 108, 108, 111 ]
```

## License

MIT