fileutil

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fileutil provides utility functions related to files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append added in v0.4.0

func Append(path, content string, doNotCreateIfDoesNotExist ...bool) error

Append appends content to a file

func FileExists

func FileExists(path string) bool

FileExists checks if a given file exists.

func MustReadConfigFile added in v0.6.0

func MustReadConfigFile(filename string, locations []string) ([]byte, string)

MustReadConfigFile checks if a file exists in one of the configuration directories and returns the content. If no file is found, mytoken exists.

func MustReadFile

func MustReadFile(filename string) []byte

MustReadFile reads a given file and returns the content. If an error occurs mytoken terminates.

func ReadConfigFile

func ReadConfigFile(filename string, locations []string) ([]byte, string, error)

ReadConfigFile checks if a file exists in one of the configuration directories and returns the content. If no file is found, mytoken returns an error

func ReadFile added in v0.4.3

func ReadFile(filename string) ([]byte, error)

ReadFile reads a given file and returns the content.

Types

This section is empty.

Jump to

Keyboard shortcuts

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