Documentation ¶
Overview ¶
file 文件相关的一些辅助函数
Index ¶
- func Basename(path string) string
- func CheckPathExist(path string) bool
- func Chmod(filename string, mode os.FileMode) bool
- func Chown(name string, info os.FileInfo) error
- func CopyFile(distName, srcName string) (w int64, err error)
- func Fclose(handle *os.File) error
- func Fgetcsv(handle *os.File, delimiter rune, size ...int64) ([][]string, error)
- func FileChown(filename string, uid, gid int) bool
- func FileExists(filename string) bool
- func FileGetContents(filename string) (string, error)
- func FilePutContents(filename string, data string, mode os.FileMode) error
- func FileSize(filename string) (int64, error)
- func Filebase(file string) string
- func Fileline(file string, line int) string
- func Filemtime(filename string) (int64, error)
- func Getcwd() (string, error)
- func Glob(pattern string) ([]string, error)
- func Gunzip(in []byte) ([]byte, error)
- func Gzip(in []byte) ([]byte, error)
- func IsDir(filename string) (bool, error)
- func IsFile(filename string) bool
- func IsReadable(filename string) bool
- func IsWriteable(filename string) bool
- func LoadGobData(data interface{}, fileName string)
- func Mkdir(filename string, mode os.FileMode) error
- func Pathinfo(path string, options int) map[string]string
- func Realpath(path string) (string, error)
- func Rename(oldname, newname string) error
- func RunShell(exeStr string) (string, error)
- func Stat(filename string) (os.FileInfo, error)
- func StoreGobData(data interface{}, fileName string) error
- func Touch(filename string) (bool, error)
- func Unlink(filename string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chown ¶
Chown 清空文件并保持文件权限不变,并非linux chown操作 Empty the file and keep the file permissions unchanged not the linux chown operation
func Fgetcsv ¶
Fgetcsv fgetcsv() 默认当文件大小大于10MB逐行读取内容,否则一次性读取内容 第三个参数可以指定逐行读取的最大文件大小,单位字节 1MB = 1 << 20
func FileGetContents ¶
FileGetContents file_get_contents()
func FilePutContents ¶
FilePutContents file_put_contents()
func Glob ¶
Glob returns the names of all files matching pattern or nil if there is no matching file. The syntax of patterns is the same as in Match. The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/').
Glob ignores file system errors such as I/O errors reading directories. The only possible returned error is ErrBadPattern, when pattern is malformed.
func LoadGobData ¶
func LoadGobData(data interface{}, fileName string)
LoadGobData 将gob写入的内容,载入到data中
func Pathinfo ¶
Pathinfo pathinfo() -1: all; 1: dirname; 2: basename; 4: extension; 8: filename Usage: Pathinfo("/home/go/path/src/php2go/php2go.go", 1|2|4|8)
func StoreGobData ¶
StoreGobData store gob data
Types ¶
This section is empty.