Skip to content

encoding/Base64: use Buffer when native Uint8Array base64 is unavailable #10807

Done

Description

@anatolzak

What is the problem this feature would solve?

Base64.decode and Base64.encode use Uint8Array.fromBase64 and Uint8Array.prototype.toBase64 only when they exist. They don't exist in Node 24, so Effect falls back to a JavaScript loop. Everything built on it pays for that loop, including S.Uint8ArrayFromBase64.

For a 256-byte value (base64-repro.mjs):

Effect Buffer
Decode 655 ns 128 ns
Encode 411 ns 121 ns

What is the feature you are proposing to solve the problem?

Use the native Uint8Array methods when present, then Buffer when globalThis.Buffer exists (Node, Bun, Deno), then the current loop.

What alternatives have you considered?

Calling Buffer directly in application code. That doesn't help code paths that go through Effect, such as S.Uint8ArrayFromBase64.

Activity

  1. added
    enhancement
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions