file

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package file provides helpers to work with files.

Index

Constants

View Source
const (
	UserPath = "PATH"
)

Variables

View Source
var (
	ErrCloseFile       = errors.New("file: file close error")
	ErrCreateDir       = errors.New("file: failed to create directory")
	ErrFileNotFound    = errors.New("file: file not found")
	ErrInvalidFilename = errors.New("file: invalid filename")
	ErrInvalidTriplet  = errors.New("file: invalid triplet")
	ErrOpenFile        = errors.New("file: failed to open file")
	ErrScanFile        = errors.New("file: file scan error")
)

Functions

func BinaryMode

func BinaryMode(filename string) (string, error)

BinaryMode returns the file mode of filename in binary digits.

func CreateDirIfNotExists

func CreateDirIfNotExists(path string) error

CreateDirIfNotExists creates a directory, and all its parents, if it does not exist.

func GetStrings

func GetStrings(filename string, ignoreCase bool) ([]string, error)

GetStrings reads all lines from filename and returns a slice of string.

func IsExecutableInPath

func IsExecutableInPath(filename string) (bool, error)

IsExecutableInPath returns true if filename is an executable and exists in the user PATH.

Types

This section is empty.

Jump to

Keyboard shortcuts

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