fileio

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader is a struct for reading files from the device

func NewReader

func NewReader() *Reader

New creates a new writer

func (*Reader) CheckPathExists

func (r *Reader) CheckPathExists(filePath string) error

CheckPathExists checks if a path exists and will return an error if either the file does not exist or if there is an error checking the path.

func (*Reader) PathFor

func (r *Reader) PathFor(filePath string) string

PathFor returns the full path for the provided file, useful for using functions and libraries that don't work with the fileio.Reader

func (*Reader) ReadFile

func (r *Reader) ReadFile(filePath string) ([]byte, error)

ReadFile reads the file at the provided path

func (*Reader) SetRootdir

func (r *Reader) SetRootdir(path string)

SetRootdir sets the root directory for the reader, useful for testing

type Writer

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

Writer is a struct for writing files to the device

func NewWriter

func NewWriter() *Writer

New creates a new writer

func (*Writer) PathFor

func (r *Writer) PathFor(filePath string) string

PathFor returns the full path for the provided file, useful for using functions and libraries that don't work with the fileio.Writer

func (*Writer) SetRootdir

func (r *Writer) SetRootdir(path string)

SetRootdir sets the root directory for the writer, useful for testing

func (*Writer) WriteFile

func (r *Writer) WriteFile(filePath string, data []byte) error

WriteFile writes the file at the provided path

func (*Writer) WriteStreamToFile

func (r *Writer) WriteStreamToFile(filePath string, stream io.ReadCloser) error

WriteStreamToFile write the stream to the file at the provided path

Jump to

Keyboard shortcuts

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