vfs

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Now = func() time.Time {
	return time.Now()
}

Now may be overriden for testing purposes

Functions

func Exist

func Exist(fsys fs.FS, paths ...string) (err error)

Exist returns an error if any of the paths don't exist

func GitIgnore

func GitIgnore(fsys fs.FS) *gitIgnore

func SingleFlight

func SingleFlight(fsys fs.FS) fs.FS

func SomeExist

func SomeExist(fsys fs.FS, paths ...string) (map[string]bool, error)

Exists will check if files exist at once, returning a map of the results. If there are any errors (besides ErrNotExist), the whole call fails.

func Write

func Write(to string, fsys fs.FS) error

func WriteAll

func WriteAll(from, to string, fsys fs.FS) error

WriteAll the filesystem at "from" to "to"

Types

type File

type File = fstest.MapFile

type Map

type Map map[string][]byte

func (Map) MkdirAll

func (m Map) MkdirAll(path string, perm fs.FileMode) error

func (Map) Open

func (m Map) Open(name string) (fs.File, error)

func (Map) RemoveAll

func (m Map) RemoveAll(path string) error

func (Map) WriteFile

func (m Map) WriteFile(name string, data []byte, perm fs.FileMode) error

type Memory

type Memory fstest.MapFS

func (Memory) MkdirAll

func (m Memory) MkdirAll(path string, perm fs.FileMode) error

func (Memory) Open

func (m Memory) Open(name string) (fs.File, error)

func (Memory) RemoveAll

func (m Memory) RemoveAll(path string) error

func (Memory) WriteFile

func (m Memory) WriteFile(name string, data []byte, perm fs.FileMode) error

type OS

type OS string

func (OS) MkdirAll

func (dir OS) MkdirAll(path string, perm fs.FileMode) error

func (OS) Open

func (dir OS) Open(name string) (fs.File, error)

func (OS) RemoveAll

func (dir OS) RemoveAll(path string) error

func (OS) WriteFile

func (dir OS) WriteFile(name string, data []byte, perm fs.FileMode) error

type ReadWritable

type ReadWritable interface {
	fs.FS
	Writable
}

func GitIgnoreRW

func GitIgnoreRW(rw ReadWritable) ReadWritable

type Writable

type Writable interface {
	MkdirAll(path string, perm fs.FileMode) error
	WriteFile(name string, data []byte, perm fs.FileMode) error
	RemoveAll(path string) error
}

Jump to

Keyboard shortcuts

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