io

package
v0.0.0-...-6e98937 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppPathVar      = "$" + sys.AppPath + "$"
	AppDocPathVar   = "$" + sys.AppDocumentsPath + "$"
	AppCachePathVar = "$" + sys.AppCachePath + "$"
)

Variables used in strings.

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath answers the path, resolving any sys variables.

func MkExpandPath

func MkExpandPath(path string) (string, error)

MkExpandPath answers the path, resolving any sys variables and guaranteeing the parent dir exists. It assumes the leaf is a file. Variables: Anything defined in sys.

func MustExpandPath

func MustExpandPath(path string) string

MustExpandPath answers the path, resolving any sys variables. It ignores any errors, which for some clients can't happen.

func Read

func Read(fsys fs.FS, globPattern string) ([]byte, error)

Read returns the byte of the first matching file.

func ReadJson

func ReadJson[T any](path string) (T, error)

ReadJson reads the file and unmarshals to the type as JSON

func ReadJsonFs

func ReadJsonFs[T any](fsys fs.FS, path string) (T, error)

ReadJsonFs reads the file and unmarshals to the type as JSON

func ReadString

func ReadString(fsys fs.FS, globPattern string) (string, error)

ReadString returns the first matching file as a string.

func WriteJson

func WriteJson(path string, v any) error

WriteJson writes the any to the file as JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

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