vfs

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package vfs is deprecated and will be deleted once remaining code is migrated All new functionality should go in the virtual package.

Index

Constants

This section is empty.

Variables

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

Now may be overridden 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 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 ReadWritable

type ReadWritable interface {
	fs.FS
	Writable
}

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