Documentation ¶
Overview ¶
base64 supports Base64 encoding and decoding.
Index ¶
- Constants
- func Decode(input []byte) ([]byte, error)
- func DecodeGunzip(encoded string) ([]byte, error)
- func DecodeGunzipJSON(encoded string, output any) error
- func EncodeGzip(data []byte, compressLevel int) (string, error)
- func EncodeGzipJSON(data any, compressLevel int) (string, error)
- func IsValid(input []byte) bool
- func IsValidString(input string) bool
- func Pad(encoded string) string
- func ReadAll(r io.Reader) ([]byte, error)
- func StripPadding(str string) string
Constants ¶
View Source
const ( // RxCheckMore is from https://stackoverflow.com/a/8571649/1908967 RxCheckMore = `^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$` RxCheckSimple = `^[0-9A-Za-z/\+]*=*$` RxCheckNoPadding = `^[0-9A-Za-z/\+]*$` )
Variables ¶
This section is empty.
Functions ¶
func DecodeGunzip ¶
DecodeGunzip base64 decodes a string with optional gzip uncompression.
func DecodeGunzipJSON ¶
DecodeGunzipJSON base64 decodes a string with optoinal gunzip uncompression and then unmarshals the data to a struct.
func EncodeGzip ¶
Encode with optional gzip compression. 0 = no compression. 9 = best compression.
func EncodeGzipJSON ¶
EncodeGzipJSON encodes a struct that is JSON encoded.
func IsValidString ¶
func ReadAll ¶
ReadAll provides an interface like `io.ReadAll` with optional base64 decoding. It is useful for decoding `*http.Response.Body`.
func StripPadding ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.