Documentation ¶
Index ¶
- func BytesToFile(path string, data []byte) error
- func ClearFile(path string) error
- func Create(path string) (*os.File, error)
- func CreateFile(path string) error
- func FileMD5(path string) (string, error)
- func FileMD5Reader(r io.Reader) (string, error)
- func FileSize(path string) (int64, error)
- func FileSizeFile(file *os.File) (int64, error)
- func FileToBytes(path string) []byte
- func IsDir(path string) bool
- func IsDirE(path string) (bool, error)
- func IsExist(path string) (bool, error)
- func IsFile(path string) bool
- func IsFileE(path string) (bool, error)
- func IsShortcut(path string) bool
- func IsSymlink(path string) bool
- func IsSymlinkE(path string) (bool, error)
- func ListDir(dir string) ([]string, error)
- func ListDirEntryPaths(dir string, cur bool) ([]string, error)
- func ListDirEntryPathsSymlink(dirname string, cur bool) ([]string, error)
- func ListFilenames(dir string) ([]string, error)
- func ReadLines(path string) ([]string, error)
- func ReadLinesV2(path string) ([]string, error)
- func ReadLinesV3(path string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToFile ¶
BytesToFile writes data to a file. If the file does not exist it will be created with permission mode 0644.
func Create ¶
Create creates or truncates file specified by path. If the file already exists, it is truncated. If the parent directory does not exist, it will be created with mode os.ModePerm(0777). If the file does not exist, it is created with mode 0666. If successfully called Create, the returned file can be used for I/O and the associated file descriptor has mode O_RDWR.
func CreateFile ¶
CreateFile creates a file specified by path. If the file already exists, it is truncated. If the parent directory does not exist, it will be created with mode os.ModePerm(0777).
func FileMD5Reader ¶
FileMD5Reader gets file MD5 from io.Reader.
func FileSizeFile ¶
FileSizeFile gets file size from os.File in bytes.
func IsDir ¶
IsDir checks whether a path is a directory. If the path is a symbolic link will follow it.
func IsDirE ¶
IsDirE checks whether a path is a directory with error. If the path is a symbolic link will follow it.
func IsExist ¶
IsExist checks whether the file or directory exists. Use os.Stat to get the info of the target file or dir to check whether exists. If os.Stat returns nil err, the target exists. If os.Stat returns a os.ErrNotExist err, the target does not exist. If the error returned is another type, the target is uncertain whether exists.
func IsFile ¶
IsFile checks whether a path is a file. If the path is a symbolic link will follow it.
func IsFileE ¶
IsFileE checks whether a path is a file with error. If the path is a symbolic link will follow it.
func IsShortcut ¶
IsShortcut checks a file whether is a shortcut on Windows.
func IsSymlink ¶
IsSymlink checks a file whether is a symbolic link on Linux. Note that this doesn't work for the shortcut file on windows. If you want to check a file whether is a shortcut file on Windows please use IsShortcut function.
func IsSymlinkE ¶
IsSymlinkE checks a file whether is a symbolic link on Linux. Note that this doesn't work for the shortcut file on windows. If you want to check a file whether is a shortcut file on Windows please use IsShortcut function.
func ListDir ¶
ListDir lists all the file or directory names in the specified directory. Note that ListDir don't traverse recursively.
func ListDirEntryPaths ¶
ListDirEntryPaths lists all the file or directory paths in the directory recursively. If the cur is true, result will include current directory. Note that GetDirAllEntryPaths won't follow symlink if the subdir is a symbolic link.
func ListDirEntryPathsSymlink ¶
ListDirEntryPathsSymlink lists all the file or dir paths in the directory recursively. If the cur is true result will include current directory.
func ListFilenames ¶
ListFilenames lists all filenames in the specified directory.
func ReadLines ¶
ReadLines reads all lines of the file. An error is returned if the specified file does not exist.
func ReadLinesV2 ¶
ReadLinesV2 reads all lines of the file. An error is returned if the specified file does not exist.
func ReadLinesV3 ¶
ReadLinesV3 reads all lines of the file. An error is returned if the specified file does not exist.
Types ¶
This section is empty.