Golang EncodeToString()

Encodes a string in base64 format.

Function

func (enc *Encoding) EncodeToString(src []byte) string

Parameters

src - The String to be encoded

Return value

EncodeToString returns the base64 encoding of src.

Example

package main
import b64 "encoding/base64"

func main() {
data := "base64 encoded string"
sEnc := b64.StdEncoding.EncodeToString([]byte(data))
}

Github

See also: