filesystem

package
v2.22.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PurgeDirectory

func PurgeDirectory(directory string) error

PurgeDirectory recursively removes all directories and files in a given directory.

Types

type FileInfo

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

FileInfo holds fields used for internal tracking of files, events in notifications and so on.

func NewFileInfo

func NewFileInfo(directory, name, ext string) *FileInfo

NewFileInfo creates a new instance of FileInfo.

func ParseFilePath

func ParseFilePath(fpath string) *FileInfo

ParseFilePath parses a filesystem path into a FileInfo.

func (*FileInfo) ExistsFile

func (fileInfo *FileInfo) ExistsFile() (bool, error)

ExistsFile checks if a file exists.

func (*FileInfo) GetDirectory

func (fileInfo *FileInfo) GetDirectory() string

GetDirectory returns the directory from FileInfo.

func (*FileInfo) GetFileExt

func (fileInfo *FileInfo) GetFileExt() string

GetFileExt returns the file extension from FileInfo.

func (*FileInfo) GetFileName

func (fileInfo *FileInfo) GetFileName() string

GetFileName returns the file name from FileInfo.

func (*FileInfo) GetFilePath

func (fileInfo *FileInfo) GetFilePath() string

GetFilePath returns the full file path from FileInfo, i.e., "directory/filename+extension".

func (*FileInfo) GetFilePathWithoutExt

func (fileInfo *FileInfo) GetFilePathWithoutExt() string

GetFilePathWithoutExt returns the full file path from FileInfo, i.e., "directory/filename".

func (*FileInfo) PurgeDirectory

func (fileInfo *FileInfo) PurgeDirectory() error

PurgeDirectory recursively removes all directories and files in a given directory.

func (*FileInfo) ReadAsByteBufferFromFile

func (fileInfo *FileInfo) ReadAsByteBufferFromFile() ([]byte, error)

ReadAsByteBufferFromFile reads a file as a byte buffer.

func (*FileInfo) ReadAsStringFromFile

func (fileInfo *FileInfo) ReadAsStringFromFile() (string, error)

ReadAsStringFromFile reads a file as a string.

func (*FileInfo) RemoveFile

func (fileInfo *FileInfo) RemoveFile() error

RemoveFile removes a file.

func (*FileInfo) String

func (fileInfo *FileInfo) String() string

String returns a string representation of the FileInfo.

func (*FileInfo) WriteByteBufferToFile

func (fileInfo *FileInfo) WriteByteBufferToFile(data []byte) error

WriteByteBufferToFile atomically writes byte buffer to file.

func (*FileInfo) WriteMessageAsProtobufToFile

func (fileInfo *FileInfo) WriteMessageAsProtobufToFile(msg proto.Message) error

WriteMessageAsProtobufToFile serializes message with protobuf wire format and atomically writes to file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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