fsys

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(fsys fs.FS, name string) (fs.File, error)

Create a new file using the given filesystem.

func RemoveAll

func RemoveAll(fsys fs.FS, path string) error

RemoveAll path and it's children using the given filesystem.

func Rename

func Rename(fsys fs.FS, oldPath, newPath string) error

Rename a file using the given filesystem.

func Symlink(fsys fs.FS, oldName, newName string) error

Symlink a file using the given filesystem.

func WriteFile

func WriteFile(fsys fs.FS, filename string, data []byte, perm os.FileMode) error

Types

type CreatFS

type CreatFS interface {
	fs.FS
	Create(name string) (fs.File, error)
}

CreatFS is a filesystem that can create a new file.

type InMemFS

type InMemFS struct {
	fstest.MapFS
}

InMemFS is an in-memory based filesystem t.

func NewInMemFS

func NewInMemFS(mapFs fstest.MapFS) *InMemFS

NewInMemFS returns a pointer to a new in-memory FS

func (*InMemFS) Content

func (inmem *InMemFS) Content(name string) *bytes.Buffer

Content returns the stored data of the in-memory InMemFS as a buffer of bytes.

func (*InMemFS) Create

func (inmem *InMemFS) Create(name string) (fs.File, error)

func (*InMemFS) Open

func (inmem *InMemFS) Open(name string) (fs.File, error)

func (*InMemFS) RemoveAll

func (*InMemFS) RemoveAll(path string) error

func (*InMemFS) Rename

func (inmem *InMemFS) Rename(oldPath, newPath string) error

func (*InMemFS) WriteFile

func (inmem *InMemFS) WriteFile(filename string, data []byte, perm os.FileMode) error

type InMemFile

type InMemFile struct {
	// contains filtered or unexported fields
}

func (*InMemFile) Close

func (*InMemFile) Close() error

func (*InMemFile) Name

func (*InMemFile) Name() string

func (*InMemFile) Read

func (inMemFile *InMemFile) Read(p []byte) (int, error)

func (*InMemFile) Stat

func (*InMemFile) Stat() (fs.FileInfo, error)

func (*InMemFile) Write

func (inMemFile *InMemFile) Write(p []byte) (int, error)

type OsFS

type OsFS struct{}

OsFS is an os based filesystem.

func (OsFS) Create

func (OsFS) Create(name string) (fs.File, error)

func (OsFS) Open

func (OsFS) Open(name string) (fs.File, error)

func (OsFS) RemoveAll

func (OsFS) RemoveAll(path string) error

RemoveAll removes path and it's children

func (OsFS) Rename

func (OsFS) Rename(oldPath, newPath string) error

Rename renames file from oldPath to newPath

func (OsFS) Symlink(oldName, newName string) error

Symlink creates newname as a symbolic link to oldname

func (OsFS) WriteFile

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

WriteFile writes data to file with filename

type RemoveAllFS

type RemoveAllFS interface {
	fs.FS
	RemoveAll(path string) error
}

RemoveAllFS is a filesystem that remove path and it's children that it may contain.

type RenameFS

type RenameFS interface {
	fs.FS
	Rename(oldPath, newPath string) error
}

RenameFS is a filesystem that can rename a file.

type SymlinkFS

type SymlinkFS interface {
	fs.FS
	Symlink(oldName, newName string) error
}

SymlinkFS is a filesystem that can symlink a file.

type WriteFileFS

type WriteFileFS interface {
	fs.FS
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

WriteFileFS is a filesystem that can write data to a file.

Jump to

Keyboard shortcuts

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