import "fyne.io/fyne/v2"
  

Usage

type Resource

  type Resource interface {
	Name() string
	Content() []byte
}
  

Resource represents a single binary resource, such as an image or font. A resource has an identifying name and byte array content. The serialised path of a resource can be obtained which may result in a blocking filesystem write operation.

func CacheResourceFromURLString

  func CacheResourceFromURLString(urlStr string) (Resource, error)
  

CacheResourceFromURLString creates a new [StaticResource] in memory using the body of the specified URL. It also adds the content to our cache so that future requests for this resource will be available locally instead of downloaded from the URL.

Since: 2.8

func LoadResourceFromPath

  func LoadResourceFromPath(path string) (Resource, error)
  

LoadResourceFromPath creates a new [StaticResource] in memory using the contents of the specified file.

func LoadResourceFromURLString

  func LoadResourceFromURLString(urlStr string) (Resource, error)
  

LoadResourceFromURLString creates a new [StaticResource] in memory using the body of the specified URL.