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

@zxing/text-encoding

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

@zxing/text-encoding

Polyfill for the Encoding Living Standard's API.

  • 0.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
decreased by-4.05%
Maintainers
2
Weekly downloads
 
Created

What is @zxing/text-encoding?

The @zxing/text-encoding npm package provides a polyfill for the TextEncoder and TextDecoder APIs, which are part of the Encoding Living Standard. These APIs allow for efficient encoding and decoding of text in various character encodings, such as UTF-8, UTF-16, and more. This package is particularly useful for environments where these APIs are not natively supported, such as older browsers or certain Node.js versions.

What are @zxing/text-encoding's main functionalities?

Text Encoding

This feature allows you to encode a string into a Uint8Array using a specified encoding, such as UTF-8. The code sample demonstrates how to encode the string 'Hello, world!' into a UTF-8 encoded Uint8Array.

"use strict";\nconst { TextEncoder } = require('@zxing/text-encoding');\nconst encoder = new TextEncoder('utf-8');\nconst encoded = encoder.encode('Hello, world!');\nconsole.log(encoded);

Text Decoding

This feature enables decoding of Uint8Array or ArrayBuffer data into a string using a specified encoding, such as UTF-8. The code sample shows how to decode a UTF-8 encoded Uint8Array back into the string 'Hello, world!'.

"use strict";\nconst { TextDecoder } = require('@zxing/text-encoding');\nconst decoder = new TextDecoder('utf-8');\nconst decoded = decoder.decode(new Uint8Array([72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33]));\nconsole.log(decoded);

Other packages similar to @zxing/text-encoding

Keywords

FAQs

Package last updated on 03 Aug 2020

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