summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'util.go')
-rw-r--r--util.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/util.go b/util.go
index b07a37d..96ffd9b 100644
--- a/util.go
+++ b/util.go
@@ -21,6 +21,7 @@ import (
"compress/zlib"
"fmt"
// "github.com/davecgh/go-spew/spew"
+ "io"
"math"
"os"
)
@@ -58,16 +59,10 @@ func fileSize(filename string) (size int64, ok bool) {
return
}
-// Returns a new buffer populated with the contents of the specified file
-func bufferFromFile(fileStr string) (b *bytes.Buffer, err error) {
- var fl *os.File
- fl, err = os.Open(fileStr)
- if err != nil {
- return
- }
- defer fl.Close()
+// Returns a new buffer populated with the contents of the specified Reader
+func bufferFromReader(r io.Reader) (b *bytes.Buffer, err error) {
b = new(bytes.Buffer)
- _, err = b.ReadFrom(fl)
+ _, err = b.ReadFrom(r)
return
}