fileutil

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fileutil provides utilities for file operations

Index

Constants

View Source
const (
	// FileSource specifies to load config from a file
	FileSource = "file://"
	// EnvSource specifies to load config from an environment variable
	EnvSource = "env://"
)

Variables

This section is empty.

Functions

func FileExists

func FileExists(file string) error

FileExists ensures that file exists

func FileNames

func FileNames(folder string) ([]string, error)

FileNames returns list of files in provided folder.

func FolderExists

func FolderExists(dir string) error

FolderExists ensures that folder exists

func LoadConfigWithSchema

func LoadConfigWithSchema(config string) (string, error)

LoadConfigWithSchema returns a configuration loaded from file:// or env:// If config does not start with file:// or env://, then the value is returned as is

func Marshal

func Marshal(fn string, value interface{}) error

Marshal saves object to file

func SaveConfigWithSchema

func SaveConfigWithSchema(path, value string) error

SaveConfigWithSchema saves configuration to file:// or env://

func SubfolderNames

func SubfolderNames(folder string) ([]string, error)

SubfolderNames returns list of subfolders in provided folder

func Unmarshal

func Unmarshal(file string, v interface{}) error

Unmarshal JSON or YAML file to an interface

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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