embedded

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EFS

type EFS struct {
	// contains filtered or unexported fields
}

EFS holds an embedded filesystem.

func NewEFS

func NewEFS(files map[string]*File) *EFS

NewEFS creates a new embedded filesystem.

func (*EFS) FileSystem

func (efs *EFS) FileSystem(localRoot string) FileSystem

FileSystem returns either the embedded filesystem or a live filesystem rooted at localRoot if localRoot isn't an empty string and points to a directory.

type File

type File struct {
	*bytes.Reader
	// contains filtered or unexported fields
}

File holds the data for an embedded file.

func NewFile

func NewFile(name string, modTime time.Time, size int64, compressed bool, data []byte) *File

NewFile creates a new embedded file.

func (*File) Close

func (f *File) Close() error

Close the file. Does nothing and always returns nil. Implements the io.Closer interface.

func (*File) IsDir

func (f *File) IsDir() bool

IsDir returns true if this represents a directory. Implements the os.FileInfo interface.

func (*File) ModTime

func (f *File) ModTime() time.Time

ModTime returns the file modification time. Implements the os.FileInfo interface.

func (*File) Mode

func (f *File) Mode() os.FileMode

Mode returns the file mode bits. Implements the os.FileInfo interface.

func (*File) Name

func (f *File) Name() string

Name returns the base name of the file. Implements the os.FileInfo interface.

func (*File) Readdir

func (f *File) Readdir(count int) ([]os.FileInfo, error)

Readdir reads a directory and returns information about its contents. Implements the http.File interface.

func (*File) Size

func (f *File) Size() int64

Size returns the size of the file in bytes. Implements the os.FileInfo interface.

func (*File) Stat

func (f *File) Stat() (os.FileInfo, error)

Stat returns information about the file. Implements the http.File interface.

func (*File) Sys

func (f *File) Sys() interface{}

Sys returns nil. Implements the os.FileInfo interface.

type FileSystem

type FileSystem interface {
	http.FileSystem
	IsLive() bool
	ContentAsBytes(path string) ([]byte, bool)
	MustContentAsBytes(path string) []byte
	ContentAsString(path string) (string, bool)
	MustContentAsString(path string) string
}

FileSystem defines the methods available for a live or embedded filesystem.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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