fs

package
v1.4.5-testnet Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0, MIT Imports: 6 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 CopyFile added in v1.4.6

func CopyFile(origFilePath, destFilePath string) (err error)

CopyFile copy a file or folder from one path to another

func CopyFolder added in v1.4.6

func CopyFolder(origFolderPath, destFolderPath string) error

CopyFolder copy files inside a folder to another folder recursively

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 FolderExists added in v1.4.6

func FolderExists(folderPath, name string) bool

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

func Folders added in v1.4.6

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

Folders returns the list of folder 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