memfs

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

FS represents a file system in memory.

func New

func New(dirs map[string][]string, files map[string]string) *FS

New creates a file system instance.

func SingleFile

func SingleFile(dir string, fname string, data string) *FS

SingleFile creates a file system that only contains a single file.

func TwoFiles

func TwoFiles(dir string, fname1, data1, fname2, data2 string) *FS

TwoFiles creates a file system that contains two files.

func (*FS) Join

func (p *FS) Join(elem ...string) string

Join joins any number of path elements into a single path, separating them with slashes. Empty elements are ignored. The result is Cleaned. However, if the argument list is empty or all its elements are empty, Join returns an empty string.

func (*FS) ReadDir

func (p *FS) ReadDir(dirname string) ([]fs.DirEntry, error)

ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.

func (*FS) ReadFile

func (p *FS) ReadFile(filename string) ([]byte, error)

ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

type FileFS

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

func File

func File(filename string, src interface{}) (f *FileFS, err error)

func (*FileFS) Join

func (p *FileFS) Join(elem ...string) string

func (*FileFS) ReadDir

func (p *FileFS) ReadDir(dirname string) ([]fs.DirEntry, error)

func (*FileFS) ReadFile

func (p *FileFS) ReadFile(filename string) ([]byte, error)

Jump to

Keyboard shortcuts

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