camlistore.org: camlistore.org/pkg/fileembed Index | Files | Directories

package fileembed

import "camlistore.org/pkg/fileembed"

Package fileembed provides access to static data resources (images, HTML, css, etc) embedded into the binary with genfileembed.

Most of the package contains internal details used by genfileembed. Normal applications will simply make a global Files variable.

Index

Package Files

fileembed.go

func JoinStrings Uses

func JoinStrings(ss ...string) string

JoinStrings joins returns the concatentation of ss.

type Files Uses

type Files struct {
    // Optional environment variable key to override
    OverrideEnv string

    // Optional fallback directory to check, if not in memory.
    DirFallback string

    // SlurpToMemory controls whether on first access the file is
    // slurped into memory.  It's intended for use with DirFallback.
    SlurpToMemory bool

    // Listable controls whether requests for the http file "/" return
    // a directory of available files. Must be set to true for
    // http.FileServer to correctly handle requests for index.html.
    Listable bool
    // contains filtered or unexported fields
}

Files contains all the embedded resources.

func (*Files) Add Uses

func (f *Files) Add(filename string, size int64, modtime time.Time, o Opener)

Add adds a file to the file set.

func (*Files) IsEmpty Uses

func (f *Files) IsEmpty() bool

IsEmpty reports whether f is empty.

func (*Files) Open Uses

func (f *Files) Open(filename string) (hf http.File, err error)

type Opener Uses

type Opener interface {
    Open() (io.Reader, error)
}

func Multi Uses

func Multi(openers ...Opener) Opener

Multi concatenates multiple Openers into one, like io.MultiReader.

type String Uses

type String string

func (String) Open Uses

func (s String) Open() (io.Reader, error)

type ZlibCompressed Uses

type ZlibCompressed string

ZlibCompressed is used to store a compressed file.

func (ZlibCompressed) Open Uses

func (zb ZlibCompressed) Open() (io.Reader, error)

type ZlibCompressedBase64 Uses

type ZlibCompressedBase64 string

ZlibCompressedBase64 is used to store a compressed file. Unlike ZlibCompressed, the string is base64 encoded, in standard base64 encoding.

func (ZlibCompressedBase64) Open Uses

func (zb ZlibCompressedBase64) Open() (io.Reader, error)

Directories

PathSynopsis
genfileembedThe genfileembed command embeds resources into Go files, to eliminate run-time dependencies on files on the filesystem.

Package fileembed imports 13 packages (graph) and is imported by 51 packages. Updated 2018-01-17. Refresh now. Tools for package owners.