embedres

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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