View source code
Display the source code in std/base64.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Module std.base64
Encoding / Decoding Base64
format.
Implemented according to RFC 4648 - The Base16.
Example
ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; const(char)[] encoded = Base64.encode(data); assert(encoded == "FPucA9l+"); ubyte[] decoded = Base64.decode("FPucA9l+"); assert(decoded == [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]);
Support Range interface using Encoder / Decoder.
Example
// Create MIME Base64 with CRLF, per line 76. File f = File("./text.txt", "r"); scope(exit) f.close(); Appender!string mime64 = appender!string; foreach (encoded; Base64.encoder(f.byChunk(57))) { mime64.put(encoded); mime64.put("\r\n"); } writeln(mime64.data);
Classes
Name | Description |
---|---|
Base64Exception
|
Exception thrown on Base64 errors.
|
Templates
Name | Description |
---|---|
Base64Impl
|
Core implementation for Base64 format.
|
Aliases
Name | Type | Description |
---|---|---|
Base64
|
The Base64
|
|
Base64URL
|
The "URL and Filename safe" Base64
|
Authors
Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)