file

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Read  = 4
	Write = 2
	Exec  = 1
)
View Source
const (
	FileBegin = 0
	FileNow   = 1
	FileEnd   = 2
)

Variables

This section is empty.

Functions

func FileExist

func FileExist(filePath string) bool

Types

type FileWriter

type FileWriter struct {
	File     *os.File
	FilePath string
	IsAppend bool
}

func NewFileWriter

func NewFileWriter(filePath string, isAppend bool) (*FileWriter, error)

Write & Read 0644 is means -rw-r--r-- if you want to create a dir then use err := os.Mkdir("../src/p", os.ModePerm) where os.ModePerm means -rwxrwxrwx

func (*FileWriter) Close

func (f *FileWriter) Close()

func (*FileWriter) Info

func (f *FileWriter) Info() error

display information of the open file

func (*FileWriter) ReadString

func (f *FileWriter) ReadString(length int) (string, error)

func (*FileWriter) Rename

func (f *FileWriter) Rename(newName string) error

rename the file and still to open it

func (*FileWriter) Seek

func (f *FileWriter) Seek(offset int64, whence int) error

seek only effect read and don`t not effect write but after write the seek will change

func (*FileWriter) WriteByte

func (f *FileWriter) WriteByte(b []byte) error

func (*FileWriter) WriteString

func (f *FileWriter) WriteString(s string) error

Jump to

Keyboard shortcuts

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