Version: v1.2.2 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0



Package loader abstracts the reading document at given url.

It allows developers to register loaders for different uri schemes.



This section is empty.


This section is empty.


func Load

func Load(url string) (io.ReadCloser, error)

Load loads the document at given url and returns []byte, if successful.

If no Loader is registered against the URI Scheme, then it returns *SchemeNotRegisteredError

func Register

func Register(scheme string, loader Loader)

Register registers given Loader for given URI Scheme.

func UnRegister

func UnRegister(scheme string)

UnRegister unregisters the registered loader(if any) for given URI Scheme.


type Loader

type Loader interface {
	Load(url string) (io.ReadCloser, error)

Loader is the interface that wraps the basic Load method.

Load loads the document at given url and returns []byte, if successful.

type SchemeNotRegisteredError

type SchemeNotRegisteredError string

SchemeNotRegisteredError is the error type returned by Load function. It tells that no Loader is registered for that URL Scheme.

func (SchemeNotRegisteredError) Error

func (s SchemeNotRegisteredError) Error() string

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL