Standard library / encoding/base32
encoding/base32.NewDecoder()
Convert a Base32-encoded reader into a decoded byte stream using a matching alphabet and padding configuration. Expected stdout: 'Go\n'.
Formal Syntax & Structure
go syntaxgo
func NewDecoder(enc *Encoding, r io.Reader) io.ReaderParameters & Attributes
| Name | Type | Description |
|---|---|---|
| enc | *Encoding | Base32 alphabet and padding configuration. |
| r | io.Reader | Reader supplying encoded data. |
Return Value
io.Reader
Reader wrapping the input.
Working Example
Example Snippetgo
package main
import ( "encoding/base32" "fmt" "io" "strings")
func must(e error) { if e != nil { panic(e) }}
func main() { v, err := io.ReadAll(base32.NewDecoder(base32.StdEncoding, strings.NewReader("I5XQ===="))) must(err) fmt.Println(string(v))}