# @lingcz/utf8

> a js encode and decode utf8 lib

Latest version **2.1.0** (published 2022-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lingcz/utf8
pnpm add @lingcz/utf8
yarn add @lingcz/utf8
bun add @lingcz/utf8
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2022-04-28 |
| First published | 2021-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lingchenzheng |
| Maintainers | lingcz |
| Keywords | utf8, js, encode, decode |

## Links

- npm: https://www.npmjs.com/package/@lingcz/utf8
- Repository: https://github.com/lingchenzheng/common
- Homepage: https://github.com/lingchenzheng/common#readme
- Issues: https://github.com/lingchenzheng/common/issues
- npm.io page: https://npm.io/package/@lingcz/utf8

## Dependencies (1)

- [@lingcz/shared](https://npm.io/package/@lingcz/shared.md) ^1.1.0

## Recent versions

- 2.1.0 (latest) — 2022-04-28
- 2.0.4 — 2021-06-14
- 2.0.3 — 2021-06-12
- 2.0.2 — 2021-05-04
- 2.0.1 — 2021-05-04
- 2.0.0 — 2021-05-04
- 1.0.2 — 2021-03-08
- 1.0.1 — 2021-03-08
- 1.0.0 — 2021-03-07

## README

# `@lingcz/utf8`

## Usage

```javascript
const utf8 = require('@lingcz/utf8')
const str = 'I love 中国'
const result = utf8.encode(str)
/*
{
  hexStr: '49206c6f766520e4b8ade59bbd',
  buffer: ArrayBuffer {
    [Uint8Contents]: <49 20 6c 6f 76 65 20 e4 b8 ad e5 9b bd>,
    byteLength: 13
  },
  bytes: [
     73,  32, 108, 111, 118,
    101,  32, 228, 184, 173,
    229, 155, 189
  ]
}
*/

const originStr = utf8.decode(result.hexStr)
const originStr = utf8.decode(result.buffer)
const originStr = utf8.decode(result.bytes)

// 'I love 中国'
```

---
_Source: https://npm.io/package/@lingcz/utf8 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
