Documentation
¶
Overview ¶
Helpers for working with files and filesystems
Index ¶
- Variables
- func AddMimeTypeFile(filename string)
- func GetMimeType(filenameOrReader interface{}, fallback ...string) string
- func InitMime()
- func IsTerminal() bool
- func MustReadAll(filename string) []byte
- func MustReadAllString(filename string) string
- func MustWriteFile(reader io.Reader, filename string) int64
- func ReadAll(filename string) ([]byte, error)
- func ReadAllLines(filename string) ([]string, error)
- func ReadAllString(filename string) (string, error)
- func ReadFirstLine(filename string) (string, error)
- func WriteFile(reader io.Reader, filename string) (int64, error)
- type RewriteFileSystem
Constants ¶
This section is empty.
Variables ¶
var DirExists = pathutil.DirExists
Alias functions from pathutil as a convenience
var Exists = pathutil.Exists
var ExpandUser = pathutil.ExpandUser
var FileExists = pathutil.FileExists
var IsAppend = pathutil.IsAppend
var IsAppendable = pathutil.IsAppendable
var IsCharDevice = pathutil.IsCharDevice
var IsDevice = pathutil.IsDevice
var IsExclusive = pathutil.IsExclusive
var IsNamedPipe = pathutil.IsNamedPipe
var IsNonemptyDir = pathutil.IsNonemptyDir
var IsNonemptyExecutableFile = pathutil.IsNonemptyExecutableFile
var IsNonemptyFile = pathutil.IsNonemptyFile
var IsReadable = pathutil.IsReadable
var IsSetgid = pathutil.IsSetgid
var IsSetuid = pathutil.IsSetuid
var IsSocket = pathutil.IsSocket
var IsSticky = pathutil.IsSticky
var IsSymlink = pathutil.IsSymlink
var IsTemporary = pathutil.IsTemporary
var IsWritable = pathutil.IsWritable
var LinkExists = pathutil.LinkExists
Functions ¶
func AddMimeTypeFile ¶ added in v1.6.14
func AddMimeTypeFile(filename string)
func GetMimeType ¶ added in v1.6.14
GetMimeType goes out of its way to really, really try to figure out the MIME type of a given filename or io.Reader. If the first argument satisfies the io.Seeker interface, the seeker will Seek() back to the beginning. If it satisfies the io.Closer interface, it will be closed.
func IsTerminal ¶
func IsTerminal() bool
func MustReadAll ¶
func MustReadAllString ¶
func MustWriteFile ¶ added in v1.6.26
Same as WriteFile, but will panic if the file cannot be written.
func ReadAllLines ¶ added in v1.6.13
func ReadAllString ¶
func ReadFirstLine ¶ added in v1.6.13
func WriteFile ¶ added in v1.6.26
Write the contents of the given reader to the specified filename. Filename paths containing tilde (~) will automatically expand to the current user's home directory, and all intermediate parent directories will be automatically created. Will return the number of bytes written, or an error.