fileutils

package module
v0.1.1-0...-71d91e1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 3 Imported by: 0

README

go-fileutils

This package contains a set of functions to handle files I need in several projects and don't want to copy because of the DRY principle.

For docu see go doc

Documentation

Overview

Go-fileutils contains a set of functions to handl files I need in several projects and don't want to copy because of the DRY principle.

Index

Constants

This section is empty.

Variables

View Source
var (
	// No config file found
	ErrNoConfigFile = errors.New("no config file found")
)

Functions

func GetBytesFromPath

func GetBytesFromPath(path string) ([]byte, int, error)

GetBytesFromPath returns the content of the given file as []byte and its length. If an error occurs, it is returned instead.

func SearchConfigFile

func SearchConfigFile(modname, fileext string) (string, error)

SearchConfigFile searches for config files named <modname>.<fileext> in the following locations

  1. current working directory
  2. <user specific config directory (most ~/.config)>/<modname>
  3. /usr/local/etc/<modname>
  4. /etc/<modname>

The first existing file is returned. If none is found, an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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