filesystem

package
v0.0.0-...-1bf3308 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package filesystem is a collection of various different filesystem helper functions.

Index

Constants

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

Different types of listings.

Variables

This section is empty.

Functions

func ConvertBytesToSizeString

func ConvertBytesToSizeString(size int64) string

ConvertBytesToSizeString converts a byte count to a human readable string.

func FindFilesByName

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

FindFilesByName returns files found based on a name.

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 ReadFileContent

func ReadFileContent(name string) (string, error)

ReadFileContent returns the contents of a file given a name.

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