fslib

package
v0.6.23 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidPath   = errors.New("invalid path")
	FileNotOpened = errors.New("file not opened")
	FileOpened    = errors.New("file opened")
	FileNotDir    = errors.New("file is not dir")
	FileIsDir     = errors.New("file is dir")
)

Functions

func NewDir

func NewDir(path string) (d dir, err error)

func NewDirFile

func NewDirFile(path string, dir *file) (f file, err error)

func NewDirFromWD

func NewDirFromWD() (d dir, err error)

func NewDirInMem

func NewDirInMem(path string, dir *file) (f file, err error)

func NewFile

func NewFile(path string, dir *file) (f file, err error)

func NewFileFromFileInfo

func NewFileFromFileInfo(path string, fileInfo fs.FileInfo, dir *file) (f file, err error)

func NewFileInMem

func NewFileInMem(path string, dir *file) (f file, err error)

func NewInMemDir

func NewInMemDir(path string) (d dir, err error)

Types

type Dir

type Dir interface {
	Open(string) (fs.File, error)
	Remove(string) error
	RemoveAll(string) error
	Create(string) (File, error)
	Mkdir(string, fs.FileMode) (Dir, error)
	Stat(string) (fs.FileInfo, error)
	Cd(string) (Dir, error)
	Path() string
	BaseDir() File
	Exists(string) bool
	ReadDir(string) ([]fs.DirEntry, error)
	Readdir(string) ([]File, error)
	ReadFile(string) ([]byte, error)
	Copy(File, string) error
	FindAndCopy(string, string) error
	Symlink(File, string) error
	Readlink(string) (string, error)
	File() File
	Find(string) (File, error)
	FindDir(string) (File, error)
	Size() int64
}

type File

type File interface {
	Open() error
	Close() error
	Create() error
	NewFile(string) (File, error)
	NewDir(string) (File, error)
	Mkdir(fs.FileMode) error
	Remove() error
	RemoveAll() error
	Exists() bool
	Stat() (fs.FileInfo, error)
	Read([]byte) (int, error)
	ReadDir() ([]fs.DirEntry, error)
	Readdir() ([]File, error)
	Name() string
	Dir() string
	Path() string
	Size() int64
	Mode() fs.FileMode
	Type() fs.FileMode
	ModTime() time.Time
	IsDir() bool
	Parent() File
	Sys() interface{}
	Info() (fs.FileInfo, error)
	Write([]byte) (int, error)
	WriteString(string) (int, error)
	Symlink(string) error
	Readlink() (string, error)
}

Jump to

Keyboard shortcuts

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