afs

package
v0.0.0-...-b09f343 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReadAllWriteUser gives specified permissions
	ReadAllWriteUser os.FileMode = 0644
	// ReadExecAllWriteUser gives specified permissions
	ReadExecAllWriteUser os.FileMode = 0755
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AFS

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

AFS abstracts over the filesystem providing read/write access to an in memory filesystem, or a cached os file system

func New

func New() *AFS

New returns a new FS

func (*AFS) CloseAll

func (afs *AFS) CloseAll()

CloseAll closes all cached files

func (*AFS) LoadAssets

func (afs *AFS) LoadAssets(dir string) error

LoadAssets walks the given directory, opening and caching assets

func (*AFS) Open

func (afs *AFS) Open(path string) (types.AFSFile, error)

Open a reader for the file at the specified path on the file system

func (*AFS) ReadFile

func (afs *AFS) ReadFile(path string) ([]byte, error)

ReadFile opens file on the filesytem into a []byte array

func (*AFS) Use

func (afs *AFS) Use(key string) types.AFSFile

Use returns the reader of a file under the specified key

func (*AFS) WithCachedFs

func (afs *AFS) WithCachedFs() *AFS

WithCachedFs creates a cached os file system

func (*AFS) WithMemFs

func (afs *AFS) WithMemFs() *AFS

WithMemFs creates an underlying in memory filesystem

func (*AFS) WithStatic

func (afs *AFS) WithStatic(static string) (*AFS, error)

WithStatic loads the given static assets into the server

func (*AFS) Write

func (afs *AFS) Write(path string, data []byte, perm os.FileMode) error

Write saves file to file system

Jump to

Keyboard shortcuts

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