hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit dcea0fa5ce125d1a9009b5e5b8a38f00c57bcee9
parent 2cb89a523a7bc7302620f400b2829e5d73cf477d
Author: spf13 <steve.francia@gmail.com>
Date:   Tue,  4 Nov 2014 00:26:56 -0500

Adding ReaderTo and ToReader helper functions

Diffstat:
Mhelpers/general.go | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/helpers/general.go b/helpers/general.go
@@ -64,6 +64,20 @@ func ReaderToBytes(lines io.Reader) []byte {
 	return b.Bytes()
 }
 
+func ReaderToString(lines io.Reader) string {
+	b := new(bytes.Buffer)
+	b.ReadFrom(lines)
+	return b.String()
+}
+
+func StringToReader(in string) io.Reader {
+	return strings.NewReader(in)
+}
+
+func BytesToReader(in []byte) io.Reader {
+	return bytes.NewReader(in)
+}
+
 // sliceToLower goes through the source slice and lowers all values.
 func SliceToLower(s []string) []string {
 	if s == nil {