Socket
Socket
Sign inDemoInstall

@smithy/util-utf8

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/util-utf8

A UTF-8 string <-> UInt8Array converter


Version published
Weekly downloads
39M
increased by7.48%
Maintainers
2
Weekly downloads
 
Created

What is @smithy/util-utf8?

@smithy/util-utf8 is a utility package for handling UTF-8 encoding and decoding in JavaScript. It provides functions to convert strings to UTF-8 byte arrays and vice versa, which can be useful in various scenarios such as data serialization, network communication, and file handling.

What are @smithy/util-utf8's main functionalities?

UTF-8 Encoding

This feature allows you to encode a string into a UTF-8 byte array. The `toUtf8` function takes a string as input and returns a Uint8Array representing the UTF-8 encoded bytes.

const { toUtf8 } = require('@smithy/util-utf8');
const utf8Bytes = toUtf8('Hello, world!');
console.log(utf8Bytes);

UTF-8 Decoding

This feature allows you to decode a UTF-8 byte array back into a string. The `fromUtf8` function takes a Uint8Array as input and returns the decoded string.

const { fromUtf8 } = require('@smithy/util-utf8');
const utf8Bytes = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33]);
const decodedString = fromUtf8(utf8Bytes);
console.log(decodedString);

Other packages similar to @smithy/util-utf8

FAQs

Package last updated on 10 May 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