std.base64.encode
Show source codeHide source code
fn pub encode(input: ref ByteArray) -> String {
let base64 = ByteArray.new
Encoder.new.encode(input, base64)
base64.into_string
}
fn pub static encode(input: ref ByteArray) -> String
Encodes a ByteArray
as a base64 encoded String
.
This method uses the standard base64 alphabet and applies padding. For more
control over the encoding process, use the Encoder
type directly.
Examples
import std.base64 (encode)
encode('hello world'.to_byte_array) # => 'aGVsbG8gd29ybGQ='