This commit is contained in:
siddontang 2014-09-17 13:11:39 +08:00
parent d1d84f2faa
commit 9b05f61506
3 changed files with 8 additions and 2 deletions

View File

@ -31,3 +31,9 @@ func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error {
}
return os.Rename(f.Name(), filename)
}
// Check file exists or not
func FileExists(name string) bool {
_, err := os.Stat(name)
return !os.IsNotExist(err)
}

View File

@ -1,4 +1,4 @@
package io2
package ioutil2
import (
"errors"

View File

@ -1,4 +1,4 @@
package io2
package ioutil2
import (
"io/ioutil"