fileutil

package
v0.0.0-...-a3dc05e Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirIfNecessary

func CreateDirIfNecessary(path string) error

CreateDirIfNecessary create directory if not exist,pay attention to fix permission and it will create any necessary parents If path is already a exist, it does nothing and returns nil.

func CreateFileIfNessary

func CreateFileIfNessary(filepath string) (*os.File, error)

CreateFileIfNessary create file if not exist,pay attention to fix permission If file is already a exist, it does nothing and returns nil.

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory get current programmer execute directory

func GetFileContent

func GetFileContent(filePath string) (string, error)

GetFileContent get all file content once

func GetGrandpaDir

func GetGrandpaDir(path string) (string, error)

GetGrandpaDir get grandpa base dir of given filepath path must be file path not dir return grandpa dir path,if there no grandpa it will return empty string and error

func IsDir

func IsDir(path string) bool

IsDir if path is dir,don't care about err

func IsExist

func IsExist(filepath string) bool

IsExist if file or directory exist,don't care about err

func MMapRead

func MMapRead(filePath string) ([]byte, error)

MMapRead read file content by mmap feature

func String2File

func String2File(content, fileName string) error

String2File write string content to fileName

Types

This section is empty.

Jump to

Keyboard shortcuts

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