-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio.go
More file actions
42 lines (33 loc) · 806 Bytes
/
Copy pathio.go
File metadata and controls
42 lines (33 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package aseprite
import (
"io/fs"
"os"
)
// Read opens and parses an Aseprite file from the given filepath,
// optionally filtering to visible layers only
func Read(filepath string, onlyVisibleLayers bool) (a Ase, err error) {
file, err := os.Open(filepath)
if err != nil {
return a, err
}
defer file.Close()
_, err = a.parse(file, onlyVisibleLayers)
if err != nil {
return a, err
}
return a, nil
}
// ReadFs opens and parses an Aseprite file from a virtual filesystem,
// optionally filtering to visible layers only
func ReadFs(f fs.FS, filepath string, onlyVisibleLayers bool) (a Ase, err error) {
file, err := f.Open(filepath)
if err != nil {
return a, err
}
defer file.Close()
_, err = a.parse(file, onlyVisibleLayers)
if err != nil {
return a, err
}
return a, nil
}