From io.Reader to string in Go

后端 未结 7 1197
生来不讨喜
生来不讨喜 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.

提交回复
热议问题