fs

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OS_READ        = 04
	OS_WRITE       = 02
	OS_EX          = 01
	OS_USER_SHIFT  = 6
	OS_GROUP_SHIFT = 3
	OS_OTH_SHIFT   = 0

	OS_USER_R   = OS_READ << OS_USER_SHIFT
	OS_USER_W   = OS_WRITE << OS_USER_SHIFT
	OS_USER_X   = OS_EX << OS_USER_SHIFT
	OS_USER_RW  = OS_USER_R | OS_USER_W
	OS_USER_RWX = OS_USER_RW | OS_USER_X

	OS_GROUP_R   = OS_READ << OS_GROUP_SHIFT
	OS_GROUP_W   = OS_WRITE << OS_GROUP_SHIFT
	OS_GROUP_X   = OS_EX << OS_GROUP_SHIFT
	OS_GROUP_RW  = OS_GROUP_R | OS_GROUP_W
	OS_GROUP_RWX = OS_GROUP_RW | OS_GROUP_X

	OS_OTH_R   = OS_READ << OS_OTH_SHIFT
	OS_OTH_W   = OS_WRITE << OS_OTH_SHIFT
	OS_OTH_X   = OS_EX << OS_OTH_SHIFT
	OS_OTH_RW  = OS_OTH_R | OS_OTH_W
	OS_OTH_RWX = OS_OTH_RW | OS_OTH_X

	OS_ALL_R   = OS_USER_R | OS_GROUP_R | OS_OTH_R
	OS_ALL_W   = OS_USER_W | OS_GROUP_W | OS_OTH_W
	OS_ALL_X   = OS_USER_X | OS_GROUP_X | OS_OTH_X
	OS_ALL_RW  = OS_ALL_R | OS_ALL_W
	OS_ALL_RWX = OS_ALL_RW | OS_GROUP_X
)

Useful permissions constants example provided via StackOverflow: https://stackoverflow.com/a/42718395/33611 noinspection GoSnakeCaseUsage,GoUnusedConst

View Source
const PathSeparator = string(os.PathSeparator)

PathSeparator is the OS dependent path separator character as a string.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(source string, destination string, bufferSize int64) (int64, error)

CopyFile copies file from source to destination on the file system. Returns the number of bytes copied and an optional error.

func FindInPath

func FindInPath(fileName string) (string, error)

FindInPath searches the PATH and the local directory structure for a file.

func IsRegularFileOrDirectory added in v0.0.3

func IsRegularFileOrDirectory(fileInfo os.FileInfo) bool

IsRegularFileOrDirectory returns true if the referenced FileInfo object is a normal file or directory and not a symlink, device or other specialized file type.

func PathExistsAndIsFileOrDirectory added in v0.0.3

func PathExistsAndIsFileOrDirectory(path string) error

PathExistsAndIsFileOrDirectory checks to see if a given path exists and if it is a directory or regular file. If the check is successful this function will return nil. Otherwise, it will return an error indicating the problem with the path.

func TempDirectoryPath

func TempDirectoryPath(suffix string) string

TempDirectoryPath returns a path under the system temporary directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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