Documentation
¶
Index ¶
Constants ¶
const (
)Variables ¶
This section is empty.
Functions ¶
func EncodeToTarString ¶
EncodeToTarString takes the contents of the given directory and writes it to the given Writer in the form of an unquoted UTF-8 encoded string that contains a tar archive of the directory, for example \x69\x6e\x64\x65\x78\x2e\x68\x74 ...
Types ¶
type AssetDirectory ¶
type AssetDirectory struct {
AssetFile
}
AssetDirectory implements http.File interface for a directory. It is always empty.
type FakeFile ¶
type FakeFile struct { // Path is the path of this file Path string // Dir marks of the path is a directory Dir bool // Len is the length of the fake file, zero if it is a directory Len int64 }
FakeFile implements os.FileInfo interface for a given path and size
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem is a tarfs filesystem. It exposes a Get method for accessing resources by path. It also implements http.FileSystem for use with http.FileServer.
func New ¶
func New(tarData []byte, local string) (*FileSystem, error)
New creates a new FileSystem using the given in-memory tar data. If local is a non-empty string, the resulting FileSystem will first look for resources in the local file system before returning an embedded resource.
func (*FileSystem) Get ¶
func (fs *FileSystem) Get(p string) ([]byte, error)
Get returns the bytes for the resource at the given path. If this FileSystem was configured with a local directory, and that local directory contains a file at the given path, Get will return the value from the local file. Otherwise, it returns the bytes from the embedded in-memory resource.
Note - the implementation of local reads is not optimized and is primarily intended for development-time usage.
func (*FileSystem) GetIgnoreLocalEmpty ¶
func (fs *FileSystem) GetIgnoreLocalEmpty(p string) ([]byte, error)
GetIgnoreLocalEmpty is the same as Get, but it ignores local file system files if they're empty.
func (*FileSystem) Open ¶
func (fs *FileSystem) Open(name string) (http.File, error)
Open implements the method from http.FileSystem. tarfs doesn't currently support directories, so any request for a name ending in / will return an empty directory.
func (*FileSystem) SubDir ¶
func (fs *FileSystem) SubDir(dir string) *FileSystem
SubDir returns a FileSystem corresponding to the given directory in the original FileSystem.