Documentation ¶
Index ¶
- Variables
- func GetStuff(in string) ([]byte, error)
- func MergeFS(dest FileSystem, src FileSystem) error
- func ParseTemplates(f template.FuncMap, fs FileSystem, path ...string) (*template.Template, error)
- func ParseTemplatesGlob(f template.FuncMap, fs FileSystem, pattern string) (*template.Template, error)
- func Stuff(in, out, rootPath string, files ...string) (int64, int64, error)
- type File
- type FileSystem
- type ID
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var ErrNoID = errors.New("no ID found in the file")
ErrNoID is used to indicate if an ID was found in a file or not.
var ErrNotSupported = errors.New("this method is not supported")
ErrNotSupported indicates interface methods that are implemented but not supported.
Functions ¶
func MergeFS ¶ added in v1.1.0
func MergeFS(dest FileSystem, src FileSystem) error
MergeFS merges FileSystem b into a, overwriting conflicting paths.
func ParseTemplates ¶
ParseTemplates takes a file system, a list of file paths, and parses them into a template.Template.
func ParseTemplatesGlob ¶
func ParseTemplatesGlob(f template.FuncMap, fs FileSystem, pattern string) (*template.Template, error)
ParseTemplatesGlob takes a file system, a file path pattern, and parses matching files into a template.Template with an optional template.FuncMap that will be applied to the compiled templates.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents an abstraction over http.File.
func (*File) Close ¶
Close emulates http.File's Close but internally, it simply seeks the File's reader to 0.
type FileSystem ¶
type FileSystem interface { Add(f *File) error List() []string Len() int Size() int64 Get(path string) (*File, error) Glob(pattern string) ([]string, error) Read(path string) ([]byte, error) Open(path string) (http.File, error) Delete(path string) error Merge(f FileSystem) error FileServer() http.Handler }
FileSystem represents a simple filesystem abstraction that implements the http.fileSystem interface.
func NewLocalFS ¶
func NewLocalFS(rootPath string, paths ...string) (FileSystem, error)
NewLocalFS returns a new instance of FileSystem with the given list of local files and directories mapped to it.
func UnStuff ¶
func UnStuff(path string) (FileSystem, error)
UnStuff takes the path to a stuffed binary, unstuffs it, and returns a FileSystem.
func UnZip ¶
func UnZip(b []byte) (FileSystem, error)
UnZip unzips zipped bytes and returns a FileSystem with the files mapped to it.
type ID ¶
ID represents an identifier that is appended to binaries for identifying stuffbin binaries. The fields are appended as bytes totalling 8 + 12 + 8 + 8 = 36 bytes in the order Name BinSize ZipSize.