github.com/gogf/gf@v1.16.9/.example/os/gfile/gfile_contents.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/gogf/gf/os/gfile" 7 ) 8 9 func main() { 10 path := "/tmp/temp" 11 content := `123 12 456 13 789 14 ` 15 gfile.PutContents(path, content) 16 fmt.Println(gfile.Size(path)) 17 fmt.Println(gfile.GetBytesTilCharByPath(path, '\n', 0)) 18 fmt.Println(gfile.GetBytesTilCharByPath(path, '\n', 3)) 19 fmt.Println(gfile.GetBytesTilCharByPath(path, '\n', 8)) 20 fmt.Println(gfile.GetBytesTilCharByPath(path, '\n', 12)) 21 }