Skip to content
FutureBlitz

    Install

    Import std.text.encoding

    Base64

    std.text.encoding

    struct

    Public Struct Base64

    Base64, which writes bytes as text of 64 characters and back: each 3 bytes as 4 characters of "A" to "Z", "a" to "z", "0" to "9", "+", and "/", or "-" and "_" for those two in its URL-safe form, which URLs and file names can hold, and "=" filling out the last 4.

    Examples

    Expect(Base64.Encode("hi!".Bytes) == "aGkh")
    Expect(Base64.Decode("aGkh") == "hi!".Bytes)
    Expect(Base64.Decode("not base64!") == Null)

    std/text/encoding.fb, line 245

    • Public Static Method Encode(bytes: UInt8[], urlSafe: Bool = False, padding: Bool = True): String static method #

      bytes as Base64, URL-safe when urlSafe says, and filled out with "=" when padding says.

    • Public Static Method Decode(text: String, urlSafe: Bool = False): UInt8[]? static method #

      The bytes Base64 text holds, in its URL-safe form when urlSafe says, with "=" filling out its end or not, or Null when it isn't Base64.

    Report an issue with this page or with FutureBlitz on GitHub.