loadFileBytes loads the file with specified path as a byte array.
(uri string)
| 1109 | |
| 1110 | // loadFileBytes loads the file with specified path as a byte array. |
| 1111 | func (g *GLTF) loadFileBytes(uri string) ([]byte, error) { |
| 1112 | |
| 1113 | log.Debug("Loading File: %v", uri) |
| 1114 | |
| 1115 | fpath := filepath.Join(g.path, uri) |
| 1116 | f, err := os.Open(fpath) |
| 1117 | if err != nil { |
| 1118 | return nil, err |
| 1119 | } |
| 1120 | defer f.Close() |
| 1121 | data, err := ioutil.ReadAll(f) |
| 1122 | if err != nil { |
| 1123 | return nil, err |
| 1124 | } |
| 1125 | return data, nil |
| 1126 | } |
| 1127 | |
| 1128 | // dataURL describes a decoded data url string. |
| 1129 | type dataURL struct { |
no test coverage detected