std.base64
Types
type Base64Decoder = Base64Decoder
type Base64Encoder = Base64Encoder
struct DecodeBase64Error
enum Mode
Functions
decode
pub fn decode(str: string, mode: Mode = Mode.Standard): Bytes throws DecodeBase64Error
[src]
pub fn decode(str: string, mode: Mode = Mode.Standard): Bytes throws DecodeBase64Error {
return try _base64.decode(str, mode as int);
}
Base64 decoded a base64 string to std.io.Bytes
.
decode
pub fn decode(str: string, mode: Mode = Mode.Standard): Bytes throws DecodeBase64Error
[src]
pub fn decode(str: string, mode: Mode = Mode.Standard): Bytes throws DecodeBase64Error {
return try _base64.decode(str, mode as int);
}
Base64 decoded a base64 string to std.io.Bytes
.
Base64 decoded a base64 string to std.io.Bytes
.
If the input string is not a valid Base64 string, throw error.
Example
nv
use std.base64.decode;
assert_eq try! decode("aGVsbG8gd29ybGQ="), b"hello world";
[src]
pub fn encode(value: Bytes, mode: Mode = Mode.Standard): string {
return _base64.encode(value, mode as int);
}
Base64 encode to string.
[src]
pub fn encode(value: Bytes, mode: Mode = Mode.Standard): string {
return _base64.encode(value, mode as int);
}
Base64 encode to string.
Base64 encode to string.
Example
nv
use std.base64.{encode, Mode};
assert_eq encode(b"hello world"), "aGVsbG8gd29ybGQ=";
assert_eq encode(b"hello world", mode: Mode.URLSafeNoPadding), "aGVsbG8gd29ybGQ";
assert_eq encode(b"hello world", mode: Mode.StandardNoPadding), "aGVsbG8gd29ybGQ";