Search results

There are no results.

std.base64.decode

Show source code
Hide source code
fn pub decode(input: ref ByteArray) -> Result[ByteArray, DecodeError] {
  let plain = ByteArray.new

  try Decoder.new.decode(input, plain)
  Result.Ok(plain)
}
fn pub static decode(input: ref ByteArray) -> Result[ByteArray, DecodeError]

Decodes a base64 encoded ByteArray into a raw ByteArray.

This method uses the standard base64 alphabet and expects padding to be applied if necessary. For more control over the decoding process, use the Decoder type directly.

Examples

import std.base64 (decode)

decode('aGVsbG8gd29ybGQ='.to_byte_array)
  .or_panic('failed to decode the input')
  .to_string # => 'hello world'