MCPcopy Create free account
hub / github.com/Effect-TS/effect / decodeBase64String

Function decodeBase64String

packages/effect/src/SchemaGetter.ts:1365–1379  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1363 * @since 4.0.0
1364 */
1365export function decodeBase64String<E extends string>(): Getter<string, E> {
1366 return transformOrFail((input, options) =>
1367 Result.match(Encoding.decodeBase64String(input), {
1368 onFailure: () =>
1369 Effect.fail(
1370 new SchemaIssue.InvalidValue(
1371 { expected: "a valid Base64 string" },
1372 input,
1373 options
1374 )
1375 ),
1376 onSuccess: Effect.succeed
1377 })
1378 )
1379}
1380
1381/**
1382 * Decodes a URL-safe Base64 string to a `Uint8Array`.

Callers

nothing calls this directly

Calls 2

transformOrFailFunction · 0.70
failMethod · 0.45

Tested by

no test coverage detected