Documentation
¶
Index ¶
- func Copy(from, to string) (err error)
- func CopyTemp(from, to string) (err error)
- func CreateWith(path string, handler FileHandler) (err error)
- func CreateWithTemp(path string, handler FileHandler) error
- func Exists(path string) bool
- func HasPrefix(path string, prefix []byte) (bool, error)
- func IsDir(path string) bool
- func OpenFirst(paths ...string) (f *os.File, err error)
- func ReadLines(f io.Reader) (lines []string, err error)
- func ReadLinesFromFile(path string) (lines []string, err error)
- type FileHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateWith ¶ added in v0.3.0
func CreateWith(path string, handler FileHandler) (err error)
Create a file and use it inside a closure. Will automatically close the file after the closure completes and remove the corrupt file if an error is thrown.
func CreateWithTemp ¶ added in v0.3.0
func CreateWithTemp(path string, handler FileHandler) error
Like CreateWith, but will create a temporary file and rename it to the final path once the file has been written successfully. If an error occurs, the temp file will be removed.
func IsDir ¶ added in v0.8.1
Returns true if a path exists and is a directory. It still returns false even if the path doesn't exist.
func ReadLinesFromFile ¶ added in v0.9.6
Read all lines from a text file into a slice
Types ¶
type FileHandler ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.