fileutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst. It validates both paths, ensures the source exists and is readable, creates parent directories if needed, and verifies write permissions.

func Exists

func Exists(path string) bool

Exists checks if a file or directory exists

func IsDir

func IsDir(path string) bool

IsDir checks if the path is a directory

func IsFile

func IsFile(path string) bool

IsFile checks if the path is a regular file

func ReadFile

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

ReadFile reads the entire file and returns its contents. It validates the path and checks if the file exists and is readable.

func ResetDir

func ResetDir(path string) error

ResetDir removes a directory if it exists and creates a fresh empty one. It validates the path and checks write permissions before proceeding.

func WriteFile

func WriteFile(path string, data []byte) error

WriteFile writes data to a file, creating it if necessary. It validates the path, creates parent directories if needed, and verifies write permissions before writing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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