import "github.com/gobuffalo/packr/v2"
box.go box_map.go deprecated.go dirs_map.go helpers.go packr.go pointer.go resolvers_map.go version.go walk.go
Version of Packr
var ( // ErrResOutsideBox gets returned in case of the requested resources being outside the box // Deprecated ErrResOutsideBox = fmt.Errorf("can't find a resource outside the box") )
PackBytes packs bytes for a file into a box. Deprecated
PackBytesGzip packets the gzipped compressed bytes into a box. Deprecated
PackJSONBytes packs JSON encoded bytes for a file into a box. Deprecated
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.
Folder returns a Box that will NOT be packed. This is useful for writing tests or tools that need to work with a folder at runtime.
New returns a new Box with the name of the box and the path of the box.
NewBox returns a Box that can be used to retrieve files from either disk or the embedded binary. Deprecated: Use New instead.
AddBytes sets t in b.data by the given path
AddString converts t to a byteslice and delegates to AddBytes to add to b.data
Bytes is deprecated. Use Find instead
Find returns either the byte slice of the requested file or an error if it can not be found.
FindString returns either the string of the requested file or an error if it can not be found.
Has returns true if the resource exists in the box
HasDir returns true if the directory exists in the box
List shows "What's in the box?"
MustBytes is deprecated. Use Find instead.
MustString is deprecated. Use FindString instead
Open returns a File using the http.File interface
Resolve will attempt to find the file in the box, returning an error if the find can not be found.
SetResolver allows for the use of a custom resolver for the specified file
String is deprecated. Use FindString instead
Walk will traverse the box and call the WalkFunc for each file in the box/folder.
WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix
File has been deprecated and file.File should be used instead
Pointer is a resolvr which resolves a file from a different box.
Resolve attempts to find the file in the specific box with the specified key
WalkFunc is used to walk a box
Package packr imports 21 packages (graph) and is imported by 161 packages. Updated 2019-08-26. Refresh now. Tools for package owners.