fs

package
v0.0.0-...-c692de5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 6 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 defaultFs if it is initiated.

func NewDefaultFs

func NewDefaultFs(dir string) *KitFs

NewDefaultFs creates a KitFs with `dir` as root.

func (*KitFs) Exists

func (f *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) Mkdir

func (f *KitFs) Mkdir(dir string) error

Mkdir creates a directory.

func (*KitFs) MkdirAll

func (f *KitFs) MkdirAll(path string) error

MkdirAll creates a directory and its parents if they don't exist.

func (*KitFs) ReadFile

func (f *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 (f *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