diff --git a/bnn.go b/bnn.go index 2593e05..d5c43b0 100755 --- a/bnn.go +++ b/bnn.go @@ -2,6 +2,7 @@ package bnn import ( "bufio" + "io" "os" "strconv" "strings" @@ -122,7 +123,17 @@ func ReadBnnFile(path string) (Bnn, error) { } defer file.Close() - scanner := bufio.NewScanner(file) + content, err := ReadBnn(file) + if err != nil { + return Bnn{}, err + } + + return content, nil +} + +// ReadBnn Reads from reader and returns object with all containing information +func ReadBnn(r io.Reader) (Bnn, error) { + scanner := bufio.NewScanner(r) var lines []string for scanner.Scan() {