minifyfs

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir string

Dir implements http.FileSystem. This is primarily designed to be used for scenarios where you wish to embed and compile static assets into your Go binary. The files listed using this file system are minified if they are CSS or JavaScript.

I wouldn't recommend using this directly when serving from an HTTP router, as the File methods here aren't terribly efficient. In fact, I bet there are better ways to do this.

func (Dir) Open

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

type File

type File struct {
	Contents []byte
	FileName string
	Reader   *bytes.Reader
	Stats    os.FileInfo
}

Implementation of http.File, os.FileInfo, io.Reader, io.Seeker. When you open a file using the Open method, the contents are read whole, then minified if they are CSS or JavaScript.

func Open

func Open(fileName string) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) IsDir

func (f *File) IsDir() bool

func (*File) ModTime

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

func (*File) Mode

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

func (*File) Name

func (f *File) Name() string

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) Readdir

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

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Size

func (f *File) Size() int64

func (*File) Stat

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

func (*File) Sys

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

Jump to

Keyboard shortcuts

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