Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownScheme is returned when an unknown scheme is encountered in a URL. ErrUnknownScheme = errors.New("unknown scheme") // ErrInvalidSource is returned when an invalid source is encountered. ErrInvalidSource = errors.New("invalid source") )
Functions ¶
func Open ¶
func Open(uri string) (io.ReadCloser, error)
Open opens a resource identified by the given URI. It supports different schemes by utilizing registered open functions. If the URI has no scheme, it is treated as a file path.
func ReadSource ¶ added in v1.16.3
ReadSource converts src to a []byte if possible; otherwise it returns an error. Supported types for src are:
- string (as content, NOT as filename)
- []byte (as content)
- *bytes.Buffer (as content)
- io.Reader (as content)
func ReadSourceFromURI ¶ added in v1.16.3
ReadSourceFromURI reads the source from the given URI. If src != nil, it reads from src; otherwise, it opens the URI and reads from it.
func ReadSourceLocal ¶ added in v1.16.3
If src != nil, ReadSourceLocal converts src to a []byte if possible; otherwise it returns an error. If src == nil, ReadSourceLocal returns the result of reading the file specified by filename.
Types ¶
Click to show internal directories.
Click to hide internal directories.