Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Just like ls command, in the path, list all files in array of fs.DisEntry It will return an array of fs.DirEntry Example: files := filesystem.Dir("/home/user", ".txt") It will return all files in the directory /home/user with .txt extension If filter is empty or "*", it will return all files in the directory Output: [file1.txt file2.txt file3.txt]
func DirFileExist ¶
Check if file or directory exist. if directory=true then check if exist AND also if it's a dir Example: exist := filesystem.DirFileExist("/home/user/test.txt", false) It will return true if the file "test.txt" exist exist = filesystem.DirFileExist("/home/user/test", true) It will return true if the directory "test" exist
func DirPath ¶
Return the directory name (everything beside the filename) DirPath will return the directory name of the complete path Example: dir := filesystem.DirPath("/home/user/test.txt") It will return "/home/user"
func FileName ¶
This is a simple way to get the filename from a complete path It will return the filename only, without the path Example: filename := filesystem.Base("/home/user/test.txt") It will return "test.txt"
func More ¶
Only for textfile, this will read the file and return as array of string per line This is a simple way to read a file line by line It will return an array of string, each line is a string It will return an empty array if the file is not found or error Example: content := filesystem.More("test.txt")
Types ¶
This section is empty.