local

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: EUPL-1.2 Imports: 8 Imported by: 0

Documentation

Overview

Package local provides a local filesystem implementation of the io.Medium interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Medium

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

Medium is a local filesystem storage backend.

func New

func New(root string) (*Medium, error)

New creates a new local Medium rooted at the given directory. Pass "/" for full filesystem access, or a specific path to sandbox.

func (*Medium) Append

func (m *Medium) Append(p string) (goio.WriteCloser, error)

Append opens the named file for appending, creating it if it doesn't exist.

func (*Medium) Create

func (m *Medium) Create(p string) (goio.WriteCloser, error)

Create creates or truncates the named file.

func (*Medium) Delete

func (m *Medium) Delete(p string) error

Delete removes a file or empty directory.

func (*Medium) DeleteAll

func (m *Medium) DeleteAll(p string) error

DeleteAll removes a file or directory recursively.

func (*Medium) EnsureDir

func (m *Medium) EnsureDir(p string) error

EnsureDir creates directory if it doesn't exist.

func (*Medium) Exists

func (m *Medium) Exists(p string) bool

Exists returns true if path exists.

func (*Medium) FileGet

func (m *Medium) FileGet(p string) (string, error)

FileGet is an alias for Read.

func (*Medium) FileSet

func (m *Medium) FileSet(p, content string) error

FileSet is an alias for Write.

func (*Medium) IsDir

func (m *Medium) IsDir(p string) bool

IsDir returns true if path is a directory.

func (*Medium) IsFile

func (m *Medium) IsFile(p string) bool

IsFile returns true if path is a regular file.

func (*Medium) List

func (m *Medium) List(p string) ([]fs.DirEntry, error)

List returns directory entries.

func (*Medium) Open

func (m *Medium) Open(p string) (fs.File, error)

Open opens the named file for reading.

func (*Medium) Read

func (m *Medium) Read(p string) (string, error)

Read returns file contents as string.

func (*Medium) ReadStream

func (m *Medium) ReadStream(path string) (goio.ReadCloser, error)

ReadStream returns a reader for the file content.

This is a convenience wrapper around Open that exposes a streaming-oriented API, as required by the io.Medium interface, while Open provides the more general filesystem-level operation. Both methods are kept for semantic clarity and backward compatibility.

func (*Medium) Rename

func (m *Medium) Rename(oldPath, newPath string) error

Rename moves a file or directory.

func (*Medium) Stat

func (m *Medium) Stat(p string) (fs.FileInfo, error)

Stat returns file info.

func (*Medium) Write

func (m *Medium) Write(p, content string) error

Write saves content to file, creating parent directories as needed.

func (*Medium) WriteStream

func (m *Medium) WriteStream(path string) (goio.WriteCloser, error)

WriteStream returns a writer for the file content.

This is a convenience wrapper around Create that exposes a streaming-oriented API, as required by the io.Medium interface, while Create provides the more general filesystem-level operation. Both methods are kept for semantic clarity and backward compatibility.

Jump to

Keyboard shortcuts

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