fs

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0, MIT Imports: 5 Imported by: 2

Documentation

Overview

Package fs holds some utilities for manipulating the file system

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSecureFile

func CreateSecureFile(file string) (*os.File, error)

CreateSecureFile creates a file with wr permission for user only and returns the file handle.

func CreateSecureFolder

func CreateSecureFolder(folder string) string

CreateSecureFolder checks if the folder exists and has the appropriate permission rights. In case of bad permission rights the empty string is returned. If the folder doesn't exist it, create it.

func Exists

func Exists(filePath string) (bool, error)

Exists returns whether the given file or directory exists.

func FileExists

func FileExists(filePath, name string) bool

FileExists returns true if the given name is a file in the given path. name must be the "basename" of the file and path must be the folder where it lies.

func Files

func Files(folderPath string) ([]string, error)

Files returns the list of file names included in the given path or error if any.

func HomeFolder added in v0.3.7

func HomeFolder() string

HomeFolder returns the home folder of the current user.

Types

This section is empty.

Jump to

Keyboard shortcuts

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