Skip to content

Commit 51e4dba

Browse files
committed
Added Append function
1 parent 8e67c68 commit 51e4dba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

paths.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ func (p *Path) Create() (*os.File, error) {
472472
return os.Create(p.path)
473473
}
474474

475+
// Append opens a file for append or creates it if the file doesn't exist.
476+
func (p *Path) Append() (*os.File, error) {
477+
return os.OpenFile(p.path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
478+
}
479+
475480
// EqualsTo return true if both paths are equal
476481
func (p *Path) EqualsTo(other *Path) bool {
477482
return p.path == other.path

0 commit comments

Comments
 (0)