-
-
Save baodinh/8b40831acfc05a2c9350677a4081d8bb to your computer and use it in GitHub Desktop.
Convert data:image/png;base64,iVBORw0KGgoAAA to []byte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func streamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
// pass reader to NewDecoder | |
dec := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64string[i+1:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment