fs

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToFile

func AppendToFile(filePath string, text string) error

AppendToFile adds text to a file

func CopyAll added in v1.1.5

func CopyAll(srcDirPath, dstDirPath string, skipFileSuffix string) (err error)

CopyAll copies all files and directories inside `srcDirPath` to `dstDirPath`. Based on the CopyAll function from metaleap/go-utils

func CopyFile added in v1.1.5

func CopyFile(source string, destination string) error

CopyFile copys a file from source to destination

func EnsureDirExists added in v1.1.5

func EnsureDirExists(dirpath string) (err error)

EnsureDirExists makes sure that the directory exists

func TempDir added in v1.1.5

func TempDir(dir string, prefix string) (string, error)

TempDir creates a temporary directory

Types

type OSUtil

type OSUtil struct {
}

OSUtil is the struct for dealing with File System Operations on the disk.

func (OSUtil) AppendOrCreate

func (fs OSUtil) AppendOrCreate(filePath string, text string) error

AppendOrCreate adds text to file if it exists otherwise it creates a new file with the given text

func (OSUtil) Copy

func (fs OSUtil) Copy(source string, destination string) error

Copy copies one file from source to destination

func (OSUtil) CopyAll

func (fs OSUtil) CopyAll(source string, destination string) error

CopyAll copies recursively from source to destination

func (OSUtil) Mkdirs

func (fs OSUtil) Mkdirs(dir string) error

Mkdirs ensures that the directory is created.

func (OSUtil) OpenAndReadFile

func (fs OSUtil) OpenAndReadFile(file string) ([]byte, error)

OpenAndReadFile is a util that will check if the file exists, open and then read the file.

func (OSUtil) TempDir

func (fs OSUtil) TempDir(dir string, prefix string) (string, error)

TempDir creates a temp directory that the user is responsible for cleaning up

type Util

type Util interface {
	OpenAndReadFile(file string) ([]byte, error)
	CopyAll(source string, destination string) error
	Copy(source string, destination string) error
	TempDir(dir string, prefix string) (string, error)
	Mkdirs(dir string) error
	AppendOrCreate(filePath string, text string) error
}

Util is an interface for helper file system utilities.

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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