How to create a Reader from a string in Go?

In Go, how to create a Reader from a string? Many APIs use a Reader as its input.

asked Aug 3, 2016 by anonymous

1 Answer

In Go, the

strings.NewReader(s)

library function creates a Reader from a string.

Check the doc at: https://golang.org/pkg/strings/#NewReader

answered Oct 10, 2016 by Eric Z Ma (44,280 points)
How to convert a byte[] to io.Reader in Go? asked Jan 30, 2017 by anonymous

Please log in or register to answer this question.

Related questions

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...