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() }