filesystem

package
v0.0.0-...-c2f0c6c Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file

func CreateDirectory

func CreateDirectory(dir string)

CreateDirectory creates a new folder if not present, ignores errors

func DirectoryExists

func DirectoryExists(dir string) bool

DirectoryExists checks if the dir exists

func FileContainsString

func FileContainsString(file string, str string) bool

FileContainsString will check if a file contains the string

func FileExists

func FileExists(filename string) bool

FileExists checks if the file exists

func FindFilesByExtension

func FindFilesByExtension(directory string, extensions []string) ([]string, error)

FindFilesByExtension will return all files with a specific extension in a directory

func GetExecutionDirectory

func GetExecutionDirectory() string

GetExecutionDirectory returns the execution directory

func GetFileBytes

func GetFileBytes(file string) ([]byte, error)

GetFileBytes will retrieve the content of a file as bytes

func GetFileContent

func GetFileContent(file string) (string, error)

GetFileContent will retrieve the content of a file as text

func GetPathRelativeToDirectory

func GetPathRelativeToDirectory(currentDirectory string, rootDirectory string) string

GetPathRelativeToDirectory returns the relative path in relation to the rootDirectory

func GetProjectDirectory

func GetProjectDirectory() (string, error)

GetProjectDirectory will try to find the project directory based on repository folders (.git)

func GetWorkingDirectory

func GetWorkingDirectory() string

GetWorkingDirectory returns the current working directory

func MoveFile

func MoveFile(oldLocation string, newLocation string) error

MoveFile will move the file to a new location

func RemoveFile

func RemoveFile(file string) error

RemoveFile will delete a file

func SaveFileText

func SaveFileText(file string, content string) error

SaveFileText will save a file with the provided content

Types

This section is empty.

Jump to

Keyboard shortcuts

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