items and struture loading
This commit is contained in:
+10
@@ -3,6 +3,7 @@ package nbt
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func WriteFile(file io.Writer, n Tag) (err error) {
|
||||
@@ -22,3 +23,12 @@ func ReadFile(file io.Reader) (n *Tag, err error) {
|
||||
err = n.Decode(r)
|
||||
return
|
||||
}
|
||||
|
||||
func ReadFilePath(path string) (n *Tag, err error) {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
return ReadFile(f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user