🔠 Converts a string to a Uint8Array of bytes.

Syntax

TypeScript
import { stringToBytes } from '@opentf/std';

stringToBytes(str: string): Uint8Array

Parameters

  • str: The string to convert.

Returns

The byte array.

Examples

TypeScript
stringToBytes('Hello') //=> Uint8Array [72, 101, 108, 108, 111]
Last updated on
Edit this page