Skip to content

Instantly share code, notes, and snippets.

@ogiovannyoliveira
Created April 14, 2020 17:05
Show Gist options
  • Save ogiovannyoliveira/16f8ba7f4bbcb45b75c29cd4017cda6e to your computer and use it in GitHub Desktop.
Save ogiovannyoliveira/16f8ba7f4bbcb45b75c29cd4017cda6e to your computer and use it in GitHub Desktop.
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment