Documentation ¶
Overview ¶
Package create contains functions for to create Resource objects. This will typically non-files.
Index ¶
- type Client
- func (c *Client) ByType(tp string) resource.Resources
- func (c *Client) Copy(r resource.Resource, targetPath string) (resource.Resource, error)
- func (c *Client) FromOpts(opts Options) (resource.Resource, error)
- func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resource, error)
- func (c *Client) FromString(targetPath, content string) (resource.Resource, error)
- func (c *Client) Get(pathname string) (resource.Resource, error)
- func (c *Client) GetMatch(pattern string) (resource.Resource, error)
- func (c *Client) Match(pattern string) (resource.Resources, error)
- type HTTPError
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains methods to create Resource objects. tasks to Resource objects.
func (*Client) FromOpts ¶ added in v0.141.0
FromOpts creates a new Resource from the given Options. Make sure to set optis.TargetPathHasHash if the TargetPath already contains a hash, as this avoids the need to calculate it. To create a new ReadSeekCloser from a string, use hugio.NewReadSeekerNoOpCloserFromString, or hugio.NewReadSeekerNoOpCloserFromBytes for a byte slice. See FromString.
func (*Client) FromRemote ¶ added in v0.90.0
FromRemote expects one or n-parts of a URL to a resource If you provide multiple parts they will be joined together to the final URL.
func (*Client) FromString ¶
FromString creates a new Resource from a string with the given relative target path.
func (*Client) Get ¶
Get creates a new Resource by opening the given pathname in the assets filesystem.
type Options ¶ added in v0.141.0
type Options struct { // The target path relative to the publish directory. // Unix style path, i.e. "images/logo.png". TargetPath string // Whether the TargetPath has a hash in it which will change if the resource changes. // If not, we will calculate a hash from the content. TargetPathHasHash bool // The content to create the Resource from. CreateContent func() (func() (hugio.ReadSeekCloser, error), error) }