LoadReaderData loads a resource when you already have the reader for it.
(url string, f io.Reader)
| 117 | |
| 118 | // LoadReaderData loads a resource when you already have the reader for it. |
| 119 | func (formats *Formats) LoadReaderData(url string, f io.Reader) error { |
| 120 | ext := getExt(url) |
| 121 | if loader, ok := Files.formats[ext]; ok { |
| 122 | // This specific loader needs to be given the root |
| 123 | rl, ok := loader.(FileLoaderRooter) |
| 124 | if ok { |
| 125 | rl.SetRoot(formats.GetRoot()) |
| 126 | } |
| 127 | return loader.Load(url, f) |
| 128 | } |
| 129 | return fmt.Errorf("no `FileLoader` associated with this extension: %q in url %q", ext, url) |
| 130 | } |
| 131 | |
| 132 | // Unload releases the given resource from memory. |
| 133 | func (formats *Formats) Unload(url string) error { |