items and struture loading

This commit is contained in:
adman
2026-03-12 23:13:25 +01:00
parent 047c4d02ff
commit e0cf1834f1
7 changed files with 124 additions and 12 deletions
+10
View File
@@ -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)
}