inbed

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImporterName = "inbed.go"

ImporterName is the name of the go source file that imports the generated inbed package.

View Source
var PackageName = "inbed"

PackageName is the name of the generated package. If the package name has a .go extension then a file is produced instead of a package.

View Source
var Root = filepath.Dir(os.Args[0])

Root is the location of the project (defaults to the directory the binary is running from).

View Source
var SingleFile string

SingleFile is the filename of the file to embed into, if blank, a package is used instead.

Functions

func Bytes

func Bytes(path string, data []byte)

Bytes allows inbedding of bytes.

func Data

func Data(uri string, modtime int64, mode uint32, data []byte)

Data is a low-level function (only available in production) for embedding data.

func Done

func Done() error

Done should be called after all calls to File and before any calls to Open.

func File

func File(name string) error

File embeds the named file inside your code, relative to the location of the binary. If the file is a directory, the entire directory is recursively embedded.

func List

func List(folder string) []string

List lists the paths of any files starting with the prefix 'folder'

func Open

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

Open opens a previously embedded file. If Done hasn't been called, it is called.

func ServeFile

func ServeFile(w http.ResponseWriter, r *http.Request, name string)

ServeFile mimics http.ServeFile

Types

type FileSystem

type FileSystem struct {
	Prefix string
}

FileSystem implements net/http.FileSystem

func (FileSystem) Open

func (fs FileSystem) Open(name string) (http.File, error)

Open implements http.FileSystem with inbed.Open

func (FileSystem) ServeHTTP

func (fs FileSystem) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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