Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

text-decoder

Package Overview
Dependencies
Maintainers
2
Versions
6
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

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2M
increased by7.68%
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 18 Oct 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