Hyperlinkv0.8.0-beta.28

SchemaTransformation

SchemaTransformation.stringFromBase64UrlStringconsteffect/SchemaTransformation.ts:1512
Transformation<string, string, never, never>

Decodes a base64 (URL) encoded string into a UTF-8 string and encodes it back.

When to use

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

Details

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

Example (Converting Base64Url to a string)

import { Schema, SchemaTransformation } from "effect"

const schema = Schema.String.pipe(
  Schema.decodeTo(Schema.String, SchemaTransformation.stringFromBase64UrlString)
)
export const stringFromBase64UrlString: Transformation<string, string> = new Transformation(
  SchemaGetter.decodeBase64UrlString(),
  SchemaGetter.encodeBase64Url()
)
Referenced by 1 symbols