# text-decoder

> Streaming text decoder that preserves multibyte Unicode characters

Latest version **1.2.7** (published 2026-02-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install text-decoder
pnpm add text-decoder
yarn add text-decoder
bun add text-decoder
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.2.7 |
| Published | 2026-02-16 |
| First published | 2023-08-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Holepunch |
| Maintainers | mafintosh, kasperisager |

## Links

- npm: https://www.npmjs.com/package/text-decoder
- Repository: https://github.com/holepunchto/text-decoder
- Homepage: https://github.com/holepunchto/text-decoder#readme
- Issues: https://github.com/holepunchto/text-decoder/issues
- npm.io page: https://npm.io/package/text-decoder

## Dependencies (1)

- [b4a](https://npm.io/package/b4a.md) ^1.6.4

## Recent versions

- 1.2.7 (latest) — 2026-02-16
- 1.2.6 — 2026-02-13
- 1.2.5 — 2026-02-13
- 1.2.4 — 2026-02-13
- 1.2.3 — 2024-12-14
- 1.2.2 — 2024-12-06
- 1.2.1 — 2024-10-18
- 1.2.0 — 2024-09-12
- 1.1.1 — 2024-07-08
- 1.1.0 — 2024-04-25
- 1.0.1 — 2023-08-15
- 1.0.0 — 2023-08-15

## README

# text-decoder

Streaming text decoder that preserves multibyte Unicode characters.

```
npm i text-decoder
```

## Usage

```js
const TextDecoder = require('text-decoder')

const td = new TextDecoder()

td.push(Buffer.of(0xf0, 0x9f, 0x92)) // returns ''
td.push(Buffer.of(0xa9)) // returns '💩'
```

## API

#### `const td = new TextDecoder([encoding])`

Create a text decoder. `encoding` defaults to `utf8`.

#### `const string = td.push(data)`

Push either a `Buffer` or a `string` to the text decoder. Returns the decoded string, buffering any partial data.

#### `const string = td.end([data])`

End the decoder, optionally pushing a final piece of data. Returns the decoded string.

## License

Apache-2.0

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