Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchFile is returned when the embedbin does not contain an // embedded file with the requested name. ErrNoSuchFile = errors.New("embedded file does not exist") // ErrCorruptedImage is returned when the embedbin image has been // corrupted. ErrCorruptedImage = errors.New("corrupted embedbin image") )
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads images from an embedbin.
func OpenFile ¶
OpenFile parses the provided ReaderAt with the provided size. The file's contents are parsed to determine the offset of the embedbin's archive. OpenFile returns an error if the file is not an embedbin.
func Self ¶
Self reads the currently executing binary image as an embedbin and returns a reader to it.
func (*Reader) Open ¶
func (r *Reader) Open(name string) (io.ReadCloser, error)
Open returns a ReadCloser for the named embedded file. Open returns ErrNoSuchImage if the embedbin does not contain the file.
func (*Reader) OpenBase ¶
func (r *Reader) OpenBase() (io.ReadCloser, error)
Open returns a ReadCloser for the original executable, without appended embedded files.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is used to append embedbin files to an existing binary.
func NewFileWriter ¶
NewFileWriter returns a writer that can be used to append embedbin files to the binary represented by the provided file. NewFileWriter removes any existing embedbin files that may be attached to the binary. It relies on content sniffing (see Sniff) to determine its offset.
func NewWriter ¶
NewWriter returns a writer that may be used to append embedbin files to the writer w. The writer should be positioned at the end of the base binary image.
func (*Writer) Close ¶
Close should be called after all embedded files have been written. No more files can be written after a call to Close.