asset

package
v0.0.0-...-e791307 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

The Resource class wraps a streamable file or remote Resource.

func NewResource

func NewResource(pathToResource string, relTo *Resource) (*Resource, error)

Create a new Resource data stream. If relTo is specified and pathToResource does not define a scheme, then the path to the new Resource will be generated by concatenating the base path of relTo and pathToResource.

This function can handle http/https URLs by delegating to the net/http package. The caller must make sure to close the returned io.ReadCloser to prevent mem leaks.

func NewResourceFromStream

func NewResourceFromStream(name string, source io.Reader) *Resource

Create a resource from a reader.

func (*Resource) IsRemote

func (r *Resource) IsRemote() bool

Returns true if the Resource is streamed over http/https.

func (*Resource) Path

func (r *Resource) Path() string

Returns the path to this resource.

func (*Resource) RemotePath

func (r *Resource) RemotePath() string

Return the remote path to this resource. If this is a remote resource then this method returns the base path (without leading /) of the remote URL. Otherwise, this method returns the same value as Path().

Directories

Path Synopsis
bvh

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL