fsutil

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package fsutil builds on the underlying fs to add useful functions such as WriteFile or Walk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	fs.FS
}

func NewBase

func NewBase(fs fs.FS) Base

func (Base) ReadDir

func (b Base) ReadDir(dirname string) ([]os.FileInfo, error)

func (Base) ReadFile

func (b Base) ReadFile(filename string) ([]byte, error)

func (Base) Walk

func (b Base) Walk(root string, walkFn filepath.WalkFunc) error

func (Base) WriteFile

func (b Base) WriteFile(filename string, data []byte, perm os.FileMode) error

type Lock

type Lock struct {
	Util
}

Lock wraps ioutil to provide locked read and write

func NewLock

func NewLock(fs fs.FS) Lock

func (Lock) ReadFile

func (l Lock) ReadFile(filename string) ([]byte, error)

func (Lock) Remove

func (l Lock) Remove(name string) error

func (Lock) RemoveAll

func (l Lock) RemoveAll(path string) error

func (Lock) WriteFile

func (l Lock) WriteFile(filename string, data []byte, perm os.FileMode) error

type Util

type Util interface {
	fs.FS
	ReadDir(dirname string) ([]os.FileInfo, error)
	ReadFile(filename string) ([]byte, error)
	WriteFile(filename string, data []byte, perm os.FileMode) error
	Walk(root string, walkFn filepath.WalkFunc) error
}

Jump to

Keyboard shortcuts

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