fs

package
v0.0.0-...-2611440 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: MIT, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KitFs

type KitFs struct {
	Fs afero.Fs
}

KitFs wraps an afero.Fs

func Get

func Get() *KitFs

Get returns a new KitFs if it was not initiated before or it returns the existing gKitFs if it is initiated.

func NewKitFs

func NewKitFs(rootDir string) *KitFs

NewKitFs creates a KitFs with `dir` as root.

func (*KitFs) Copy

func (kf *KitFs) Copy(sourcePath, destPath string) error

func (*KitFs) Exists

func (kf *KitFs) Exists(path string) (bool, error)

Exists returns true,nil if the dir/file exists or false,nil if the dir/file does not exist, it will return an error if something went wrong.

func (*KitFs) MakeDir

func (kf *KitFs) MakeDir(path string) error

MakeDir create dif if not exists

func (*KitFs) ReadFile

func (kf *KitFs) ReadFile(path string) (string, error)

ReadFile reads the file from `path` and returns the content in string format or returns an error if it occurs.

func (*KitFs) WriteFile

func (kf *KitFs) WriteFile(path string, data string, force bool) error

WriteFile writs a file to the `path` with `data` as content, if `force` is set to true it will override the file if it already exists.

Jump to

Keyboard shortcuts

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