Golang encoding/base64.NewEncoder function example

package encoding/base64

NewEncoder returns a new base64 stream encoder. Data written to the returned writer will be encoded using enc(1st parameter) and then written to w(2nd parameter). Base64 encodings operate in 4-byte blocks; when finished writing, the caller must Close the returned encoder to flush any partially written blocks.

Golang encoding/base64.NewEncoder function usage example

 b := &bytes.Buffer{}
 e := base64.NewEncoder(base64.StdEncoding, b)

References :

http://golang.org/pkg/encoding/base64/#NewEncoder

https://www.socketloop.com/references/golang-encoding-base32-newencoder-function-examples

  See also : Golang encoding/base32.NewEncoder function examples

Advertisement