memfis

package
v0.0.0-...-a1b85c2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	// GetName returns the root-relative file path.
	// The path must use "/" as directory separator.
	// It must not use escaping or "." and ".." segements.
	// The characters "/" and "\" are forbidden in path segments.
	GetName() string
	// GetContent returns the data contained in the file.
	GetContent() string
}

File is a minimal representation of a file that is read only and provides only its name and contents. It is a bad fit for large files as its only way to access file contents is retrieving all of it as a string.

type FileSizer

type FileSizer interface {
	File
	// Size retrieves the file size in bytes; it must match len(GetContent())
	Size() int64
}

FileSizer is a file that supports direct retrieval of the file size.

type MemFS

type MemFS interface {
	fs.GlobFS
	fs.ReadDirFS
	fs.ReadFileFS
	fs.StatFS
	fs.SubFS
}

func MakeMemFS

func MakeMemFS(files ...File) (MemFS, error)

Jump to

Keyboard shortcuts

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