fileio

package
v0.0.0-...-bea3eb9 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir(path string) *dir

func File

func File(path string) *file

func NewDirSet

func NewDirSet() *dirSet

func NewFileSet

func NewFileSet() *fileSet

Types

type DirIfc

type DirIfc interface {
	GetFiles() (*fileSet, error)
	GetMatchingFiles(pattern string) (*fileSet, error)
	GetDirs() (*dirSet, error)
	GetMatchingDirs(pattern string) (*dirSet, error)
	Exists() bool
	Create() error
	Delete() error
	Rename(newPath string) error
}

type DirSetIfc

type DirSetIfc interface {
	AddDir(path string)
	Len() int
}

type FileIfc

type FileIfc interface {
	// Our own accessors
	GetPath() string                  // Original path as supplied
	GetAbsPath() (*string, error)     // Absolute path, eliminates relative and more
	GetBasename() string              // Path without file name
	GetAbsBasename() (*string, error) // Absolute path without file name

	Exists() bool                // Check if this file already exists on disk
	Create() error               // Create the file if it doesn't already exist
	Rename(newPath string) error // Rename (move) this file to a new path
	Delete() error               // Delete this file

	CopyTo(path string) error // Copy this file to another location

	ReadString() (*string, error)      // Read the file, return content as a *string
	ReadBytes() (*[]byte, error)       // Read the file, return contents as a *[]byte
	WriteString(content *string) error // Write the contents of a string to a file
	WriteBytes(content *[]byte) error  // Write the contents of a []byte to a file

	// FileInfo accessors
	GetName() (*string, error)       // Name of the file without the path
	GetSize() (*int64, error)        // Size of the file as a count of bytes
	GetMode() (*fs.FileMode, error)  // File system "mode" (attributes)
	GetModTime() (*time.Time, error) // Get the last modified timestamp
	IsDir() (bool, error)            // Check if this is a Dir (vs. regular File, etc)
	GetSys() (any, error)            // Get representation of data source (maybe nil!)
}

type FileSetIfc

type FileSetIfc interface {
	AddFile(path string)
	Len() int
}

Jump to

Keyboard shortcuts

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