MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeUint8ArrayTransformation

Function makeUint8ArrayTransformation

packages/effect/src/Schema.ts:6244–6261  ·  view source on GitHub ↗
(
  id: string,
  decode: (s: string) => either_.Either<Uint8Array, Encoding.DecodeException>,
  encode: (u: Uint8Array) => string
)

Source from the content-addressed store, hash-verified

6242}
6243
6244const makeUint8ArrayTransformation = (
6245 id: string,
6246 decode: (s: string) => either_.Either<Uint8Array, Encoding.DecodeException>,
6247 encode: (u: Uint8Array) => string
6248) =>
6249 transformOrFail(
6250 String$.annotations({ description: "a string to be decoded into a Uint8Array" }),
6251 Uint8ArrayFromSelf,
6252 {
6253 strict: true,
6254 decode: (i, _, ast) =>
6255 either_.mapLeft(
6256 decode(i),
6257 (decodeException) => new ParseResult.Type(ast, i, decodeException.message)
6258 ),
6259 encode: (a) => ParseResult.succeed(encode(a))
6260 }
6261 ).annotations({ identifier: id })
6262
6263/**
6264 * Decodes a base64 (RFC4648) encoded string into a `Uint8Array`.

Callers 1

Schema.tsFile · 0.85

Calls 4

transformOrFailInterface · 0.85
decodeFunction · 0.70
encodeFunction · 0.70
annotationsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…