From io.Reader to string in Go

后端 未结 7 1182
生来不讨喜
生来不讨喜 2020-12-04 05:58

I have an io.ReadCloser object (from an http.Response object).

What\'s the most efficient way to convert the entire stream to a strin

相关标签:
7条回答
  • 2020-12-04 06:50

    I like the bytes.Buffer struct. I see it has ReadFrom and String methods. I've used it with a []byte but not an io.Reader.

    0 讨论(0)
提交回复
热议问题