packr: github.com/gobuffalo/packr Index | Files | Directories

package packr

import "github.com/gobuffalo/packr"

Index

Package Files

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

Constants

const Version = "v1.21.9"

Variables

var (
    // ErrResOutsideBox gets returned in case of the requested resources being outside the box
    ErrResOutsideBox = errors.New("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 b.data 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 b.data

func (Box) Bytes Uses

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

Bytes is 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)

Bytes is deprecated. Use Find instead

func (Box) MustString Uses

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

MustString is 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

String is deprecated. Use Find 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

Directories

PathSynopsis
builder
example
example/foo
packr
packr/cmd
v2
v2/file
v2/file/resolver
v2/file/resolver/encoding/hexPackage hex implements hexadecimal encoding and decoding.
v2/jam/parser
v2/jam/store
v2/packr2
v2/packr2/cmd
v2/packr2/cmd/fix
v2/plog

Package packr imports 15 packages (graph) and is imported by 237 packages. Updated 2018-12-13. Refresh now. Tools for package owners.