fileembed

package
v0.0.0-...-d6cb8d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinStrings

func JoinStrings(ss ...string) string

JoinStrings joins returns the concatentation of ss.

Types

type Files

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

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

Add adds a file to the file set.

func (*Files) Open

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

type Opener

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

func Multi

func Multi(openers ...Opener) Opener

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

type String

type String string

func (String) Open

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

type ZlibCompressed

type ZlibCompressed string

ZlibCompressed is used to store a compressed file.

func (ZlibCompressed) Open

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

type ZlibCompressedBase64

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

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

Directories

Path Synopsis
The genfileembed command embeds resources into Go files, to eliminate run-time dependencies on files on the filesystem.
The genfileembed command embeds resources into Go files, to eliminate run-time dependencies on files on the filesystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL