Documentation
¶
Overview ¶
Package embedded provides an implementation of an embedded filesystem.
Index ¶
- func ToEFSPath(path string) stringdeprecated
- type EFSdeprecated
- type Filedeprecated
- func (f *File) Close() error
- func (f *File) IsDir() bool
- func (f *File) ModTime() time.Time
- func (f *File) Mode() os.FileMode
- func (f *File) Name() string
- func (f *File) Readdir(count int) ([]os.FileInfo, error)
- func (f *File) Size() int64
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sys() interface{}
- type FileSystemdeprecated
- type LayeredFSdeprecated
- func (fs *LayeredFS) ContentAsBytes(path string) ([]byte, bool)
- func (fs *LayeredFS) ContentAsString(path string) (string, bool)
- func (fs *LayeredFS) IsLive() bool
- func (fs *LayeredFS) MustContentAsBytes(path string) []byte
- func (fs *LayeredFS) MustContentAsString(path string) string
- func (fs *LayeredFS) Open(name string) (http.File, error)
- func (fs *LayeredFS) SetPrimary(primary string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EFS
deprecated
type EFS struct {
// contains filtered or unexported fields
}
EFS holds an embedded filesystem.
Deprecated: use Go 1.16's embedded support instead
func NewEFSFromEmbeddedZip
deprecated
added in
v1.4.0
func NewEFSFromZip
deprecated
added in
v1.4.0
func (*EFS) FileSystem ¶
func (efs *EFS) FileSystem(localRoot string) FileSystem
FileSystem returns either the embedded filesystem or a live filesystem rooted at localRoot if localRoot isn't an empty string and points to a directory.
func (*EFS) PrimaryFileSystem ¶ added in v1.4.0
func (efs *EFS) PrimaryFileSystem() FileSystem
PrimaryFileSystem returns the primary filesystem this EFS represents.
type File
deprecated
File holds the data for an embedded file.
Deprecated: use Go 1.16's embedded support instead
func (*File) Close ¶
Close the file. Does nothing and always returns nil. Implements the io.Closer interface.
func (*File) IsDir ¶
IsDir returns true if this represents a directory. Implements the os.FileInfo interface.
func (*File) ModTime ¶
ModTime returns the file modification time. Implements the os.FileInfo interface.
func (*File) Readdir ¶
Readdir reads a directory and returns information about its contents. Implements the http.File interface.
func (*File) Size ¶
Size returns the size of the file in bytes. Implements the os.FileInfo interface.
type FileSystem
deprecated
type FileSystem interface { http.FileSystem IsLive() bool ContentAsBytes(path string) ([]byte, bool) MustContentAsBytes(path string) []byte ContentAsString(path string) (string, bool) MustContentAsString(path string) string }
FileSystem defines the methods available for a live or embedded filesystem.
Deprecated: use Go 1.16's embedded support instead
func NewFileSystemFromEmbeddedZip
deprecated
added in
v1.4.0
func NewFileSystemFromEmbeddedZip(fallbackLiveFSRoot string) FileSystem
NewFileSystemFromEmbeddedZip creates a new FileSystem from the contents of a zip file appended to the end of the executable. If no such data can be found, then 'fallbackLiveFSRoot' is used to return a FileSystem based upon the local disk.
To create an embedded zip file, first create your zip file as normal, e.g. `zip -9 -r path/to/zip_file path/to/zip`. Build your executable as normal, e.g. `go build -o path/to/exe main.go`, then concatenate the zip file to the end of your executable, e.g. `cat path/to/zip_file >> path/to/exe`. Finally, run `zip -A path/to/exe` on your executable to fix up the offsets.
Deprecated: use Go 1.16's embedded support instead
func NewLiveFS
deprecated
added in
v1.4.0
func NewLiveFS(localRoot string) FileSystem
NewLiveFS creates a new live filesystem with a root at the specified location on the regular filesystem.
Deprecated: use Go 1.16's embedded support instead
func NewSubFileSystem
deprecated
added in
v1.5.0
func NewSubFileSystem(parent FileSystem, base string) FileSystem
NewSubFileSystem creates a new FileSystem rooted at 'base' within an existing FileSystem.
Deprecated: use Go 1.16's embedded support instead
type LayeredFS
deprecated
added in
v1.2.0
type LayeredFS struct {
// contains filtered or unexported fields
}
LayeredFS holds the contents of a layered file system.
Deprecated: use Go 1.16's embedded support instead
func NewLayeredFS
deprecated
added in
v1.2.0
func NewLayeredFS(primary string, primaries map[string]FileSystem, fallback FileSystem) *LayeredFS
NewLayeredFS creates a composite FileSystem. Multiple file systems may be designated as the potential primary and are chosen between dynamically at the time of a request by the current value of primary. Should the primary file system be unable to fulfill the request, then the request is passed to the fallback file system.
Deprecated: use Go 1.16's embedded support instead
func (*LayeredFS) ContentAsBytes ¶ added in v1.2.0
ContentAsBytes returns the file contents as bytes
func (*LayeredFS) ContentAsString ¶ added in v1.2.0
ContentAsString returns the file contents a string
func (*LayeredFS) IsLive ¶ added in v1.2.0
IsLive returns true if the underlying filesystem is considered to be "live"
func (*LayeredFS) MustContentAsBytes ¶ added in v1.2.0
MustContentAsBytes returns the file contents as bytes, exiting if unable to
func (*LayeredFS) MustContentAsString ¶ added in v1.2.0
MustContentAsString returns the file contents as a string, exiting if unable to
func (*LayeredFS) SetPrimary ¶ added in v1.2.0
SetPrimary sets the primary filesystem
Directories
¶
Path | Synopsis |
---|---|
Package htmltmpl provides convenience utilities for using html templates in an embedded filesystem.
|
Package htmltmpl provides convenience utilities for using html templates in an embedded filesystem. |
Package texttmpl provides convenience utilities for using text templates in an embedded filesystem.
|
Package texttmpl provides convenience utilities for using text templates in an embedded filesystem. |