Documentation ¶
Index ¶
- func CopyAllContent(srcDir string, dstDir string) error
- func CopyContent(src string, dst string) error
- func Exists(path string) (bool, error)
- func ListAll(dirPath string) ([]string, error)
- func ListAllFiles(dirPath string) ([]string, error)
- func Lowercase(path string) error
- func LowercaseAll(dirPath string) error
- func MkFile(filePath string) (*os.File, error)
- func MkFileFromBytes(filePath string, b []byte) error
- func MkFileFromReader(filePath string, r io.Reader) error
- func MkParents(filePath string) error
- func MoveAllContent(srcDir string, dstDir string) error
- func MoveContent(src string, dst string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyAllContent ¶ added in v0.10.0
CopyAllContent copies all files from srcDir to dstDir recursively. Only files' name and content are guaranteed to be the same. Only files are copied, (empty) directories are ignored. Any existing files will be overridden.
func CopyContent ¶ added in v0.10.0
CopyContent copies the file src to dst. Only the file's name and content are guaranteed to be the same. The parents will be created if they don't exist. The existing file will be overridden.
func Exists ¶ added in v0.7.0
Exists checks if the file or directory exists. If Exists cannot determinate whether the file or directory exists (e.g., permission error), it returns an error.
func ListAll ¶ added in v0.10.0
ListAll lists all files and directories under the directory dirPath.
func ListAllFiles ¶ added in v0.10.0
ListAllFiles lists all files under the directory dirPath.
func Lowercase ¶ added in v0.10.0
Lowercase renames the file or directory to lowercase. If the file or directory is already lower-cased, it does nothing.
func LowercaseAll ¶
LowercaseAll renames the directory to lowercase recursively. If a file or directory is already lower-cased, LowercaseAll does nothing to it.
func MkFile ¶ added in v0.10.0
MkFile creates a file and its parents with respectively mode 0666 and 0755 (both before unmask). If the parents of the file already exist, MkFile does nothing. If the file already exist, MkFile truncates it.
func MkFileFromBytes ¶ added in v0.10.0
MkFileFromBytes calls MkFile and then writes the content of the bytes to the file.
func MkFileFromReader ¶ added in v0.10.0
MkFileFromReader calls MkFile and then writes the content of the reader to the file.
Note that it's the caller's responsibility to close the reader.
func MkParents ¶ added in v0.10.0
MkParents creates all parents of a file with mode 0755 (before unmask). If the parents of the file already exist, MkParents does nothing.
func MoveAllContent ¶ added in v0.10.0
MoveAllContent moves all files from srcDir to dstDir recursively. Only files' name and content are guaranteed to be the same. Only files are moved, (empty) directories are ignored. Any existing files will be overridden.
Use MoveAllContent to prevent os.Rename to panic "invalid cross-device link".
func MoveContent ¶ added in v0.10.0
MoveContent moves the file src to dst. Only the file's name and content are guaranteed to be the same. The parents will be created if they don't exist. The existing file will be overridden.
Types ¶
This section is empty.