Reaves.dev

v0.1.0

built using

Phoenix v1.7.12

Golang Base64

Stephen M. Reaves

::

2022-07-22

How to encode/decode using base64 in golang

Snippets

func Decode(s string) ([]byte, error) {
    decoded, err := base64.StdEncoding.DecodeString(s)
    return decoded, err
}
func Encode(b []byte) string {
    return base64.StdEncoding.EncodeToString(b)
}