fileex

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExceedLimit = errors.New("write exceed limit")
View Source
var ErrOffset = errors.New("Seek: invalid offset")
View Source
var ErrWhence = errors.New("Seek: invalid whence")

Functions

func CopyDir

func CopyDir(src string, dst string) error

CopyDir 拷贝目录 copy directory from src to dst

func CopyFile

func CopyFile(src, dst string) error

CopyFile 拷贝文件 copy file

func CreateDir added in v0.0.6

func CreateDir(path string) error

func CreateFile added in v0.0.6

func CreateFile(path string) bool

func DirExists added in v0.0.5

func DirExists(path string) bool

检查目录是否存在

func Exists added in v0.0.5

func Exists(path string) bool

校验目录或文件是否存在

func FileExists added in v0.0.4

func FileExists(path string) bool

func FilePutContents added in v0.0.4

func FilePutContents(fileName, data string, flags ...interface{}) (int, error)

FilePutContents write files with offset/limit fileName name of file to where put data flags[0] - flags how to put this data FileAppend | LockEx

func GetExePath

func GetExePath() (exePath string, err error)

func GetFileDir

func GetFileDir(filePath string) string

func IsDir added in v0.0.4

func IsDir(fileName string) bool

IsDir tells whether the filename is a directory

func IsFile added in v0.0.4

func IsFile(fp string) bool
func IsLink(fileName string) bool

IsLink tells whether the filename is a symbolic link

func IsRegularFile added in v0.0.4

func IsRegularFile(fileName string) bool

IsRegularFile tells whether the filename is a regular file

func WriteFileAtomic added in v0.0.4

func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error

Write file to temp and atomically move when everything else succeeds.

func WritePid

func WritePid(path string) (err error)

func WritePidById

func WritePidById(id string, path string) error

Types

type SectionWriter added in v0.0.4

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

func NewSectionWriter added in v0.0.4

func NewSectionWriter(w io.WriterAt, off int64, n int64) *SectionWriter

func (*SectionWriter) Seek added in v0.0.4

func (s *SectionWriter) Seek(offset int64, whence int) (int64, error)

func (*SectionWriter) Size added in v0.0.4

func (s *SectionWriter) Size() int64

Size returns the size of the section in bytes.

func (*SectionWriter) Write added in v0.0.4

func (s *SectionWriter) Write(p []byte) (n int, err error)

func (*SectionWriter) WriteAt added in v0.0.4

func (s *SectionWriter) WriteAt(p []byte, off int64) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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