fs

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FType

type FType uint8

FType represents a file type.

const (
	// Perm specifies a permanent file.
	Perm FType = iota
	// Temp specifies a temporary file.
	Temp
)

type FileHandler

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

FileHandler defines a file handle structure responsible for controlling file access and operations.

func NewFileHandler

func NewFileHandler(fname string, ft FType) (*FileHandler, error)

NewFileHandler returns a pointer to the file handler which opens either a temporary or a permanent file underneath.

func (*FileHandler) Close

func (h *FileHandler) Close() error

Close closes down a file.

func (*FileHandler) Lock

func (h *FileHandler) Lock()

Lock locks up the file access.

func (*FileHandler) Name

func (h *FileHandler) Name() string

Name returns the name of the file.

func (*FileHandler) Open

func (h *FileHandler) Open() (err error)

Open opens a file.

func (*FileHandler) Read

func (h *FileHandler) Read(p []byte) (int, error)

Read reads a file.

func (*FileHandler) Reload

func (h *FileHandler) Reload() error

Reload reloads a file.

func (*FileHandler) Remove

func (h *FileHandler) Remove() error

Remove attempts to remove a file from the file system.

func (*FileHandler) Seek

func (h *FileHandler) Seek(offset int64, whence int) (int64, error)

Seek seeks to an offset in a file.

func (*FileHandler) Truncate

func (h *FileHandler) Truncate(size int64) (err error)

Truncate truncates a file to size.

func (*FileHandler) Unlock

func (h *FileHandler) Unlock()

Unlock unlocks access to a file.

func (*FileHandler) Write

func (h *FileHandler) Write(p []byte) (int, error)

Write writes bytes to a file.

Jump to

Keyboard shortcuts

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