Documentation ¶
Index ¶
- Variables
- func Expand(path string) (string, error)
- func HomeDir() (string, error)
- func Reset()
- type File
- func (f *File) Abs(path string) (string, *errorAVA.Error)
- func (f *File) FileAppendBytes(filename string, data []byte) *errorAVA.Error
- func (f *File) FileAppendPrintf(filename, format string, args ...interface{}) *errorAVA.Error
- func (f *File) FileAppendString(filename string, data string) *errorAVA.Error
- func (f *File) FileCRC64(filenameOrURL string) (uint64, *errorAVA.Error)
- func (f *File) FileCopy(source string, dest string) *errorAVA.Error
- func (f *File) FileCopyDir(source string, dest string) *errorAVA.Error
- func (f *File) FileExists(filename string) *errorAVA.Error
- func (f *File) FileFind(searchDirs []string, filenames ...string) (filePath string, found bool)
- func (f *File) FileFindModified(searchDirs []string, filenames ...string) (filePath string, found bool, modified time.Time)
- func (f *File) FileGetBytes(filenameOrURL string, timeout ...time.Duration) ([]byte, *errorAVA.Error)
- func (f *File) FileGetCSV(filenameOrURL string, timeout ...time.Duration) ([][]string, *errorAVA.Error)
- func (f *File) FileGetGz(filenameOrURL string) ([]byte, *errorAVA.Error)
- func (f *File) FileGetInflate(filenameOrURL string) ([]byte, *errorAVA.Error)
- func (f *File) FileGetJSON(filenameOrURL string, timeout ...time.Duration) (result interface{}, err *errorAVA.Error)
- func (f *File) FileGetLastLine(filenameOrURL string, timeout ...time.Duration) (line string, err *errorAVA.Error)
- func (f *File) FileGetLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error)
- func (f *File) FileGetNonEmptyLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error)
- func (f *File) FileGetString(filenameOrURL string, timeout ...time.Duration) (string, *errorAVA.Error)
- func (f *File) FileGetXML(filenameOrURL string, timeout ...time.Duration) (result interface{}, err *errorAVA.Error)
- func (f *File) FileIsDir(dirname string) bool
- func (f *File) FileMD5Bytes(filenameOrURL string) ([]byte, *errorAVA.Error)
- func (f *File) FileMD5String(filenameOrURL string) (string, *errorAVA.Error)
- func (f *File) FilePrintf(filename, format string, args ...interface{}) *errorAVA.Error
- func (f *File) FileScanf(filename, format string, args ...interface{}) *errorAVA.Error
- func (f *File) FileSetBytes(filename string, data []byte) *errorAVA.Error
- func (f *File) FileSetCSV(filename string, records [][]string) *errorAVA.Error
- func (f *File) FileSetJSON(filename string, data interface{}) *errorAVA.Error
- func (f *File) FileSetJSONIndent(filename string, data interface{}, indent string) *errorAVA.Error
- func (f *File) FileSetLines(filename string, lines []string) *errorAVA.Error
- func (f *File) FileSetString(filename string, data string) *errorAVA.Error
- func (f *File) FileSetXML(filename string, data interface{}) *errorAVA.Error
- func (f *File) FileSize(filename string) int64
- func (f *File) FileTimeModified(filename string) time.Time
- func (f *File) FileTouch(filename string) *errorAVA.Error
- func (f *File) FileUnmarshallJSON(filenameOrURL string, result interface{}, timeout ...time.Duration) *errorAVA.Error
- func (f *File) FileUnmarshallXML(filenameOrURL string, result interface{}, timeout ...time.Duration) *errorAVA.Error
- func (f *File) ListDir(dir string) ([]string, *errorAVA.Error)
- func (f *File) ListDirDirectories(dir string) ([]string, *errorAVA.Error)
- func (f *File) ListDirFiles(dir string) ([]string, *errorAVA.Error)
- type FileI
Constants ¶
This section is empty.
Variables ¶
var DisableCache bool
DisableCache will disable caching of the home directory. Caching is enabled by default.
Functions ¶
func Expand ¶
Expand expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is.
Types ¶
type File ¶
type File struct { }
func (*File) Abs ¶
Abs returns an absolute representation of path. If the path is not absolute it will be joined with the current working directory to turn it into an absolute path. The absolute path name for a given file is not guaranteed to be unique. Abs calls Clean on the result.
func (*File) FileAppendBytes ¶
func (*File) FileAppendPrintf ¶
func (*File) FileAppendString ¶
func (*File) FileCopy ¶
FileCopy copies file source to destination dest. Based on Jaybill McCarthy's code which can be found at http://jayblog.jaybill.com/post/id/26
func (*File) FileCopyDir ¶
FileCopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist.
func (*File) FileFindModified ¶
func (*File) FileGetBytes ¶
func (*File) FileGetCSV ¶
func (*File) FileGetInflate ¶
func (*File) FileGetJSON ¶
func (*File) FileGetLastLine ¶
func (f *File) FileGetLastLine(filenameOrURL string, timeout ...time.Duration) (line string, err *errorAVA.Error)
FileGetLastLine reads the last line from a file. In case of a network file, the whole file is read. In case of a local file, the last 64kb are read, so if the last line is longer than 64kb it is not returned completely. The first optional timeout is used for network files only.
func (*File) FileGetLines ¶
func (f *File) FileGetLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error)
FileGetLines returns a string slice with the text lines of filenameOrURL. The lines can be separated by \n or \r\n.
func (*File) FileGetNonEmptyLines ¶
func (f *File) FileGetNonEmptyLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error)
FileGetNonEmptyLines returns a string slice with the non empty text lines of filenameOrURL. The lines can be separated by \n or \r\n.
func (*File) FileGetString ¶
func (*File) FileGetXML ¶
func (*File) FileMD5Bytes ¶
func (*File) FileMD5String ¶
func (*File) FilePrintf ¶
func (*File) FileSetBytes ¶
func (*File) FileSetCSV ¶
func (*File) FileSetJSON ¶
func (*File) FileSetJSONIndent ¶
func (*File) FileSetLines ¶
func (*File) FileSetString ¶
func (*File) FileSetXML ¶
func (*File) FileTimeModified ¶
FileTimeModified returns the modified time of a file, or the zero time value in case of an error.
func (*File) FileUnmarshallJSON ¶
func (*File) FileUnmarshallXML ¶
func (*File) ListDirDirectories ¶
type FileI ¶
type FileI interface { FileGetBytes(filenameOrURL string, timeout ...time.Duration) ([]byte, *errorAVA.Error) FileSetBytes(filename string, data []byte) *errorAVA.Error FileAppendBytes(filename string, data []byte) *errorAVA.Error FileGetString(filenameOrURL string, timeout ...time.Duration) (string, *errorAVA.Error) FileSetString(filename string, data string) *errorAVA.Error FileAppendString(filename string, data string) *errorAVA.Error FileGetJSON(filenameOrURL string, timeout ...time.Duration) (result interface{}, err *errorAVA.Error) FileUnmarshallJSON(filenameOrURL string, result interface{}, timeout ...time.Duration) *errorAVA.Error FileSetJSON(filename string, data interface{}) *errorAVA.Error FileSetJSONIndent(filename string, data interface{}, indent string) *errorAVA.Error FileGetXML(filenameOrURL string, timeout ...time.Duration) (result interface{}, err *errorAVA.Error) FileUnmarshallXML(filenameOrURL string, result interface{}, timeout ...time.Duration) *errorAVA.Error FileSetXML(filename string, data interface{}) *errorAVA.Error FileGetCSV(filenameOrURL string, timeout ...time.Duration) ([][]string, *errorAVA.Error) FileSetCSV(filename string, records [][]string) *errorAVA.Error FileGetLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error) FileSetLines(filename string, lines []string) *errorAVA.Error FileGetNonEmptyLines(filenameOrURL string, timeout ...time.Duration) (lines []string, err *errorAVA.Error) FileGetLastLine(filenameOrURL string, timeout ...time.Duration) (line string, err *errorAVA.Error) FileTimeModified(filename string) time.Time FileExists(filename string) *errorAVA.Error FileIsDir(dirname string) bool FileFind(searchDirs []string, filenames ...string) (filePath string, found bool) FileFindModified(searchDirs []string, filenames ...string) (filePath string, found bool, modified time.Time) FileTouch(filename string) *errorAVA.Error FileMD5String(filenameOrURL string) (string, *errorAVA.Error) FileMD5Bytes(filenameOrURL string) ([]byte, *errorAVA.Error) FileCRC64(filenameOrURL string) (uint64, *errorAVA.Error) FileGetInflate(filenameOrURL string) ([]byte, *errorAVA.Error) FileGetGz(filenameOrURL string) ([]byte, *errorAVA.Error) FileSize(filename string) int64 FilePrintf(filename, format string, args ...interface{}) *errorAVA.Error FileAppendPrintf(filename, format string, args ...interface{}) *errorAVA.Error FileScanf(filename, format string, args ...interface{}) *errorAVA.Error ListDir(dir string) ([]string, *errorAVA.Error) ListDirFiles(dir string) ([]string, *errorAVA.Error) ListDirDirectories(dir string) ([]string, *errorAVA.Error) FileCopy(source string, dest string) (err *errorAVA.Error) FileCopyDir(source string, dest string) (err *errorAVA.Error) Abs(path string) (string, *errorAVA.Error) }