Member Junction
    Preparing search index...

    One way of converting between bytes and base64. Every implementation must accept and produce the same strings; Base64Codecs lists them so tests can prove that.

    interface Base64Codec {
        Name: string;
        Decode(base64: string): Uint8Array;
        Encode(bytes: Uint8Array): string;
        IsAvailable(): boolean;
        TryDecode?(base64: string): Uint8Array<ArrayBufferLike> | null;
    }
    Index

    Properties

    Name: string

    Human-readable name, used in diagnostics and tests.

    Methods

    • Decodes base64 that has already passed IsValidBase64. Implementations may assume valid input; the public functions validate first so every implementation fails the same way.

      Parameters

      • base64: string

      Returns Uint8Array

    • Encodes bytes as standard, padded base64 (RFC 4648 §4).

      Parameters

      • bytes: Uint8Array

      Returns string

    • Optional fused validate-and-decode: returns the bytes when base64 passes IsValidBase64, else null — exactly the same accept/reject decision, made more cheaply than a separate character scan. Codecs without it are validated with IsValidBase64.

      Parameters

      • base64: string

      Returns Uint8Array<ArrayBufferLike> | null