filesys_interface

package
v0.0.0-...-9a26220 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem interface {
	ReadOnlyFileSystem
	PathFileSystem
	WriteFileSystem
}

FileSystem defines the methods of an abstract filesystem.

type PathFileSystem

type PathFileSystem interface {
	GetSeparators() rune
	Join(elem ...string) string
	Base(string) string
	PathSplit(string) (string, string)
	Ext(string) string
	IsAbs(string) bool
	Getwd() (string, error)
	Exists(string) (bool, error)
	Rel(string, string) (string, error)
}

type ReadOnlyFileSystem

type ReadOnlyFileSystem interface {
	fs.ReadDirFS
	fs.ReadFileFS
	// OpenFile like Open but opens the named file with specified flag and perm.
	OpenFile(name string, flag int, perm os.FileMode) (fs.File, error)
	// Stat returns a FileInfo describing the file.
	// If there is an error, it should be of type *PathError.
	Stat(name string) (fs.FileInfo, error)

	// ExtraInfo returns extra information about the fs.
	ExtraInfo(string) map[string]any
}

type SyncFileSystem

type SyncFileSystem interface {
	Sync() error
}

SyncFileSystem defines the methods of an abstract filesystem that can sync. It's optional to implement this interface.

type TrashFileSystem

type TrashFileSystem interface {
	Throw(filenames ...string) error
}

TrashFileSystem defines the methods of an abstract filesystem that can throw files away. It's optional to implement this interface.

type WriteFileSystem

type WriteFileSystem interface {
	Rename(string, string) error
	WriteFile(string, []byte, os.FileMode) error
	Delete(string) error
	MkdirAll(string, os.FileMode) error
}

Jump to

Keyboard shortcuts

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