file

package
v0.0.0-...-4d45f13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

View Source
const (
	TempFilePermissions = 0600 // rw for owner only
	TempDirPermissions  = 0700 | os.ModeDir
)

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile duplicates the contents of `src` and writes it to a file at `dst` with the same permissions The parent dirs of `dst` are assumed to exist. Adapted From: https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04

func Exists

func Exists(path string) bool

Exists returns true if the give path represents a file or directory

func HomeDir

func HomeDir() string

HomeDir returns the user's home directory

This isn't guaranteed to be non-empty as users can often change this.

func IsExecutable

func IsExecutable(path string) bool

IsExecutable checks if a given path exists, is a file, not a symlink, and has its owner's executable bit set

func MirrorDir

func MirrorDir(src, dst string) error

MirrorDir will take a `src` directory and mirror it exactly under `dst` location. If no errors occur during the mirroring `nil` is returned, otherwise an non-nil error Adapted From: https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04 - Symlinks are copied

func SortFileInfos

func SortFileInfos(fis []os.FileInfo)

func SortNames

func SortNames(ss []string)

func SudoCopyFile

func SudoCopyFile(src, dst string) error

SudoCopyFile attempts to copy a file (and wraps CopyFile), but if required will escalate to higher permissions in order to copy a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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