🔓 Decodes a Base64 string to bytes.

Syntax

TypeScript
import { bytesToString, decodeBase64 } from '@opentf/std';

decodeBase64(str: string): Uint8Array

Parameters

  • str: The Base64 string to decode.

Returns

The decoded bytes.

Examples

TypeScript
decodeBase64('SGVsbG8=') //=> Uint8Array [72, 101, 108, 108, 111]

For text, compose with bytesToString:

TypeScript
bytesToString(decodeBase64('SGVsbG8=')) //=> 'Hello'
Last updated on
Edit this page