fsys

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT 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 Rename

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

Rename a file using the given filesystem.

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.

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 data of the named file 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) Rename

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

type InMemFile

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

func (*InMemFile) Close

func (f *InMemFile) Close() error

func (*InMemFile) Name

func (f *InMemFile) Name() string

func (*InMemFile) Read

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

func (*InMemFile) Stat

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

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

Rename renames file from oldPath to newPath

type RenameFS

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

RenameFS is a filesystem that can rename a file.

Jump to

Keyboard shortcuts

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