fileutil

package
v0.0.158 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxFileSize is the default maximum allowed file size (100MB)
	MaxFileSize = 100 * 1024 * 1024
)

Variables

This section is empty.

Functions

func CheckFileSize

func CheckFileSize(path string) error

CheckFileSize verifies if a file is within acceptable size limits

func ExpandPath added in v0.0.105

func ExpandPath(path string) (string, error)

ExpandPath expands ~ and ~user to the user's home directory. It also expands environment variables and resolves relative paths to absolute. This ensures paths like "." and "./subdir" become absolute paths based on cwd.

func ExpandPaths added in v0.0.105

func ExpandPaths(paths []string) ([]string, error)

ExpandPaths expands a slice of paths using ExpandPath.

func SafeOpenFile

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

SafeOpenFile opens a file after checking its size

func SafeReadFile

func SafeReadFile(path string) ([]byte, error)

SafeReadFile reads a file after checking its size

Types

This section is empty.

Jump to

Keyboard shortcuts

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