subjson and multidomain
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package util
|
||||
|
||||
import "encoding/base64"
|
||||
|
||||
// Function to return decoded bytes if a string is Base64 encoded
|
||||
func StrOrBase64Encoded(str string) string {
|
||||
decoded, err := base64.StdEncoding.DecodeString(str)
|
||||
if err == nil {
|
||||
return string(decoded)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
func B64StrToByte(str string) ([]byte, error) {
|
||||
return base64.StdEncoding.DecodeString(str)
|
||||
}
|
||||
|
||||
func ByteToB64Str(b []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(b)
|
||||
}
|
||||
Reference in New Issue
Block a user