ReadFromFile is a ReadFromURIFunc which reads local file URIs.
(loader *Loader, location *url.URL)
| 77 | |
| 78 | // ReadFromFile is a ReadFromURIFunc which reads local file URIs. |
| 79 | func ReadFromFile(loader *Loader, location *url.URL) ([]byte, error) { |
| 80 | if !is_file(location) { |
| 81 | return nil, ErrURINotSupported |
| 82 | } |
| 83 | return os.ReadFile(path.Clean(filepath.FromSlash(location.Path))) |
| 84 | } |
| 85 | |
| 86 | // URIMapCache returns a ReadFromURIFunc that caches the contents read from URI |
| 87 | // locations in a simple map. This cache implementation is suitable for |
searching dependent graphs…