Add util method for encoding
This commit is contained in:
parent
b56ebf3c3d
commit
82f5960973
1 changed files with 17 additions and 0 deletions
17
utils/encoding.go
Normal file
17
utils/encoding.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
func Base64DecodeString(s string) []byte {
|
||||
b, err := base64.StdEncoding.DecodeString(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func BytesToBase64(b []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(b)
|
||||
}
|
Loading…
Add table
Reference in a new issue