Documentation ¶
Index ¶
- Constants
- Variables
- func CalFileLineCount(pathname string) (cnt uint32, err error)
- func CopyFile(src string, dst string) error
- func DirAppendFileName(dir, name string) string
- func DirEmpty(p string) bool
- func DirExists(p string) bool
- func DirSize(filename string) (int64, error)
- func EachFile(filepath string, fic FileInfoCallback) error
- func EachLine(pathname string, lc LineCallback, skipEmpty bool) (err error)
- func FileExists(filename string) bool
- func FileSize(filename string) (int64, error)
- func GetFileModifyTime(filename string) (time.Time, error)
- func IsDir(filename string) (bool, error)
- func IsFile(filename string) (bool, error)
- func PutFile(filePath string, contents []byte, append bool) error
- func ReadAll(filePath string) ([]byte, error)
- func ReadAllString(filePath string) (string, error)
- func ReadLines(ctx context.Context, fn string) <-chan string
- func SearchFileInDir(filename string, dirs ...string) (fullPath string, err error)
- func WriteAll(filePath string, bs []byte) error
- type FileInfoCallback
- type LineCallback
Constants ¶
View Source
const IO_BUFFER_SIZE = 4096
Variables ¶
View Source
var (
ErrEmptyArguments = errors.New("argument Can't be empty")
)
Functions ¶
func CalFileLineCount ¶
CalFileLineCount 计算一个文件的行数
func DirAppendFileName ¶
DirAppendFileName 给路径dir 之后加上 name,该函数主要 fmt 处理 path 尾部的 / 和 name 最前面的 / 的问题
func EachFile ¶
func EachFile(filepath string, fic FileInfoCallback) error
EachFile 递归的遍历某个文件/文件夹中的所有对象,
func EachLine ¶
func EachLine(pathname string, lc LineCallback, skipEmpty bool) (err error)
EachLine 对文件中每一行内容进行回调,当 lc 返回 false 时回调也会终止
func FileExists ¶
FileExists 判断文件是否存在,该函数和PHP的file_exists一致,当filename 为 文件/文件夹/符号链接 时均返回 true
func GetFileModifyTime ¶
GetFileModifyTime 获取文件的最后修改时间
func ReadAllString ¶
func SearchFileInDir ¶
Types ¶
type LineCallback ¶
LineCallback 行回调函数,当该函数返回 false 时,回调终止,不再继续
Click to show internal directories.
Click to hide internal directories.