file

package
v1.1.1-0...-18dfa52 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(path string, content []byte) error

Append appends the provided byte content with an additional new line to the file.

func Copy

func Copy(srcPath, dstPath string, mode fs.FileMode) error

Copy reads file from the source path and writes it to the destination path with the specified permissions. All required subdirectories are also created. An error is thrown if destination file exists.

func Exists

func Exists(path string) bool

Exists returns true if file metadata is obtained without errors. Otherwise, false is returned.

func ForceCopy

func ForceCopy(srcPath, dstPath string, mode fs.FileMode) error

ForceCopy reads the file located at the source path and writes it to the destination path with the specified permissions. All required subdirectories are also created.

func Read

func Read(path string) (string, error)

Read reads file on a given path and returns its content as a string.

func ReadYaml

func ReadYaml[T any](path string, typ T) (*T, error)

ReadYaml reads yaml file on the given path and unmarshals it into the given type.

func ReadYamlStrict

func ReadYamlStrict[T any](path string, typ T) (*T, error)

ReadYaml reads yaml file on the given path and unmarshals it into the given type. File is not allowed to contain any unused/extra keys.

func WriteYaml

func WriteYaml(obj any, path string, perm fs.FileMode) error

WriteYaml writes a given object as a yaml file to the given path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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