Golang encoding/base64.Encoding.DecodedLen function examples

package encoding/base64

DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of base64-encoded data.

Golang encoding/base64.Encoding.DecodedLen function usage examples

Example 1 :

 bigmap = make([]byte, base64.StdEncoding.DecodedLen(4096*2))

Example 2 :

 value = "abcd"
 decoded := make([]byte, base64.URLEncoding.DecodedLen(len(value)))

References :

http://golang.org/pkg/encoding/base64/#Encoding.DecodedLen

Advertisement