Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustReadFile ¶ added in v0.1.0
MustReadFile returns the full content of the specified static file or panics. It is intended for use during program initialization. Unlike ReadFile, this function does not delegate to the real filesystem.
func ReadFile ¶ added in v0.1.0
ReadFile reads the complete contents of the specified file path. If path is not a registered static file path, ReadFile delegates to os.ReadFile.
func Register ¶
func Register(path, data string)
Register the contents of a file under the given path. The path is cleaned by filepath.Clean. This function will panic if path == "" or if the cleaned path has previously been registered.
This function is meant to be used from generated code, and should not ordinarily be called directly by clients of the library.
Types ¶
type File ¶
File is the interface satisfied by files opened by the Open function. It is satisfied by the *os.File and *View types.
type View ¶ added in v0.1.0
type View struct {
// contains filtered or unexported fields
}
View is a read-only view of the contents of a static file. It implements the File interface.
func (*View) Close ¶ added in v0.1.0
Close implements io.Closer. This implementation never returns an error, and no resources are leaked if a *View is not closed.
Directories ¶
Path | Synopsis |
---|---|
Binary compiledata generates Go source text containing encoded file data, for use with the github.com/creachadair/staticfile package.
|
Binary compiledata generates Go source text containing encoded file data, for use with the github.com/creachadair/staticfile package. |
internal
|
|
bits
Package bits provides support routines for encoding and decoding data.
|
Package bits provides support routines for encoding and decoding data. |