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

@webassemblyjs/utf8

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webassemblyjs/utf8

UTF8 encoder/decoder for WASM

  • 1.14.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24M
increased by3.26%
Maintainers
1
Weekly downloads
 
Created

What is @webassemblyjs/utf8?

@webassemblyjs/utf8 is a utility package for encoding and decoding UTF-8 strings in the context of WebAssembly. It provides functions to convert between UTF-8 byte arrays and JavaScript strings, which is useful when dealing with WebAssembly text format (WAT) or binary format (WASM).

What are @webassemblyjs/utf8's main functionalities?

Encode a string to UTF-8

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

const { encode } = require('@webassemblyjs/utf8');
const utf8Array = encode('Hello, WebAssembly!');
console.log(utf8Array);

Decode a UTF-8 byte array to a string

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

const { decode } = require('@webassemblyjs/utf8');
const utf8Array = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121, 33]);
const str = decode(utf8Array);
console.log(str);

Other packages similar to @webassemblyjs/utf8

FAQs

Package last updated on 06 Nov 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