fs

package
v0.0.0-...-4d2c057 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadMode      = 0444
	WriteMode     = 0222
	ReadWriteMode = 0666
	CommonMode    = 0766
	FullMode      = 0777
)

Variables

View Source
var (
	// ROOT indicates the root of current app.
	ROOT = "/"
)

Functions

func CombinPath

func CombinPath(elements ...string) string

CombinPath combins all paramters to whole path.

func CopyFile

func CopyFile(srcName, destName string) (int64, error)

CopyFile to copy src file to dest file.

func FileExists

func FileExists(fullPath string) bool

FileExists checks file exist or not

func GetFileSize

func GetFileSize(filename string) (bool, int64)

GetFileSize returns bytes of file.

func Home

func Home() (string, error)

func IsDir

func IsDir(dir string) bool

IsDir checks input whether directory or not.

func IsFile

func IsFile(filename string) bool

IsFile checks input whether file or not.

func LockFile

func LockFile(file string) bool

func MakeDirP

func MakeDirP(dir string) error

MakeDirP equals to mkdir -p

func RemoveFile

func RemoveFile(fullPath string) bool

RemoveFile to delete a file

func SymLink(srcName, destName string) error

func UnlockFile

func UnlockFile(file string) bool

func WalkDir

func WalkDir(dir string, fn func(*File)) error

Types

type File

type File struct {
	Folder      string
	FileName    string
	FileRawName string
	FileExtName string
	FullPath    string
}

File object.

func NewFile

func NewFile(path string) *File

NewFile return parsed file object

func (*File) Append

func (f *File) Append(content []byte) error

func (*File) ClearAll

func (f *File) ClearAll() error

ClearAll truncate whole file.

func (*File) Create

func (f *File) Create() error

Create a file.

func (*File) Delete

func (f *File) Delete() bool

Delete file

func (*File) Exists

func (f *File) Exists() bool

Exists returns file exists or not

func (*File) ReadAll

func (f *File) ReadAll() (string, error)

ReadAll text in file.

func (*File) Rename

func (f *File) Rename(targetName string) error

Rename the file

func (*File) WriteAll

func (f *File) WriteAll(content string) error

WriteAll text to file.

Jump to

Keyboard shortcuts

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