Hyperlinkv0.8.0-beta.28

SchemaTransformation

SchemaTransformation.stringFromHexStringconsteffect/SchemaTransformation.ts:1546
Transformation<string, string, never, never>

Decodes a hex 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 hexadecimal strings.

Details

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

Example (Converting hex to a string)

import { Schema, SchemaTransformation } from "effect"

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