file

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2023 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a wrapper around afero.Afero, providing a simple interface for reading and writing files.

func New

func New(filename string, fs afero.Fs) *Handler

New returns a new FileWriter for the given filename.

Returns nil if filename is empty.

func (*Handler) Name

func (f *Handler) Name() string

Name returns the filename.

func (*Handler) Read

func (f *Handler) Read() ([]byte, error)

Read reads the file and returns its contents.

func (*Handler) Write

func (f *Handler) Write(data []byte) error

Write writes the given data to the file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL