Documentation
¶
Index ¶
- type Buffer
- func (n *Buffer) Add(w any) (err error)
- func (n *Buffer) AddBytes(w []byte) error
- func (n *Buffer) AddString(w string) error
- func (n *Buffer) Buffered() int
- func (n *Buffer) Close() error
- func (n *Buffer) CopyIn(in io.Writer) (written int64, err error)
- func (n *Buffer) CopyTo(to io.Reader) (written int64, err error)
- func (n *Buffer) Flush() error
- func (n *Buffer) MaxBuffer(max int)
- type Os
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶ added in v1.43.0
type Buffer struct {
// contains filtered or unexported fields
}
Buffer represents a type used for buffered writing with configurable buffer limits and support for various data types.
func NewWriter ¶
NewWriter initializes and returns a new instance of Buffer with a buffered writer, writing to the specified file path. If the file cannot be opened or created, it returns an error.
func (*Buffer) Add ¶ added in v1.43.0
Add writes the provided data to the internal writer. It supports string, []byte, or other types convertible to string.
func (*Buffer) AddBytes ¶ added in v1.43.0
AddBytes writes the provided byte slice to the internal buffered writer and returns an error if the write fails.
func (*Buffer) AddString ¶ added in v1.43.0
AddString writes the provided string to the internal buffered writer and returns an error if the write operation fails.
func (*Buffer) Buffered ¶ added in v1.43.0
Buffered returns the number of bytes currently stored in the internal buffer of the writer.
func (*Buffer) Close ¶ added in v1.43.0
Close finalizes the buffered writing operations by flushing the buffer and closing the associated file. Returns an error if any fail.
func (*Buffer) CopyIn ¶ added in v1.43.0
CopyIn flushes the internal buffer and copies data from the internal file to the provided Writer.
func (*Buffer) CopyTo ¶ added in v1.43.0
CopyTo transfers data from the provided io.Reader to the internal buffered writer. Returns the number of bytes written and an error.
type Os ¶ added in v1.43.0
type Os struct {
// contains filtered or unexported fields
}
Os represents a wrapper around an *os.File object for performing write operations.
func NewOSWriter ¶ added in v1.27.0
NewOSWriter creates and returns a new Os instance for writing to the specified file path with necessary permissions.
func (*Os) Add ¶ added in v1.43.0
Add writes the provided value to the underlying os. Supports string, byte slice, or defaults to string conversion.
func (*Os) AddBytes ¶ added in v1.43.0
AddBytes writes the provided byte slice to the underlying file and returns an error if the write operation fails.