Skip to content

Instantly share code, notes, and snippets.

View ric-v's full-sized avatar
🖖
Breating under water

Richie Varghese ric-v

🖖
Breating under water
View GitHub Profile
@ric-v
ric-v / decoder.go
Created April 14, 2022 10:05
decode and save PNG to file
// decode the content and save to storage path location
func decodeAndSave(content, storagePath string, w http.ResponseWriter) {
// decode the payload content
data, err := base64.StdEncoding.DecodeString(string(content))
if err != nil {
fmt.Fprintf(w, "An error happened while decoding base64")
fmt.Println(err)
return
}