Base64 in Go

From NovaOrdis Knowledge Base
Revision as of 01:53, 13 March 2024 by Ovidiu (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

Overview

Decoding

base64EncodedStr := "..."
data, err := base64.StdEncoding.DecodeString(base64EncodedStr)
if err != nil {
    ...
}
s := string(data)

Encoding

base64EncodedStr := base64.StdEncoding.EncodeToString([]byte(str))