memoryfs

package
v6.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDirEntry

func NewDirEntry(name string) fs.DirEntry

Types

type DirEntry

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

func (*DirEntry) Info

func (d *DirEntry) Info() (fs.FileInfo, error)

func (*DirEntry) IsDir

func (d *DirEntry) IsDir() bool

func (*DirEntry) Name

func (d *DirEntry) Name() string

func (*DirEntry) Type

func (d *DirEntry) Type() fs.FileMode

type MemoryFS

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

MemoryFS is an in-memory file system used to read and write files. This implements fs.FS, fs.ReadFileFS, OpenFileFS, WriteFileFS.

func NewMemoryFS

func NewMemoryFS() *MemoryFS

func (*MemoryFS) Chdir added in v6.2.1

func (mfs *MemoryFS) Chdir(dir string) error

func (*MemoryFS) Create added in v6.2.1

func (mfs *MemoryFS) Create(name string) (filesystem.WritableFile, error)

func (*MemoryFS) FileExists

func (mfs *MemoryFS) FileExists(file string) bool

func (*MemoryFS) Mkdir

func (mfs *MemoryFS) Mkdir(name string, perm fs.FileMode) error

func (*MemoryFS) MkdirAll added in v6.2.1

func (mfs *MemoryFS) MkdirAll(path string, perm fs.FileMode) error

func (*MemoryFS) Open

func (mfs *MemoryFS) Open(name string) (fs.File, error)

func (*MemoryFS) OpenFile

func (mfs *MemoryFS) OpenFile(name string, flag int, perm os.FileMode) (filesystem.WritableFile, error)

func (*MemoryFS) ReadDir

func (mfs *MemoryFS) ReadDir(dir string) ([]fs.DirEntry, error)

func (*MemoryFS) ReadFile

func (mfs *MemoryFS) ReadFile(name string) ([]byte, error)

func (*MemoryFS) Stat

func (mfs *MemoryFS) Stat(name string) (fs.FileInfo, error)

func (*MemoryFS) WriteFile

func (mfs *MemoryFS) WriteFile(name string, data []byte, perm fs.FileMode) error

type MemoryFile

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

MemoryFile is an in-memory file struct that implements fs.File, WritableFile

func (*MemoryFile) Close

func (mf *MemoryFile) Close() error

func (*MemoryFile) Name

func (mf *MemoryFile) Name() string

func (*MemoryFile) Read

func (mf *MemoryFile) Read(b []byte) (int, error)

func (*MemoryFile) Stat

func (mf *MemoryFile) Stat() (fs.FileInfo, error)

func (*MemoryFile) Write

func (mf *MemoryFile) Write(b []byte) (int, error)

func (*MemoryFile) WriteString

func (mf *MemoryFile) WriteString(s string) (int, error)

Jump to

Keyboard shortcuts

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