topgun-textencoder
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

topgun-textencoder

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

semantic-release 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

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

Package Sidebar

Install

npm i topgun-textencoder

Weekly Downloads

6

Version

1.0.1

License

MIT

Unpacked Size

6.88 kB

Total Files

12

Last publish

Collaborators

  • ivkan