Documentation
¶
Index ¶
- Constants
- Variables
- func PackBytes(box string, name string, bb []byte)
- func PackBytesGzip(box string, name string, bb []byte) error
- func PackJSONBytes(box string, name string, jbb string) error
- type Box
- func (b *Box) AddBytes(path string, t []byte) error
- func (b *Box) AddString(path string, t string) error
- func (b *Box) Bytes(name string) []byte
- func (b *Box) Find(name string) ([]byte, error)
- func (b *Box) FindString(name string) (string, error)
- func (b *Box) Has(name string) bool
- func (b *Box) HasDir(name string) bool
- func (b *Box) List() []string
- func (b *Box) MustBytes(name string) ([]byte, error)
- func (b *Box) MustString(name string) (string, error)
- func (b *Box) Open(name string) (http.File, error)
- func (b *Box) Resolve(key string) (file.File, error)
- func (b *Box) SetResolver(file string, res resolver.Resolver)
- func (b *Box) String(name string) string
- func (b *Box) Walk(wf WalkFunc) error
- func (b *Box) WalkPrefix(prefix string, wf WalkFunc) error
- type File
- type Pointer
- type WalkFunc
Constants ¶
const Version = "v2.0.5"
Version of Packr
Variables ¶
var ( // ErrResOutsideBox gets returned in case of the requested resources being outside the box // Deprecated ErrResOutsideBox = errors.New("can't find a resource outside the box") )
Functions ¶
func PackBytesGzip ¶
PackBytesGzip packets the gzipped compressed bytes into a box. Deprecated
Types ¶
type Box ¶
type Box struct { Path string `json:"path"` Name string `json:"name"` ResolutionDir string `json:"resolution_dir"` DefaultResolver resolver.Resolver `json:"default_resolver"` // contains filtered or unexported fields }
Box represent a folder on a disk you want to have access to in the built Go binary.
func NewBox ¶
NewBox returns a Box that can be used to retrieve files from either disk or the embedded binary. Deprecated: Use New instead.
func (*Box) AddString ¶
AddString converts t to a byteslice and delegates to AddBytes to add to b.data
func (*Box) Find ¶
Find returns either the byte slice of the requested file or an error if it can not be found.
func (*Box) FindString ¶
FindString returns either the string of the requested file or an error if it can not be found.
func (*Box) MustString ¶
MustString is deprecated. Use FindString instead
func (*Box) Resolve ¶
Resolve will attempt to find the file in the box, returning an error if the find can not be found.
func (*Box) SetResolver ¶
SetResolver allows for the use of a custom resolver for the specified file
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
_fixtures
|
|
resolver/encoding/hex
Package hex implements hexadecimal encoding and decoding.
|
Package hex implements hexadecimal encoding and decoding. |