Documentation
¶
Index ¶
- Variables
- func Abs(path string) (string, error)
- func ByteLimitLabel(size int64) string
- func Command(name string, args ...string) *exec.Cmd
- func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
- func FileExists(path string) (bool, error)
- func Getwd() (string, error)
- func LookPath(file string) (string, error)
- func PathEnv() string
- func ReadFileLimit(path string, maxBytes int64) ([]byte, error)
- func ReadLimit(input io.Reader, declaredSize, maxBytes int64) ([]byte, error)
- func ResolveExistingFile(pathValue string) (string, error)
- func UserHomeDir() (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInputTooLarge = errors.New("input too large")
ErrInputTooLarge reports that input exceeds a caller-provided size limit.
Functions ¶
func ByteLimitLabel ¶ added in v0.20.2
ByteLimitLabel formats a byte limit for user-facing messages.
func CommandContext ¶ added in v0.15.2
CommandContext constructs an external process command bound to ctx.
func FileExists ¶
FileExists reports whether path exists and is a file.
func ReadFileLimit ¶ added in v0.20.2
ReadFileLimit reads at most maxBytes from path.
The size is checked before reading when it is available and again while reading, so the limit also holds if the file grows after it is opened.
func ReadLimit ¶ added in v0.20.2
ReadLimit reads input while enforcing maxBytes. A negative declaredSize means the size is not known before reading.
func ResolveExistingFile ¶
ResolveExistingFile resolves pathValue to an absolute path and validates that it exists as a file.
func UserHomeDir ¶
UserHomeDir returns the current user's home directory.
Types ¶
This section is empty.