Documentation ¶
Index ¶
- type FSInfo
- type FSPath
- type FileReader
- func (fr *FileReader) Bytes() []byte
- func (fr *FileReader) Err() error
- func (fr *FileReader) Info() os.FileInfo
- func (fr *FileReader) Into(w io.Writer) *FileReader
- func (fr *FileReader) Lines() []string
- func (fr *FileReader) SetVars(variables *vars.Variables) *FileReader
- func (fr *FileReader) String() string
- type FileWriter
- func (fw *FileWriter) Bytes(data []byte) *FileWriter
- func (fw *FileWriter) Err() error
- func (fw *FileWriter) From(r io.Reader) *FileWriter
- func (fw *FileWriter) Info() os.FileInfo
- func (fw *FileWriter) Lines(lines []string) *FileWriter
- func (fw *FileWriter) SetVars(variables *vars.Variables) *FileWriter
- func (fw *FileWriter) String(str string) *FileWriter
- func (fw *FileWriter) WithMode(mode os.FileMode) *FileWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSInfo ¶ added in v0.3.0
type FSInfo struct {
// contains filtered or unexported fields
}
type FSPath ¶ added in v0.3.0
type FSPath struct {
// contains filtered or unexported fields
}
func PathWithVars ¶ added in v0.3.0
PathWithVars points to a path and applies variables to the path value
func (*FSPath) Append ¶ added in v0.3.0
func (p *FSPath) Append() *FileWriter
Append wraps call to create a new *FileWriter instance for file append operations
func (*FSPath) Exists ¶ added in v0.3.0
Exists returns true only if os.Stat nil error. Any other scenarios will return false.
func (*FSPath) Read ¶ added in v0.3.0
func (p *FSPath) Read() *FileReader
Read wraps call to create a new *FileReader instance
func (*FSPath) Write ¶ added in v0.3.0
func (p *FSPath) Write() *FileWriter
Write wraps call to create a new *FileWriter instance
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func Read ¶
func Read(path string) *FileReader
Read creates a new FileReader using the provided path. A non-nil FileReader.Err() is returned if file does not exist or another error is generated.
func ReadWithVars ¶ added in v0.3.0
func ReadWithVars(path string, variables *vars.Variables) *FileReader
ReadWithVars creates a new FileReader and sets the reader's session variables
func (*FileReader) Bytes ¶
func (fr *FileReader) Bytes() []byte
Bytes returns the content of the file as []byte
func (*FileReader) Err ¶
func (fr *FileReader) Err() error
Err returns an operation error during file read.
func (*FileReader) Info ¶
func (fr *FileReader) Info() os.FileInfo
Info surfaces the os.FileInfo for the associated file
func (*FileReader) Into ¶ added in v0.1.1
func (fr *FileReader) Into(w io.Writer) *FileReader
Into reads the content of the file and writes it into the specified Writer
func (*FileReader) Lines ¶
func (fr *FileReader) Lines() []string
Lines returns the content of the file as slice of string
func (*FileReader) SetVars ¶ added in v0.3.0
func (fr *FileReader) SetVars(variables *vars.Variables) *FileReader
SetVars sets the FileReader's session variables
func (*FileReader) String ¶
func (fr *FileReader) String() string
String returns the content of the file as a string value
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func Append ¶
func Append(path string) *FileWriter
Append creates a new FileWriter with flags os.O_CREATE | os.O_APPEND | os.O_WRONLY and mode 0644
func AppendWitVars ¶ added in v0.3.0
func AppendWitVars(path string, variables *vars.Variables) *FileWriter
AppendWithVars creates a new FileWriter and sets session variables
func Write ¶
func Write(path string) *FileWriter
Write creates a new FileWriter with flags os.O_CREATE | os.O_TRUNC | os.O_WRONLY and mode 0644.
func WriteWithVars ¶ added in v0.3.0
func WriteWithVars(path string, variables *vars.Variables) *FileWriter
WriteWithVars creates a new FileWriter and sets sessions variables
func (*FileWriter) Bytes ¶
func (fw *FileWriter) Bytes(data []byte) *FileWriter
Bytes writes the []bytre provided into the file. Any error can be accessed using FileWriter.Err().
func (*FileWriter) Err ¶
func (fw *FileWriter) Err() error
Err returns FileWriter error during execution
func (*FileWriter) From ¶ added in v0.1.1
func (fw *FileWriter) From(r io.Reader) *FileWriter
From streams bytes from the provided io.Reader r and writes them to the file. Any error will be captured and returned by fw.Err().
func (*FileWriter) Info ¶
func (fw *FileWriter) Info() os.FileInfo
Info returns the os.FileInfo for the associated file
func (*FileWriter) Lines ¶
func (fw *FileWriter) Lines(lines []string) *FileWriter
Lines writes the slice of strings into the file. Any error will be captured and returned via FileWriter.Err().
func (*FileWriter) SetVars ¶ added in v0.3.0
func (fw *FileWriter) SetVars(variables *vars.Variables) *FileWriter
SetVars sets session variables for FileWriter
func (*FileWriter) String ¶
func (fw *FileWriter) String(str string) *FileWriter
String writes the provided str into the file. Any error that occurs can be accessed with FileWriter.Err().
func (*FileWriter) WithMode ¶ added in v0.3.0
func (fw *FileWriter) WithMode(mode os.FileMode) *FileWriter