Documentation ¶
Index ¶
- Constants
- func AppendContents(filename, content string) error
- func AppendString(filename, content string) error
- func Basename(path string) string
- func Chmod(name string, mode os.FileMode) error
- func Chown(name string, uid, gid int) error
- func Contains(arr []string, item string) bool
- func Copy(source, dest string) (err error)
- func Dirname(path string) string
- func Exec(name string, arg ...string) (string, error)
- func Exists(filename string) (bool, error)
- func Extname(path string) string
- func GetContents(filename string) (string, error)
- func Md5(filename string) (string, error)
- func Min(a, b int) int
- func Mkdir(name string, perm os.FileMode) error
- func MkdirAll(path string, perm os.FileMode) error
- func MkdirP(path string, perm os.FileMode) error
- func ModTime(filename string) (time.Time, error)
- func ModTimeUnix(filename string) (int64, error)
- func ModTimeUnixNano(filename string) (int64, error)
- func Mode(filename string) (os.FileMode, error)
- func Perm(filename string) (os.FileMode, error)
- func PutContents(filename, content string) error
- func RandString(len int) string
- func Read(filename string) ([]byte, error)
- func ReadString(filename string) (string, error)
- func Remove(name string) error
- func RemoveAll(path string) error
- func Rename(oldpath, newpath string) error
- func Rmdir(path string) error
- func Sha1(filename string) (string, error)
- func Size(filename string) (int64, error)
- func String(s string) *string
- func TempFile() (*os.File, error)
- func TempName() (string, error)
- func Touch(filename string) error
- func Unlink(name string) error
- func Write(filename string, content []byte) error
- func WriteString(filename, content string) error
- type FileInfo
- type FilesInfo
Constants ¶
const (
NEW_FILE_PERM = 0644
)
Variables ¶
This section is empty.
Functions ¶
func AppendContents ¶
AppendContents appends the contents of the string to filename. AppendContents is equivalent to AppendString.
func AppendString ¶
AppendString appends the contents of the string to filename.
func GetContents ¶
GetContents reads the file named by filename and returns the contents as string. GetContents is equivalent to ReadString.
func MkdirP ¶
MkdirP creates a directory named path, along with any necessary parents. MkdirP is equivalent to MkdirAll.
func ModTimeUnix ¶
ModTimeUnix return the Last Modified Unix Timestamp of the given filename. Returns -1 if the file does not exist or if the file modtime cannot be determined.
func ModTimeUnixNano ¶
ModTimeUnixNano return the Last Modified Unix Time of nanoseconds of the given filename. Returns -1 if the file does not exist or if the file modtime cannot be determined.
func Mode ¶
Mode return the FileMode of the given filename. Returns 0 if the file does not exist or if the file mode cannot be determined.
func Perm ¶
Perm return the Unix permission bits of the given filename. Returns 0 if the file does not exist or if the file mode cannot be determined.
func PutContents ¶
PutContents writes the contents of the string to filename. PutContents is equivalent to WriteString.
func RandString ¶
func ReadString ¶
ReadString reads the file named by filename and returns the contents as string.
func Size ¶
Size return the size of the given filename. Returns -1 if the file does not exist or if the file size cannot be determined.
func TempFile ¶
TempFile creates a new temporary file in the default directory for temporary files (see os.TempDir), opens the file for reading and writing, and returns the resulting *os.File.
func TempName ¶
TempName creates a new temporary file in the default directory for temporary files (see os.TempDir), opens the file for reading and writing, and returns the filename.
func WriteString ¶
WriteString writes the contents of the string to filename.
Types ¶
type FileInfo ¶
func GetFileInfo ¶
GetFileInfo returns a FileInfo describing the named file
type FilesInfo ¶
type FilesInfo []FileInfo
func Find ¶
Find returns the FilesInfo([]FileInfo) of all files matching pattern or nil if there is no matching file. The syntax of patterns is the same as in Match. The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/').
func (FilesInfo) SortByModTime ¶
func (fis FilesInfo) SortByModTime()
SortByModTime sorts a slice of files by file modified time in increasing order.
func (FilesInfo) SortByModTimeReverse ¶
func (fis FilesInfo) SortByModTimeReverse()
SortByModTimeReverse sorts a slice of files by file modified time in decreasing order.
func (FilesInfo) SortByName ¶
func (fis FilesInfo) SortByName()
SortByName sorts a slice of files by filename in increasing order.
func (FilesInfo) SortByNameReverse ¶
func (fis FilesInfo) SortByNameReverse()
SortByNameReverse sorts a slice of files by filename in decreasing order.
func (FilesInfo) SortBySize ¶
func (fis FilesInfo) SortBySize()
SortBySize sorts a slice of files by filesize in increasing order.
func (FilesInfo) SortBySizeReverse ¶
func (fis FilesInfo) SortBySizeReverse()
SortBySizeReverse sorts a slice of files by filesize in decreasing order.