effect-io-ai

Package: effect
Module: SchemaTransformation

SchemaTransformation.stringFromBase64String

Decodes a Base64-encoded string into a UTF-8 string and encodes a UTF-8 string back to a Base64 string.

When to use

Use when you need a schema transformation for text data transmitted as Base64 strings.

Details

Decoding parses the Base64 string into a UTF-8 string. Encoding writes the string as a Base64 string.

Example (Converting Base64 to a string)

import { Schema, SchemaTransformation } from "effect"

const schema = Schema.String.pipe(
  Schema.decodeTo(Schema.String, SchemaTransformation.stringFromBase64String)
)

See

Signature

declare const stringFromBase64String: Transformation<string, string, never, never>

Source

Since v4.0.0