Explorer

std.base64-to-bytes

description
Decode Base64 or Base64URL (with or without padding). none if it is not Base64
type
Fn(text: String) -> Union{#none, #some(List<Number>)}
expression
fn(text$0) =>
  let codes$1 = @core.string-to-bytes(value: $0);
  let length$2 = @std.base64-unpadded-length(codes: $1, length: @core.list-length(value: $1));
  @std.base64-groups(
    codes: $1,
    length: $2,
    start: 0,
    end: @core.divide(left: @core.plus(left: $2, right: 3), right: 4)
  )
visibility
public
std.base64-to-bytes (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: NZkYM140uGys54xvJ4A9BU-fBhcrLYNfBlQSwv9fMnY
content hash: BYMze_3tRYqmYTObFc9p0mE6Tk8Om0Qpmzm9lMW-Bgo