Socket
Socket
Sign inDemoInstall

text-decoder

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-decoder

Streaming text decoder that preserves multibyte Unicode characters


Version published
Weekly downloads
4M
decreased by-9.48%
Maintainers
2
Weekly downloads
 
Created
Source

text-decoder

Streaming text decoder that preserves multibyte Unicode characters.

npm i text-decoder

Usage

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

FAQs

Package last updated on 08 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc