Documentation ¶
Index ¶
- Constants
- func Append(fpath string, data []byte) (err error)
- func AppendText(fpath, text string) (err error)
- func Chmod(fpath string, mode os.FileMode) error
- func ChmodAll(root string, mode os.FileMode) error
- func Chown(fpath string, uid, gid int) error
- func ChownAll(root string, uid, gid int) error
- func Copy(src, dst string) error
- func GetConfigDir(paths ...string) (string, error)
- func GetCurrentDir() string
- func GetFileDir(filepath string) string
- func GetFileExt(file string) string
- func GetFileName(filepath string) string
- func GetFileNameWithoutExt(filepath string) string
- func GetFilePathWithoutExt(filepath string) string
- func GetHomeDir() string
- func IsDir(filepath string) bool
- func IsExist(filepath string) bool
- func IsFile(filepath string) bool
- func IsImage(filepath string) bool
- func LineContent(filepath string, numbers ...int) map[int]string
- func LineCount(filepath string) int
- func ListDirs(dir string, isRecursive ...bool) []string
- func ListFiles(dir string, match string, isRecursive ...bool) []string
- func Md5(path string) (string, error)
- func MineType(filepath string) string
- func New(fpath string) (*os.File, error)
- func NewFile(fpath string, isAppend bool) (*os.File, error)
- func Read(filepath string) string
- func ReadFirstLine(fpath string) (line string, err error)
- func ReadJSON(filepath string, data interface{}) error
- func ReadLastLine(fpath string) (line string, err error)
- func ReadLastNLines(filePath string, n int) ([]string, error)
- func ReadLines(fpath string, n int) (lines []string, err error)
- func ReaderMineType(r io.Reader) string
- func ReverseRead(fileName string, lineNum uint) ([]string, error)
- func Shadow(filepath string) string
- func Size(filepath string) int64
- func SizeText(size int64) string
- func Temp(filenames ...string) string
- func Write(filepath, str string) error
- func WriteByte(fpath string, data []byte) (err error)
- func WriteJSON(filepath string, data interface{}, pretty ...bool) error
- func WriteText(fpath, text string) (err error)
- type LsFile
Constants ¶
View Source
const ( // TypeAll list dir and file TypeAll int = iota // TypeDir list only dir TypeDir // TypeFile list only file TypeFile )
Variables ¶
This section is empty.
Functions ¶
func AppendText ¶ added in v0.0.4
AppendText appends string data to file
func ChmodAll ¶ added in v0.0.4
ChmodAll chmods to path and children, returns the first error it encounters
func ChownAll ¶ added in v0.0.4
ChownAll chowns to path and children, returns the first error it encounters
func GetFileNameWithoutExt ¶
GetFileNameWithoutExt ...
func GetFilePathWithoutExt ¶
GetFilePathWithoutExt ...
func ReadFirstLine ¶ added in v0.0.4
ReadFirstLine returns first NOT empty line
func ReadLastLine ¶ added in v0.0.4
ReadLastLine returns last NOT empty line
func ReadLastNLines ¶ added in v0.0.3
ReadLastNLines ...
func ReverseRead ¶ added in v0.0.3
ReverseRead 读取文件的最后 N 行
Types ¶
Click to show internal directories.
Click to hide internal directories.