fs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForFileData

func CheckForFileData(fs FileSystem, url, mount string) (data []byte, mime, path string, ok bool)

func EnumerateCheckPaths

func EnumerateCheckPaths(src string) (checkPaths []string)

func FileExists

func FileExists(path string) (exists bool)

func FindFileMime

func FindFileMime(path string) (mime string, err error)

func FindFileShasum

func FindFileShasum(path string) (shasum string, err error)

func ListAllDirs

func ListAllDirs(path string) (dirs []string, err error)

func ListAllFiles

func ListAllFiles(path string) (files []string, err error)

func ListDirs

func ListDirs(path string) (dirs []string, err error)

func ListFiles

func ListFiles(path string) (files []string, err error)

func RegisterFileSystem

func RegisterFileSystem(mount string, f FileSystem)

func RegisteredFileSystems

func RegisteredFileSystems() (registered map[string][]FileSystem)

Types

type File

type File struct {
	Path string
	Name string
	Extn string
	Mime string
	Data []byte
}

func New

func New(path string) (file *File, err error)

func (File) String

func (f File) String() string

type FileSystem

type FileSystem interface {
	Name() (name string)
	Open(path string) (fh fs.File, err error)
	ListDirs(path string) (paths []string, err error)
	ListFiles(path string) (paths []string, err error)
	ListAllDirs(path string) (paths []string, err error)
	ListAllFiles(path string) (paths []string, err error)
	ReadDir(path string) (paths []fs.DirEntry, err error)
	ReadFile(path string) (content []byte, err error)
	MimeType(path string) (mime string, err error)
	Shasum(path string) (shasum string, err error)
	FileCreated(path string) (created int64, err error)
	LastModified(path string) (dateTime int64, err error)
	Exists(path string) (exists bool)
	FileStats(path string) (mime, shasum string, created, updated time.Time, err error)
}

func Wrap

func Wrap(path string, fs FileSystem) (out FileSystem, err error)

type RWFileSystem added in v0.1.0

type RWFileSystem interface {
	FileSystem

	MakeDir(path string, perm os.FileMode) (err error)
	MakeDirAll(path string, perm os.FileMode) (err error)

	WriteFile(path string, data []byte, perm os.FileMode) (err error)

	Remove(path string) (err error)
	RemoveAll(path string) (err error)
}

func WrapRW added in v0.1.0

func WrapRW(path string, fs RWFileSystem) (out RWFileSystem, err error)

type WrapFileSystem

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

func (WrapFileSystem) Exists

func (w WrapFileSystem) Exists(path string) (exists bool)

func (WrapFileSystem) FileCreated

func (w WrapFileSystem) FileCreated(path string) (created int64, err error)

func (WrapFileSystem) FileStats added in v0.1.0

func (w WrapFileSystem) FileStats(path string) (mime, shasum string, created, updated time.Time, err error)

func (WrapFileSystem) LastModified

func (w WrapFileSystem) LastModified(path string) (updated int64, err error)

func (WrapFileSystem) ListAllDirs

func (w WrapFileSystem) ListAllDirs(path string) (paths []string, err error)

func (WrapFileSystem) ListAllFiles

func (w WrapFileSystem) ListAllFiles(path string) (paths []string, err error)

func (WrapFileSystem) ListDirs

func (w WrapFileSystem) ListDirs(path string) (paths []string, err error)

func (WrapFileSystem) ListFiles

func (w WrapFileSystem) ListFiles(path string) (paths []string, err error)

func (WrapFileSystem) MimeType

func (w WrapFileSystem) MimeType(path string) (mime string, err error)

func (WrapFileSystem) Name

func (w WrapFileSystem) Name() (name string)

func (WrapFileSystem) Open

func (w WrapFileSystem) Open(path string) (file fs.File, err error)

func (WrapFileSystem) ReadDir

func (w WrapFileSystem) ReadDir(path string) (entries []fs.DirEntry, err error)

func (WrapFileSystem) ReadFile

func (w WrapFileSystem) ReadFile(path string) (data []byte, err error)

func (WrapFileSystem) Shasum

func (w WrapFileSystem) Shasum(path string) (shasum string, err error)

type WrapRWFileSystem added in v0.1.0

type WrapRWFileSystem struct {
	WrapFileSystem
	// contains filtered or unexported fields
}

func (WrapRWFileSystem) MakeDir added in v0.1.0

func (w WrapRWFileSystem) MakeDir(path string, perm os.FileMode) (err error)

func (WrapRWFileSystem) MakeDirAll added in v0.1.0

func (w WrapRWFileSystem) MakeDirAll(path string, perm os.FileMode) (err error)

func (WrapRWFileSystem) Remove added in v0.1.0

func (w WrapRWFileSystem) Remove(path string) (err error)

func (WrapRWFileSystem) RemoveAll added in v0.1.0

func (w WrapRWFileSystem) RemoveAll(path string) (err error)

func (WrapRWFileSystem) WriteFile added in v0.1.0

func (w WrapRWFileSystem) WriteFile(path string, data []byte, perm os.FileMode) (err error)

Jump to

Keyboard shortcuts

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