dfs

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CurrentDirectory  = "."
	PreviousDirectory = ".."
	HomeDirectory     = "~"
	RootDirectory     = "/"
)

Directory shortcuts.

View Source
const (
	DirectoriesListingType = "directories"
	FilesListingType       = "files"
)

Different types of listings.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(name string) error

CreateDirectory creates a new directory given a name.

func DeleteDirectory

func DeleteDirectory(name string) error

DeleteDirectory deletes a directory given a name.

func DeleteFile

func DeleteFile(name string) error

DeleteFile deletes a file given a name.

func FindFilesByName

func FindFilesByName(name, dir string) ([]string, []fs.DirEntry, error)

func GetDirectoryItemSize

func GetDirectoryItemSize(path string) (int64, error)

GetDirectoryItemSize calculates the size of a directory or file.

func GetDirectoryListing

func GetDirectoryListing(dir string, showHidden bool) ([]fs.DirEntry, error)

GetDirectoryListing returns a list of files and directories within a given directory.

func GetDirectoryListingByType

func GetDirectoryListingByType(dir, listingType string, showHidden bool) ([]fs.DirEntry, error)

GetDirectoryListingByType returns a directory listing based on type (directories | files).

func GetHomeDirectory

func GetHomeDirectory() (string, error)

GetHomeDirectory returns the users home directory.

func GetWorkingDirectory

func GetWorkingDirectory() (string, error)

GetWorkingDirectory returns the current working directory.

func MoveDirectoryItem

func MoveDirectoryItem(src, dst string) error

MoveDirectoryItem moves a file from one place to another.

func ReadFileContent

func ReadFileContent(name string) (string, error)

ReadFileContent returns the contents of a file given a name.

func RenameDirectoryItem

func RenameDirectoryItem(src, dst string) error

RenameDirectoryItem renames a directory or files given a source and destination.

func WriteToFile

func WriteToFile(path, content string) error

WriteToFile writes content to a file, overwriting content if it exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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