hafile

package
v0.2.73 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLine added in v0.0.19

func AppendLine(path string, content string) error

append

func CheckFile added in v0.0.10

func CheckFile(path string) (exist bool)

check if file exist, create if not exist

func CheckFileInPath added in v0.1.35

func CheckFileInPath(name string, path string) (bool, error)

check file/folder in path folder

func CheckFolder added in v0.0.5

func CheckFolder(path string) (newCreated bool)

check single folder and create if not exist

func CheckFolderX added in v0.2.71

func CheckFolderX(path string) (newCreated bool)

check folder in path and create if not exist

func CheckRelativePath added in v0.0.12

func CheckRelativePath(path string) bool

func Copy

func Copy(src, dst string) error

func CopyFolder

func CopyFolder(src, dst string) error

copy folder to another folder

func CurrentDir added in v0.1.34

func CurrentDir() (string, error)

get current dir, will return zz from /xx/yy/zz

func ExistFile added in v0.0.9

func ExistFile(path string) (exist bool)

check if file exist

func ExistFolder added in v0.0.9

func ExistFolder(path string) (exist bool)

check folder exist

func FullPath added in v0.0.12

func FullPath(path string) (string, error)

get current relative path's full path

func ListFolderFile added in v0.2.22

func ListFolderFile(path string, remDir bool) ([]string, error)

func OpenFile added in v0.0.5

func OpenFile(path string) *os.File

func ParseCsv added in v0.2.70

func ParseCsv(path string, data any) error

func RemFileInDirByName added in v0.2.34

func RemFileInDirByName(path string, name string, onRem func(string)) error

will rem file or folder if name contains 'name'

func RemFolder added in v0.2.20

func RemFolder(path string) error

func ReplaceFileInDir added in v0.1.36

func ReplaceFileInDir(path string, from string, to string, neglect ...string) error

func WriteLine added in v0.0.11

func WriteLine(path string, line int, content string) error

write to specific line

Types

type FileReader added in v0.1.10

type FileReader struct {
	Path string
}

func NewFileReader added in v0.1.10

func NewFileReader(path string) *FileReader

func (*FileReader) FineText added in v0.1.10

func (reader *FileReader) FineText(text string) (int, string, error)

find text in line, return line(start from 1), line content

func (*FileReader) Read added in v0.1.26

func (reader *FileReader) Read() (string, error)

read file in string

func (*FileReader) ReadLine added in v0.1.10

func (reader *FileReader) ReadLine(line int) (string, error)

read specific line in file

func (*FileReader) ReplaceLine added in v0.1.40

func (reader *FileReader) ReplaceLine(line int, content string) error

replace line with content

type FileWriter added in v0.0.17

type FileWriter struct {
	Path string
}

func NewFileWriter added in v0.0.17

func NewFileWriter(path string) *FileWriter

func (*FileWriter) Replace added in v0.1.36

func (writer *FileWriter) Replace(from string, to string) error

func (*FileWriter) Update added in v0.1.9

func (writer *FileWriter) Update(text string) error

func (*FileWriter) Write added in v0.0.17

func (writer *FileWriter) Write(text string) error

func (*FileWriter) WriteLineByLine added in v0.2.17

func (writer *FileWriter) WriteLineByLine(data []string) error

type Filer added in v0.1.10

type Filer struct {
	FileWriter
	FileReader
}

func NewFiler added in v0.1.10

func NewFiler(path string) *Filer

type XmlFile added in v0.1.10

type XmlFile struct {
	Path string
}

func NewXml added in v0.1.10

func NewXml(path string) *XmlFile

func (*XmlFile) Parse added in v0.1.10

func (x *XmlFile) Parse(data interface{}) error

type Yml added in v0.0.22

type Yml struct {
	*YmlReader
	*YmlWriter
}

func NewYml added in v0.0.22

func NewYml(path string) *Yml

type YmlReader added in v0.0.5

type YmlReader struct {
	Path string
}

func NewYmlReader added in v0.0.5

func NewYmlReader(path string) *YmlReader

func (*YmlReader) Parser added in v0.0.5

func (reader *YmlReader) Parser(data interface{}) error

type YmlWriter added in v0.0.5

type YmlWriter struct {
	Path string
}

func NewYmlWriter added in v0.0.5

func NewYmlWriter(path string) *YmlWriter

func (*YmlWriter) Append added in v0.0.5

func (writer *YmlWriter) Append(data interface{}) error

func (*YmlWriter) Write added in v0.0.5

func (writer *YmlWriter) Write(data interface{}) error

Jump to

Keyboard shortcuts

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