fs

package
v0.0.0-...-65751db Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 7 Imported by: 13

Documentation

Overview

Package fs provides filesystem utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst string) error

Copy copies a file from src to dst.

func CreateDirIfNotExist

func CreateDirIfNotExist(path string) error

CreateDirIfNotExist creates a directory and all parent directories if they don't exist.

func Exists

func Exists(path string) bool

Exists checks if a path exists.

func GetExecutablePath

func GetExecutablePath() string

GetExecutablePath returns the directory path of the current executable.

func IsEmpty

func IsEmpty(path string) (bool, error)

IsEmpty checks if a directory is empty.

func ReadJSON

func ReadJSON(path string, data interface{}) error

ReadJSON reads a JSON file and unmarshals it into the provided data structure.

func ReadLines

func ReadLines(path string) ([]string, error)

ReadLines reads a file and returns its lines as a slice.

func ReadYAML

func ReadYAML(path string, data interface{}) error

ReadYAML reads a YAML file and unmarshals it into the provided data structure. The data parameter must be a non-nil pointer.

func WriteJSON

func WriteJSON(path string, data interface{}) error

WriteJSON marshals the data and writes it to a JSON file with indentation.

func WriteString

func WriteString(path string, content string) error

WriteString writes a string to a file, creating or truncating it.

func WriteYAML

func WriteYAML(path string, data interface{}) error

WriteYAML marshals the data and writes it to a YAML file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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