This Commented CUE
demonstrates how to use the built-in function
encoding/base64.Decode
to decode data that is encoded as Base64.
file.cue
package example
import "encoding/base64"
// encoded contains some Base64-encoded data
encoded: "c29tZSBCYXNlNjQtZW5jb2RlZCBkYXRh"
// decoded contains the string interpolation of
// the byte array returned by base64.Decode
decoded: "\(base64.Decode(null, encoded))"
TERMINAL
$ cue export
{
"encoded": "c29tZSBCYXNlNjQtZW5jb2RlZCBkYXRh",
"decoded": "some Base64-encoded data"
}
Related content
- The
encoding/base64
built-in package