osx

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPageFault = errors.New("page fault occurred while reading from memory map")

Functions

func Close

func Close(c io.Closer)

Close closes the given io.Closer without error.

func CreateFile added in v0.5.2

func CreateFile(name string, perm os.FileMode) (*os.File, error)

CreateFile is similar to os.Create but supports ~ as the home directory, and also supports the parent directory creation.

func ExistEnv

func ExistEnv(key string) bool

ExistEnv checks if the environment variable named by the key exists.

func Exists

func Exists(path string, checks ...func(os.FileInfo) bool) bool

Exists checks if the given path exists.

func ExistsDevice

func ExistsDevice(path string) bool

ExistsDevice checks if the given path exists and is a device.

func ExistsDir

func ExistsDir(path string) bool

ExistsDir checks if the given path exists and is a directory.

func ExistsFile

func ExistsFile(path string) bool

ExistsFile checks if the given path exists and is a regular file.

func ExistsLink(path string) bool

ExistsLink checks if the given path exists and is a symbolic link.

func ExistsSocket

func ExistsSocket(path string) bool

ExistsSocket checks if the given path exists and is a socket.

func ExpandEnv

func ExpandEnv(key string, def ...string) string

ExpandEnv is similar to Getenv, but replaces ${var} or $var in the result.

func Getenv

func Getenv(key string, def ...string) string

Getenv retrieves the value of the environment variable named by the key. It returns the default, which will be empty if the variable is not present. To distinguish between an empty value and an unset value, use LookupEnv.

func InlineTilde added in v0.5.4

func InlineTilde(path string) string

InlineTilde replaces the leading ~ with the home directory.

func Open

func Open(path string) (*os.File, error)

Open is similar to os.Open but supports ~ as the home directory.

func OpenFile added in v0.5.2

func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

OpenFile is similar to os.OpenFile but supports ~ as the home directory, and also supports the parent directory creation.

func WriteFile

func WriteFile(name string, data []byte, perm os.FileMode) error

WriteFile is similar to os.WriteFile but supports ~ as the home directory, and also supports the parent directory creation.

Types

type MmapFile

type MmapFile struct {
	// contains filtered or unexported fields
}

func OpenMmapFile

func OpenMmapFile(path string) (*MmapFile, error)

func OpenMmapFileWithSize

func OpenMmapFileWithSize(path string, size int) (*MmapFile, error)

func (*MmapFile) Bytes

func (f *MmapFile) Bytes() []byte

func (*MmapFile) Close

func (f *MmapFile) Close() error

func (*MmapFile) Len

func (f *MmapFile) Len() int64

func (*MmapFile) ReadAt

func (f *MmapFile) ReadAt(p []byte, off int64) (_ int, err error)

Jump to

Keyboard shortcuts

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