Base64Impl.encode

Encodes source to newly-allocated buffer.

This convenience method alleviates the need to manually manage output buffers.

  1. char[] encode(R1 source, R2 buffer)
  2. char[] encode(R1 source, R2 buffer)
  3. size_t encode(const(E)[] source, R range)
  4. size_t encode(R1 source, R2 range)
  5. char[] encode(Range source)
    template Base64Impl(char Map62th, char Map63th, char Padding = '=')
    @safe pure
    char[]
    encode
    (
    Range
    )
    (
    Range source
    )
    if (
    isArray!Range &&
    is(ElementType!Range : ubyte)
    )
  6. char[] encode(Range source)

Parameters

source Range

The input range to encode.

Return Value

Type: char[]

A newly-allocated char[] buffer containing the encoded string.

Examples

ubyte[] data = [0x1a, 0x2b, 0x3c, 0x4d, 0x5d, 0x6e];
assert(Base64.encode(data) == "Gis8TV1u");

Meta