Documentation
¶
Index ¶
- type ErrInvalidFile
- type File
- func (f *File) Append(data []byte) error
- func (f *File) AppendLines(data []string) error
- func (f *File) AppendString(data string) error
- func (f *File) Copy(destin string) error
- func (f *File) Exists() (bool, error)
- func (f *File) IsDir() (bool, error)
- func (f *File) IsRegular() (bool, error)
- func (f *File) List() ([]File, error)
- func (f *File) Move(destin string) error
- func (f *File) Name() string
- func (f *File) PathAbs() (string, error)
- func (f *File) PathAbsResolved() (string, error)
- func (f *File) PathResolved() (string, error)
- func (f *File) Permissions() (fs.FileMode, error)
- func (f *File) Read() ([]byte, error)
- func (f *File) ReadLines() ([]string, error)
- func (f *File) ReadString() (string, error)
- func (f *File) Write(data []byte) error
- func (f *File) WriteLines(data []string) error
- func (f *File) WriteString(data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrInvalidFile ¶
type ErrInvalidFile struct{}
Error returned when an operation cannot be executed on the given file type.
func (*ErrInvalidFile) Error ¶
func (e *ErrInvalidFile) Error() string
type File ¶
type File struct {
Path string
}
File type describes a file. It may be a directory, regular or even non-existent file.
func (*File) AppendLines ¶
Appends a list of strings representing lines to a file. Is it doesn't exists, creates it.
func (*File) AppendString ¶
Appends a string to a file. Is it doesn't exists, creates it.
func (*File) List ¶
Lists all files inside the directory (if the file is a directory, otherwise throws an error).
func (*File) PathAbsResolved ¶
Resolves any symlinks in the absolute path of the file.
func (*File) PathResolved ¶
Resolves any symlinks in the file path.
func (*File) Permissions ¶
Returns the file permissions.
func (*File) ReadLines ¶
Reads and returns the content of a file as a list of strings representing the lines.
func (*File) ReadString ¶
Reads and returns the content of the file as a string.
func (*File) WriteLines ¶
Writes a list of strings into a file as lines. Overwrites any existing data.
func (*File) WriteString ¶
Writes a string into a file. Overwrites any existing data.