Documentation
¶
Index ¶
- Variables
- func IsExistErr(err error) bool
- func IsNotFoundErr(err error) bool
- func IsPermissionErr(err error) bool
- func OpenDir(path string, mode int, perm uint32) (dir *Dir, stat Stat, err error)
- func OpenFile(path string, mode int, perm uint32) (file *File, stat Stat, err error)
- type Dir
- func (f *Dir) Chdir() (err error)
- func (f *Dir) Chmod(mode uint32) (err error)
- func (f *Dir) Chown(uid, gid int) (err error)
- func (d *Dir) IterDirents(buf []byte, fn func(*Dirent) error) (err error)
- func (f *Dir) Path() string
- func (d *Dir) ReadDirents(buf []byte) (ents []Dirent, err error)
- func (f *Dir) Stat() (stat Stat, err error)
- type Dirent
- type File
- func (f *File) Chdir() (err error)
- func (f *File) Chmod(mode uint32) (err error)
- func (f *File) Chown(uid, gid int) (err error)
- func (f *File) Fallocate(mode uint32, off int64, len int64) error
- func (f *File) Path() string
- func (f *File) Read(b []byte) (nn int, err error)
- func (f *File) Seek(offset int64, whence int) (off int64, err error)
- func (f *File) Stat() (stat Stat, err error)
- func (f *File) Sync() error
- func (f *File) Write(b []byte) (nn int, err error)
- func (f *File) WriteString(s string) (int, error)
- type Stat
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported is returned on attempt to open a directory as File{}, or non-directory as Dir{}. ErrUnsupported = errors.New("unsupported file mode") // ErrAlreadyClosed is returned on use of a closed (also, I guess, unopened) file. ErrAlreadyClosed = errors.New("use of closed file") // StopIterator is a flag error used to signify early return in iterator functions. It will never be returned. StopIterator = errors.New("[BUG]: ErrStopIter should never be returned") )
Functions ¶
func IsExistErr ¶
func IsNotFoundErr ¶
func IsPermissionErr ¶
Types ¶
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir represents a (directory) file descriptor, providing syscall helper methods. Note that it skips a lot of the nuances offered by os.File{} for other file types, and provides no form of protection for concurrent use.
func (*Dir) IterDirents ¶
IterDirents calls getdents() on file descriptor, using given buffer. Entries are passed to fn.
func (*Dir) Path ¶
func (f *Dir) Path() string
Path returns the filesystem path associated with this file.
func (*Dir) ReadDirents ¶
ReadDirents calls getdents() on file descriptor, using given buffer.
type Dirent ¶
Dirent is a type alias to unix.Dirent.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a (non-dir) file descriptor, providing syscall helper methods. Note that it skips a lot of the nuances offered by os.File{} for other file types, and provides no form of protection for concurrent use.
func Stdin ¶
func Stdin() *File
Stdin, Stdout, and Stderr return File structures pointing to standard input, standard output and standard error. These are returned as new objects each time due to the lack of concurrency protection within the File structure itself.
func (*File) Fallocate ¶
Fallocate will call fallocate() with given mode, offset and legnth on file descriptor.
func (*File) Path ¶
func (f *File) Path() string
Path returns the filesystem path associated with this file.
func (*File) Seek ¶
Seek will call seek() on file descriptor with given offset and return new offset.