packr: Index | Files | Directories

package packr

import ""


Package Files

box.go env.go file.go packr.go version.go walk.go


const Version = "v2.5.3"


var (
    // ErrResOutsideBox gets returned in case of the requested resources being outside the box
    ErrResOutsideBox = fmt.Errorf("Can't find a resource outside the box")
var GoBin = envy.GoBin

GoBin returns the current GO_BIN env var or if it's missing, a default of "go"

var GoPath = envy.GoPath

GoPath returns the current GOPATH env var or if it's missing, the default.

func PackBytes Uses

func PackBytes(box string, name string, bb []byte)

PackBytes packs bytes for a file into a box.

func PackBytesGzip Uses

func PackBytesGzip(box string, name string, bb []byte) error

PackBytesGzip packets the gzipped compressed bytes into a box.

func PackJSONBytes Uses

func PackJSONBytes(box string, name string, jbb string) error

PackJSONBytes packs JSON encoded bytes for a file into a box.

func UnpackBytes Uses

func UnpackBytes(box string)

UnpackBytes unpacks bytes for specific box.

type Box Uses

type Box struct {
    Path string
    // 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 Uses

func NewBox(path string) Box

NewBox returns a Box that can be used to retrieve files from either disk or the embedded binary.

func (Box) AddBytes Uses

func (b Box) AddBytes(path string, t []byte) error

AddBytes sets t in by the given path

func (Box) AddString Uses

func (b Box) AddString(path string, t string) error

AddString converts t to a byteslice and delegates to AddBytes to add to

func (Box) Bytes Uses

func (b Box) Bytes(name string) []byte

Deprecated: Use Find instead.

func (Box) Find Uses

func (b Box) Find(name string) ([]byte, error)

Find returns either the byte slice of the requested file or an error if it can not be found.

func (Box) FindString Uses

func (b Box) FindString(name string) (string, error)

FindString returns either the string of the requested file or an error if it can not be found.

func (Box) Has Uses

func (b Box) Has(name string) bool

Has returns true if the resource exists in the box

func (Box) List Uses

func (b Box) List() []string

List shows "What's in the box?"

func (Box) MustBytes Uses

func (b Box) MustBytes(name string) ([]byte, error)

Deprecated: Use Find instead.

func (Box) MustString Uses

func (b Box) MustString(name string) (string, error)

Deprecated: Use FindString instead.

func (Box) Open Uses

func (b Box) Open(name string) (http.File, error)

Open returns a File using the http.File interface

func (Box) String Uses

func (b Box) String(name string) string

Deprecated: Use FindString instead.

func (Box) Walk Uses

func (b Box) Walk(wf WalkFunc) error

Walk will traverse the box and call the WalkFunc for each file in the box/folder.

func (Box) WalkPrefix Uses

func (b Box) WalkPrefix(prefix string, wf WalkFunc) error

WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix

type File Uses

type File = packd.File

type WalkFunc Uses

type WalkFunc = packd.WalkFunc


v2/file/resolver/encoding/hexPackage hex implements hexadecimal encoding and decoding.

Package packr imports 14 packages (graph) and is imported by 510 packages. Updated 2020-03-25. Refresh now. Tools for package owners.