fshelper

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem interface {
	Glob(pattern string) ([]string, error)
	PathExists(path string) (bool, error)
	ReadFile(filepath string) ([]byte, error)
	WriteToFile(filepath string, data []byte) error
	EvalSymlinks(path string) (string, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
}

FileSystem is an interface for interacting with the filesystem

type LinuxFileSystem

type LinuxFileSystem struct {
}

LinuxFileSystem is an implementation of Filesystem available for use from this package

func (l *LinuxFileSystem) EvalSymlinks(path string) (string, error)

EvalSymlinks is a shim implementation on top of `filepath.EvalSymlinks`

func (*LinuxFileSystem) Glob

func (l *LinuxFileSystem) Glob(pattern string) ([]string, error)

Glob globs things

func (*LinuxFileSystem) PathExists

func (l *LinuxFileSystem) PathExists(path string) (bool, error)

PathExists returns a bool reflecting if a path exists, or not

func (*LinuxFileSystem) ReadDir

func (l *LinuxFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir is a shim for ioutil.ReadDir

func (*LinuxFileSystem) ReadFile

func (l *LinuxFileSystem) ReadFile(filepath string) ([]byte, error)

ReadFile reads a file into a byte slice

func (*LinuxFileSystem) WriteToFile

func (l *LinuxFileSystem) WriteToFile(filepath string, data []byte) error

WriteToFile writes a bytestream to a file.

Jump to

Keyboard shortcuts

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