// Package filex provides common file system helpers on top of gfile. package filex import ( "github.com/gogf/gf/v2/os/gfile" ) // Exists reports whether the file or directory at path exists. func Exists(path string) bool { return gfile.Exists(path) } // IsDir reports whether path is a directory. func IsDir(path string) bool { return gfile.IsDir(path) } // ReadString returns the full content of the file at path as a string. // Returns an empty string when the file does not exist. func ReadString(path string) string { return gfile.GetContents(path) } // WriteString writes content to the file at path, creating intermediate // directories if needed. func WriteString(path, content string) error { return gfile.PutContents(path, content) }