Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2014-11-04 08:26:56 +0300
committerspf13 <steve.francia@gmail.com>2014-11-04 08:26:56 +0300
commitdcea0fa5ce125d1a9009b5e5b8a38f00c57bcee9 (patch)
tree21e2173c0a3f213012c2ebd330fc64aae67b9920 /helpers
parent2cb89a523a7bc7302620f400b2829e5d73cf477d (diff)
Adding ReaderTo and ToReader helper functions
Diffstat (limited to 'helpers')
-rw-r--r--helpers/general.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/helpers/general.go b/helpers/general.go
index f68908d9a..bfac5beae 100644
--- 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 {