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

@sinonjs/text-encoding

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinonjs/text-encoding

Polyfill for the Encoding Living Standard's API.

  • 0.7.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5M
increased by4.3%
Maintainers
6
Weekly downloads
 
Created

What is @sinonjs/text-encoding?

The @sinonjs/text-encoding npm package is a polyfill for the Encoding Living Standard's API, designed to provide text encoding and decoding functionalities in environments where these APIs might not be available natively. It allows for the conversion between binary data and text using various character encodings.

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

Encoding text

This feature allows you to encode a string into a Uint8Array using a specific encoding, typically UTF-8. The code sample demonstrates how to encode the string 'Hello World' into a Uint8Array.

"use strict";\nconst { TextEncoder } = require('@sinonjs/text-encoding');\nlet encoder = new TextEncoder();\nlet uint8Array = encoder.encode('Hello World');\nconsole.log(uint8Array);

Decoding text

This feature enables the decoding of binary data (Uint8Array) into a string using a specific character encoding. The code sample shows how to decode a Uint8Array back into the string 'Hello'.

"use strict";\nconst { TextDecoder } = require('@sinonjs/text-encoding');\nlet decoder = new TextDecoder();\nlet text = decoder.decode(new Uint8Array([72, 101, 108, 108, 111]));\nconsole.log(text);

Other packages similar to @sinonjs/text-encoding

Keywords

FAQs

Package last updated on 19 Aug 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