localfs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const FilestoreType = "local"

FilestoreType uniquely identifies this filestore

Variables

This section is empty.

Functions

func NewFS

func NewFS(cfgMap map[string]interface{}, opts ...Option) (qfs.Filesystem, error)

NewFS creates a new local filesytem PathResolver

func NewFilesystem added in v0.4.2

func NewFilesystem(_ context.Context, cfgMap map[string]interface{}) (qfs.Filesystem, error)

NewFilesystem creates a new local filesystem Pathresolver with no options

Types

type FS

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

FS is a implementation of qfs.PathResolver that uses the local filesystem

func (*FS) Delete added in v0.4.2

func (lfs *FS) Delete(ctx context.Context, path string) (err error)

Delete removes a file or directory from the filesystem

func (*FS) Get

func (lfs *FS) Get(ctx context.Context, path string) (qfs.File, error)

Get implements qfs.PathResolver

func (*FS) Has added in v0.6.0

func (lfs *FS) Has(ctx context.Context, path string) (bool, error)

Has returns whether the store has a File with the key

func (*FS) Put added in v0.4.2

func (lfs *FS) Put(ctx context.Context, file qfs.File) (resultPath string, err error)

Put places a file or directory on the filesystem, returning the root path. The returned path may or may not honor the path of the given file

func (*FS) Type added in v0.4.2

func (lfs *FS) Type() string

Type distinguishes this filesystem from others by a unique string prefix

type FSConfig

type FSConfig struct {
	PWD string // working directory. defaults to system root
}

FSConfig adjusts the behaviour of an FS instance

func DefaultFSConfig

func DefaultFSConfig() *FSConfig

DefaultFSConfig is the configuration state with no additional options consumers of this package typically don't need to use this

type LocalFile

type LocalFile struct {
	os.File
	// contains filtered or unexported fields
}

LocalFile implements qfs.File with a filesystem file

func (*LocalFile) FileName

func (lf *LocalFile) FileName() string

FileName returns a filename associated with this file

func (*LocalFile) FullPath

func (lf *LocalFile) FullPath() string

FullPath returns the full path used when adding this file

func (*LocalFile) IsDirectory

func (lf *LocalFile) IsDirectory() bool

IsDirectory satisfies the qfs.File interface

func (*LocalFile) MediaType added in v0.4.2

func (lf *LocalFile) MediaType() string

MediaType returns a mime type based on file extension

func (*LocalFile) ModTime added in v0.4.2

func (lf *LocalFile) ModTime() time.Time

ModTime returns time of last modification, if any

func (*LocalFile) NextFile

func (lf *LocalFile) NextFile() (qfs.File, error)

NextFile satisfies the qfs.File interface

type Option

type Option func(cfgMap *FSConfig)

Option is a function type for passing to NewFS

func OptionSetPWD

func OptionSetPWD(pwd string) Option

OptionSetPWD sets the present working directory for the FS

Jump to

Keyboard shortcuts

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