Documentation
¶
Overview ¶
Package embedres provides utilities for working with embed.FS filesystems created by the go:embed directive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddedResources ¶
type EmbeddedResources struct {
// contains filtered or unexported fields
}
EmbeddedResources knows how to manage an embedded file system of resources that are built into the binary.
func NewEmbeddedResources ¶
func NewEmbeddedResources(fs embedresFS) *EmbeddedResources
NewEmbeddedResources creates a new EmbeddedResources on the given file system.
func (*EmbeddedResources) Bytes ¶
func (resources *EmbeddedResources) Bytes(path string) result.Result[[]byte]
Bytes returns the bytes for the embedded resource at the given path. If a resource at the given path does not exist an error is returned.
func (*EmbeddedResources) MustBytes ¶
func (resources *EmbeddedResources) MustBytes(path string) []byte
MustBytes returns the bytes for the embedded resource at the given path. If a resource at the given path does not exist a panic on the error is raised.
func (*EmbeddedResources) Paths ¶
func (resources *EmbeddedResources) Paths(patterns ...string) result.Result[[]string]
Paths returns the embedded resource paths that match the given patterns. See https://pkg.go.dev/path/filepath#Match for the pattern syntax.