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

package packr

import "github.com/gobuffalo/packr/v2"

Index

Package Files

box.go box_map.go deprecated.go dirs_map.go helpers.go packr.go pointer.go resolvers_map.go version.go walk.go

Constants

const Version = "v2.6.0"

Version of Packr

Variables

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")
)

func PackBytes Uses

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

PackBytes packs bytes for a file into a box. Deprecated

func PackBytesGzip Uses

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

PackBytesGzip packets the gzipped compressed bytes into a box. Deprecated

func PackJSONBytes Uses

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

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

type Box Uses

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 Folder Uses

func Folder(path string) *Box

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.

func New Uses

func New(name string, path string) *Box

New returns a new Box with the name of the box and the path of the box.

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. Deprecated: Use New instead.

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) HasDir Uses

func (b *Box) HasDir(name string) bool

HasDir returns true if the directory 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)

MustBytes 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) Resolve Uses

func (b *Box) Resolve(key string) (file.File, error)

Resolve will attempt to find the file in the box, returning an error if the find can not be found.

func (*Box) SetResolver Uses

func (b *Box) SetResolver(file string, res resolver.Resolver)

SetResolver allows for the use of a custom resolver for the specified file

func (*Box) String Uses

func (b *Box) String(name string) string

String is 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 = file.File

File has been deprecated and file.File should be used instead

type Pointer Uses

type Pointer struct {
    ForwardBox  string
    ForwardPath string
}

Pointer is a resolvr which resolves a file from a different box.

func (Pointer) Resolve Uses

func (p Pointer) Resolve(box string, path string) (file.File, error)

Resolve attempts to find the file in the specific box with the specified key

type WalkFunc Uses

type WalkFunc = packd.WalkFunc

WalkFunc is used to walk a box

Directories

PathSynopsis
file
file/resolver
file/resolver/encoding/hexPackage hex implements hexadecimal encoding and decoding.
_fixtures/import_pkg
internal/takeon/github.com/markbates/errx
internal/takeon/github.com/markbates/oncer
internal/takeon/github.com/markbates/safe
jam
jam/parser
jam/store
packr2
packr2/cmd
packr2/cmd/fix
plog

Package packr imports 21 packages (graph) and is imported by 161 packages. Updated 2019-08-26. Refresh now. Tools for package owners.