toUtf8String

Learn about the toUtf8String utils method

Introduction

The toUtf8String method is used to convert a byte array to its equivalent string representation.

Usage

This method should be used when you want to convert a byte array to its equivalent string representation. For example, you can use this method to convert the byte array [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] to its equivalent string representation.

Here's a simple code example to demonstrate how to use this method:

const { Utils } = require("alchemy-sdk");

let utf8Bytes = [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100];

let message = Utils.toUtf8String(utf8Bytes); 
console.log(message); // 'Hello World'
ReadMe