Documentation ¶
Overview ¶
Package box provides the EmbedBox type and interfaces for storing and interacting with embedded files.
Index ¶
- Variables
- type CompressedFile
- type EmbedBox
- func (e *EmbedBox) Add(name string, content []byte)
- func (e *EmbedBox) Get(file string) ([]byte, error)
- func (e *EmbedBox) Has(file string) bool
- func (e *EmbedBox) Index(file string) (int, error)
- func (e *EmbedBox) ReadEmbeddedFileToString(path string) (string, error)
- func (e *EmbedBox) ReadEmbeddedTemplateToString(path string) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var EmbedDecoder, _ = zstd.NewReader(nil)
EmbedDecoder is a reader that caches decompressors.
View Source
var Template = newEmbedBox()
Functions ¶
This section is empty.
Types ¶
type CompressedFile ¶
CompressedFile is the container type for embedded files. The file contents are stored as zstandard compressed byte arrays.
type EmbedBox ¶
type EmbedBox struct { Path string // path, with / being the root directory (directory of `go env gomod`) of the project Storage []CompressedFile }
EmbedBox is the container type for embedded paths. The files within are stored as CompressedFiles.
func (*EmbedBox) ReadEmbeddedFileToString ¶
ReadEmbeddedFileToString reads the path argument and returns the contents as a string.
Click to show internal directories.
Click to hide internal directories.