[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Type](https://evolu.dev/docs/api-reference/common/Type) › Uint8ArrayFromBase64

```ts
const Uint8ArrayFromBase64: transform(
  "Uint8ArrayFromBase64",
  Base64,
  Uint8Array,
  {
    from: (value) => ok(base64ToUint8Array(value)),
    to: uint8ArrayToBase64,
  },
);
```

Defined in: [packages/common/src/Type.ts:8892](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/common/src/Type.ts#L8892)

Transforms [Base64](https://evolu.dev/docs/api-reference/common/Type/variables/Base64) text into bytes.

Use it to decode binary fields of JSON and other text payloads, for example
inside an [object](https://evolu.dev/docs/api-reference/common/Type/functions/object). Decoding cannot fail, because Base64 accepts only
the canonical encoding of some bytes. Encoding returns that canonical text,
so equal bytes encode to equal strings.

### Example

```ts
import {
  assertEqual,
  assertErr,
  assertOk,
  Uint8ArrayFromBase64,
} from "@evolu/common";

const bytes = Uint8ArrayFromBase64.fromUnknown("AAEC/w==");
assertOk(bytes, new Uint8Array([0, 1, 2, 255]));
assertEqual(Uint8ArrayFromBase64.to(bytes.value), "AAEC/w==");

assertErr(Uint8ArrayFromBase64.fromUnknown("AAEC/w"), {
  type: "Base64",
  value: "AAEC/w",
});
```