Skip to content

Commit

Permalink
Add the CreateFile func to create a file without truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
mstmdev committed Dec 23, 2021
1 parent d482ba2 commit f979cb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions util/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ func FileExist(path string) (exist bool, err error) {
}
return true, nil
}

// CreateFile create a file without truncate
func CreateFile(name string) (*os.File, error) {
return os.OpenFile(name, os.O_RDWR|os.O_CREATE, 0666)
}

0 comments on commit f979cb4

Please sign in to comment.