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

web-encoding

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-encoding

TextEncoder and TextDecoder APIs from Encoding Standard APIs in a universal package

  • 1.1.2
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-25.33%
Maintainers
2
Weekly downloads
 
Created

What is web-encoding?

The web-encoding package provides a polyfill for the TextEncoder and TextDecoder interfaces, which are part of the Encoding Living Standard. These interfaces allow for high-performance encoding and decoding of text in various character encodings, primarily UTF-8.

What are web-encoding's main functionalities?

Text Encoding

This feature allows you to encode a JavaScript string into a Uint8Array of bytes using UTF-8 encoding. It is useful for preparing text data for network transmission or storage.

const { TextEncoder } = require('web-encoding');
const encoder = new TextEncoder();
const encoded = encoder.encode('Hello, world!');
console.log(encoded);

Text Decoding

This feature enables decoding of a Uint8Array of bytes into a JavaScript string using UTF-8 or other supported character encodings. It is essential for reading text data received from a network or read from binary storage.

const { TextDecoder } = require('web-encoding');
const decoder = new TextDecoder('utf-8');
const decoded = decoder.decode(new Uint8Array([72, 101, 108, 108, 111]));
console.log(decoded);

Other packages similar to web-encoding

Keywords

FAQs

Package last updated on 30 Mar 2021

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