def from_base64
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytesimport Base
760# Padded base64 (RFC 4648 §4) to bytes. None for a length that is not a multiple of 4,
761# more than two '=', '=' before the end, or a char outside the alphabet.
762def from_base64(+s: String) -> Maybe<&1, Bytes>:
763 +n = count(s, 0)
764 +pads = b64.pads(s, 0)
765 unb64.if(Bool.and(U32.is_eq((n .&. 3 : U32), 0), U32.is_le(pads, 2)), s, n, pads)