filesystem

package module
v0.0.0-...-271c0b7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

package filesystem contains functions for working with the filesystem

package filesystem contains functions for working with the filesystem

package filesystem contains functions for working with the filesystem

package filesystem contains functions for working with the filesystem

package filesystem contains functions for working with the filesystem

Index

Constants

This section is empty.

Variables

View Source
var (
	DisableCache bool
)

variables to be used in the package

Functions

func Dir

func Dir() (string, error)

Dir gets the home directory of the user Returns:

string -- the home directory of the user
error -- an error if the home directory could not be found

func Expand

func Expand(path string) (string, error)

Expand expands the path to include the home directory Arguments:

path -- the path to expand

Returns:

string -- the expanded path
error -- an error if the path could not be expanded

func FilePathWalkDir

func FilePathWalkDir(root string) ([]string, error)

FilePathWalkDir walks a directory and returns a list of files Arguments:

root -- the directory to walk

Returns:

 []string -- a list of files
	error -- an error if the directory could not be walked

func IsEmpty

func IsEmpty(path string) (bool, error)

is emptx checks if a directory is empty Arguments:

path -- the path to the directory to check

Returns:

bool -- true if the directory is empty, false otherwise
error -- an error if the directory could not be read

func MkDir

func MkDir(path string, permission os.FileMode) error

mk dir creates a directory Arguments:

path -- the path to the directory to create
permission -- the permissions to set on the directory

Returns:

error -- an error if the directory could not be created

func Reset

func Reset()

set the home dir to empty path

Types

type FileHash

type FileHash struct {
	Nodes []FileHashNode
}

filehash

func (*FileHash) Hash

func (fh *FileHash) Hash(dir string)

Hash hashes the files in a directory Arguments: dir -- the directory to hash

type FileHashNode

type FileHashNode struct {
	Path string
	Hash []byte
}

hashes

type LazyPath

type LazyPath struct {
	EnvironmentVariable string
	DefaultFn           func() string
}

LazyPath is a struct that contains a function to get a path

func (LazyPath) Path

func (lazypath LazyPath) Path(elem ...string) string

Path gets a path Arguments:

elem -- the elements of the path

Returns:

string -- the path

Jump to

Keyboard shortcuts

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