file

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	PS = "/"
	PT = "."

	FILE_MODE = 0640
	PATH_MODE = 0750

	NULL   = "/dev/null"
	STDIN  = "/dev/stdin"
	STDOUT = "/dev/stdout"
	STDERR = "/dev/stderr"
)
View Source
const FILE = "file"

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(p string) (io.ReadWriteCloser, error)

func Close

func Close()

func CreateFile

func CreateFile(p string) (io.WriteCloser, string, error)

func ExistsFile

func ExistsFile(p string) bool

func Init

func Init(f File)
func Link(oldname, newname string) error

func MkdirAll

func MkdirAll(p string, m os.FileMode) error

func NewPackFileInfo

func NewPackFileInfo(p string, b []byte) *packFileInfo

func NewPackPathInfo

func NewPackPathInfo(p string) *packFileInfo

func NewReadCloser

func NewReadCloser(r io.Reader) io.ReadCloser

func NewVoidFileInfo

func NewVoidFileInfo(p string, n int) *voidFileInfo

func NewVoidPathInfo

func NewVoidPathInfo(p string) *voidFileInfo

func NewWriteCloser

func NewWriteCloser(w func([]byte) (int, error), c func() error) io.WriteCloser

func OpenFile

func OpenFile(p string) (io.ReadCloser, error)

func ReadDir

func ReadDir(p string) (list []os.FileInfo, err error)

func ReadFile

func ReadFile(p string) ([]byte, error)

func Remove

func Remove(p string) error

func RemoveAll

func RemoveAll(p string) error

func Rename

func Rename(oldname, newname string) error

func StatFile

func StatFile(p string) (os.FileInfo, error)
func Symlink(oldname, newname string) error

func WriteFile

func WriteFile(p string, b []byte) error

Types

type DiskFile

type DiskFile struct{}

func (*DiskFile) AppendFile

func (s *DiskFile) AppendFile(p string) (io.ReadWriteCloser, error)

func (*DiskFile) Close

func (s *DiskFile) Close()

func (*DiskFile) CreateFile

func (s *DiskFile) CreateFile(p string) (io.WriteCloser, string, error)
func (s *DiskFile) Link(oldname, newname string) error

func (*DiskFile) MkdirAll

func (s *DiskFile) MkdirAll(p string, m os.FileMode) error

func (*DiskFile) OpenFile

func (s *DiskFile) OpenFile(p string) (io.ReadCloser, error)

func (*DiskFile) ReadDir

func (s *DiskFile) ReadDir(p string) ([]os.FileInfo, error)

func (*DiskFile) Remove

func (s *DiskFile) Remove(p string) error

func (*DiskFile) RemoveAll

func (s *DiskFile) RemoveAll(p string) error

func (*DiskFile) Rename

func (s *DiskFile) Rename(oldname, newname string) error

func (*DiskFile) StatFile

func (s *DiskFile) StatFile(p string) (os.FileInfo, error)
func (s *DiskFile) Symlink(oldname, newname string) error

func (*DiskFile) WriteFile

func (s *DiskFile) WriteFile(p string, b []byte) error

type File

type File interface {
	StatFile(string) (os.FileInfo, error)
	OpenFile(string) (io.ReadCloser, error)
	CreateFile(string) (io.WriteCloser, string, error)
	AppendFile(string) (io.ReadWriteCloser, error)
	WriteFile(string, []byte) error

	ReadDir(string) ([]os.FileInfo, error)
	MkdirAll(string, os.FileMode) error
	RemoveAll(string) error
	Remove(string) error
	Rename(string, string) error
	Symlink(string, string) error
	Link(string, string) error
	Close()
}

func NewDiskFile

func NewDiskFile() File

func NewMultiFile

func NewMultiFile(list ...File) File

func NewPackFile

func NewPackFile() File

func NewVoidFile

func NewVoidFile() File

type FileInfo

type FileInfo interface {
	os.FileInfo
	io.Reader
	io.Writer
	io.Closer
}

type Lock

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

func (*Lock) Lock

func (lock *Lock) Lock() func()

func (*Lock) RLock

func (lock *Lock) RLock() func()

type MultiFile

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

func (*MultiFile) AppendFile

func (s *MultiFile) AppendFile(p string) (io.ReadWriteCloser, error)

func (*MultiFile) Close

func (s *MultiFile) Close()

func (*MultiFile) CreateFile

func (s *MultiFile) CreateFile(p string) (io.WriteCloser, string, error)
func (s *MultiFile) Link(oldname, newname string) error

func (*MultiFile) MkdirAll

func (s *MultiFile) MkdirAll(p string, m os.FileMode) error

func (*MultiFile) OpenFile

func (s *MultiFile) OpenFile(p string) (io.ReadCloser, error)

func (*MultiFile) ReadDir

func (s *MultiFile) ReadDir(p string) (list []os.FileInfo, err error)

func (*MultiFile) Remove

func (s *MultiFile) Remove(p string) error

func (*MultiFile) RemoveAll

func (s *MultiFile) RemoveAll(p string) error

func (*MultiFile) Rename

func (s *MultiFile) Rename(oldname, newname string) error

func (*MultiFile) StatFile

func (s *MultiFile) StatFile(p string) (os.FileInfo, error)
func (s *MultiFile) Symlink(oldname, newname string) error

func (*MultiFile) WriteFile

func (s *MultiFile) WriteFile(p string, b []byte) error

type PackFile

type PackFile struct {
	*VoidFile
}

func (*PackFile) AppendFile

func (s *PackFile) AppendFile(p string) (io.ReadWriteCloser, error)

func (*PackFile) CreateFile

func (s *PackFile) CreateFile(p string) (io.WriteCloser, string, error)

func (*PackFile) OpenFile

func (s *PackFile) OpenFile(p string) (io.ReadCloser, error)

func (*PackFile) WriteFile

func (s *PackFile) WriteFile(p string, b []byte) error

type VoidFile

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

func (*VoidFile) AppendFile

func (s *VoidFile) AppendFile(p string) (io.ReadWriteCloser, error)

func (*VoidFile) Close

func (s *VoidFile) Close()

func (*VoidFile) CreateFile

func (s *VoidFile) CreateFile(p string) (io.WriteCloser, string, error)
func (s *VoidFile) Link(oldname, newname string) error

func (*VoidFile) MkdirAll

func (s *VoidFile) MkdirAll(p string, m os.FileMode) error

func (*VoidFile) OpenFile

func (s *VoidFile) OpenFile(p string) (io.ReadCloser, error)

func (*VoidFile) ReadDir

func (s *VoidFile) ReadDir(p string) ([]os.FileInfo, error)

func (*VoidFile) Remove

func (s *VoidFile) Remove(p string) error

func (*VoidFile) RemoveAll

func (s *VoidFile) RemoveAll(p string) error

func (*VoidFile) Rename

func (s *VoidFile) Rename(oldname, newname string) error

func (*VoidFile) StatFile

func (s *VoidFile) StatFile(p string) (os.FileInfo, error)
func (s *VoidFile) Symlink(oldname, newname string) error

func (*VoidFile) WriteFile

func (s *VoidFile) WriteFile(p string, b []byte) error

Jump to

Keyboard shortcuts

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