nori/decode.go

26 lines
326 B
Go
Raw Normal View History

2022-03-25 21:00:43 +00:00
package nori
import (
"io"
"os"
)
func New() *Nori {
return &Nori{}
}
func FromFile(fp string) (*Nori, error) {
file, err := os.Open(fp)
if err != nil {
return nil, err
}
defer file.Close()
2022-12-19 09:09:29 +00:00
return Decode(file)
2022-03-25 21:00:43 +00:00
}
func Decode(r io.Reader) (*Nori, error) {
nori := New()
err := nori.Decode(r)
return nori, err
}