fs

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fs provides filesystem abstractions for mappa.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem interface {
	// File operations
	WriteFile(name string, data []byte, perm fs.FileMode) error
	ReadFile(name string) ([]byte, error)
	Remove(name string) error

	// Directory operations
	MkdirAll(path string, perm fs.FileMode) error
	ReadDir(name string) ([]fs.DirEntry, error)
	TempDir() string

	// File system queries
	Stat(name string) (fs.FileInfo, error)
	Exists(path string) bool

	// fs.FS compatibility - allows use with fs.WalkDir
	Open(name string) (fs.File, error)
}

FileSystem provides an abstraction over filesystem operations. This interface is congruent with bennypowers.dev/cem/internal/platform.FileSystem to enable duck typing compatibility.

type OSFileSystem

type OSFileSystem struct{}

OSFileSystem implements FileSystem using the standard os package.

func NewOSFileSystem

func NewOSFileSystem() *OSFileSystem

NewOSFileSystem creates a new filesystem that uses the standard os package.

func (*OSFileSystem) Exists

func (f *OSFileSystem) Exists(path string) bool

func (*OSFileSystem) MkdirAll

func (f *OSFileSystem) MkdirAll(path string, perm fs.FileMode) error

func (*OSFileSystem) Open

func (f *OSFileSystem) Open(name string) (fs.File, error)

func (*OSFileSystem) ReadDir

func (f *OSFileSystem) ReadDir(name string) ([]fs.DirEntry, error)

func (*OSFileSystem) ReadFile

func (f *OSFileSystem) ReadFile(name string) ([]byte, error)

func (*OSFileSystem) Remove

func (f *OSFileSystem) Remove(name string) error

func (*OSFileSystem) Stat

func (f *OSFileSystem) Stat(name string) (fs.FileInfo, error)

func (*OSFileSystem) TempDir

func (f *OSFileSystem) TempDir() string

func (*OSFileSystem) WriteFile

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

Jump to

Keyboard shortcuts

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