cli/pkg/workspace/local.go

42 lines
1.1 KiB
Go
Raw Normal View History

package workspace
import "github.com/Snider/Core/pkg/io"
// localMedium implements the Medium interface for the local disk.
type localMedium struct{}
// NewLocalMedium creates a new instance of the local storage medium.
2025-10-25 09:24:50 +01:00
func NewLocalMedium() io.Medium {
return &localMedium{}
}
// FileGet reads a file from the local disk.
func (m *localMedium) FileGet(path string) (string, error) {
2025-10-25 09:24:50 +01:00
return io.Read(io.Local, path)
}
// FileSet writes a file to the local disk.
func (m *localMedium) FileSet(path, content string) error {
2025-10-25 09:24:50 +01:00
return io.Write(io.Local, path, content)
}
// Read reads a file from the local disk.
func (m *localMedium) Read(path string) (string, error) {
2025-10-25 09:24:50 +01:00
return io.Read(io.Local, path)
}
// Write writes a file to the local disk.
func (m *localMedium) Write(path, content string) error {
2025-10-25 09:24:50 +01:00
return io.Write(io.Local, path, content)
}
// EnsureDir creates a directory on the local disk.
func (m *localMedium) EnsureDir(path string) error {
2025-10-25 09:24:50 +01:00
return io.EnsureDir(io.Local, path)
}
// IsFile checks if a path exists and is a file on the local disk.
func (m *localMedium) IsFile(path string) bool {
2025-10-25 09:24:50 +01:00
return io.IsFile(io.Local, path)
}