func IsReadable(path string) bool
func ExampleIsReadable() {
// init
var (
path = gfile.Pwd() + gfile.Separator + "testdata/readline/file.log"
)
// Checks whether given `path` is readable.
fmt.Println(gfile.IsReadable(path))
// Output:
// true
}
func IsWritable(path string) bool
func ExampleIsWritable() {
// init
var (
path = gfile.Pwd() + gfile.Separator + "testdata/readline/file.log"
)
// Checks whether given `path` is writable.
fmt.Println(gfile.IsWritable(path))
// Output:
// true
}
func Chmod(path string, mode os.FileMode) error
func ExampleChmod() {
// init
var (
path = gfile.Join(gfile.TempDir("gfile_example_basic_dir"), "file1")
)
// Get a FileInfo describing the named file.
stat, err := gfile.Stat(path)
if err != nil {
fmt.Println(err.Error())
}
// Show original mode
fmt.Println(stat.Mode())
// Change file model
gfile.Chmod(path, gfile.DefaultPermCopy)
// Get a FileInfo describing the named file.
stat, _ = gfile.Stat(path)
// Show the modified mode
fmt.Println(stat.Mode())
// Output:
// -rw-r--r--
// -rwxrwxrwx
}
备案信息: 粤ICP备15087711号-2
Copyright © 2008-2024 啊嘎哇在线工具箱 All Rights.
本站所有资料来源于网络,版权归原作者所有,仅作学习交流使用,如不慎侵犯了您的权利,请联系我们。