摘要: package main import ( "fmt" "io/ioutil" ) func FormatSize(size int64) string { units := [6]string{"B", "KB", "MB", "GB", "TB", "PB"} fsize := float64( 阅读全文
posted @ 2022-02-03 16:44 wangsk 阅读(95) 评论(0) 推荐(0)
摘要: package main import ( "fmt" "io" "os" ) /* 拷贝文件 读 写入新文件 */ func CopyFile(src, dest string) error { srcFile, err := os.Open(src) if err != nil { return 阅读全文
posted @ 2022-02-03 15:34 wangsk 阅读(302) 评论(0) 推荐(0)
摘要: package main import ( "fmt" "io" "os" "strings" ) type fileFilter func(fpath string) bool type callBack func(path string) func ReadFile(path string) { 阅读全文
posted @ 2022-02-03 11:17 wangsk 阅读(125) 评论(0) 推荐(0)
摘要: package main import ( "log" "os" ) func main() { file, err := os.OpenFile("logfile.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModePerm) if err != nil 阅读全文
posted @ 2022-02-03 10:12 wangsk 阅读(423) 评论(0) 推荐(0)