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
- Host: GitHub
- URL: https://github.com/topgunbuild/textencoder
- Owner: TopGunBuild
- License: mit
- Created: 2023-06-09T06:09:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-25T13:09:51.000Z (over 2 years ago)
- Last Synced: 2025-03-03T04:49:05.210Z (about 1 year ago)
- Topics: browser, decode, encode, isomorphic, nodejs, textencoder
- Language: TypeScript
- Homepage:
- Size: 186 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
✨ @topgunbuild/textencoder
An isomorphic TextEncoder for Javascript in Node and the browser, used in TopGun
## 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