Documentation ¶
Overview ¶
Package slate holds binary resources embedded into Go executable
Index ¶
- func CopyTo(target string, mode os.FileMode, overwrite bool, files ...string) error
- type Asset
- func (a *Asset) Bytes() []byte
- func (a *Asset) IsCompressed() bool
- func (a *Asset) IsDir() bool
- func (a *Asset) MimeType() string
- func (a *Asset) ModTime() time.Time
- func (a *Asset) Mode() os.FileMode
- func (a *Asset) Name() string
- func (a *Asset) Reader() io.ReadCloser
- func (a *Asset) Size() int64
- func (a *Asset) String() string
- func (a *Asset) Sys() interface{}
- func (a *Asset) WriteTo(w io.Writer) (int64, error)
- type File
- type FileSystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyTo ¶
The CopyTo method extracts all mentioned files to a specified location, keeping directory structure. If supplied file is a directory, than it will be extracted recursively. CopyTo with no file mentioned will extract the whole content of the embedded filesystem. CopyTo returns error if there is a file with the same name at the target location, unless overwrite is set to true, or file has the same size and modification file as the extracted file. slate.CopyTo(".", mode, false) will effectively extract content of the filesystem to the current directory (which makes it the most space-wise inefficient self-extracting archive ever).
Types ¶
type Asset ¶
type Asset struct {
// contains filtered or unexported fields
}
Asset represents binary resource stored within Go executable. Asset implements fmt.Stringer and io.WriterTo interfaces, decompressing binary data if necessary.
func (*Asset) IsCompressed ¶
IsCompressed returns true of asset has been compressed
func (*Asset) ModTime ¶
ModTime implements os.FileInfo and returns the time stamp when this package has been produced (the same value for all the assets)
func (*Asset) Reader ¶
func (a *Asset) Reader() io.ReadCloser
Returns content of the asset as io.ReaderCloser.
func (*Asset) Size ¶
Size implements os.FileInfo and returns the size of the asset (uncompressed, if asset has been compressed)
type File ¶
type File interface { io.Closer io.Reader io.Seeker Readdir(count int) ([]os.FileInfo, error) Stat() (os.FileInfo, error) }
A File is returned by virtual FileSystem's Open method. The methods should behave the same as those on an *os.File.