osfs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package osfs provides a filesystem adapter using the standard library os package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OSFileSystem

type OSFileSystem struct{}

OSFileSystem implements ports.FileSystem using the standard library.

func New

func New() *OSFileSystem

New creates a new OSFileSystem adapter.

func (*OSFileSystem) Create

func (f *OSFileSystem) Create(name string) (*os.File, error)

Create creates or truncates the named file.

func (*OSFileSystem) MkdirAll

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

MkdirAll creates a directory along with any necessary parents.

func (*OSFileSystem) Open

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

Open opens the named file for reading.

func (*OSFileSystem) ReadDir

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

ReadDir reads the named directory and returns directory entries.

func (*OSFileSystem) ReadFile

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

ReadFile reads the named file and returns the contents.

func (*OSFileSystem) Remove

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

Remove removes the named file or empty directory.

func (*OSFileSystem) RemoveAll

func (f *OSFileSystem) RemoveAll(path string) error

RemoveAll removes path and any children it contains.

func (*OSFileSystem) Rename

func (f *OSFileSystem) Rename(oldpath, newpath string) error

Rename renames (moves) oldpath to newpath.

func (*OSFileSystem) Stat

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

Stat returns file info for the named file.

func (*OSFileSystem) Walk

func (f *OSFileSystem) Walk(root string, fn ports.WalkFunc) error

Walk walks the file tree rooted at root, calling fn for each file or directory.

func (*OSFileSystem) WriteFile

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

WriteFile writes data to the named file, creating it if necessary.

Jump to

Keyboard shortcuts

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