fs

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagAppend                = os.O_APPEND
	FlagWrite                 = os.O_WRONLY
	FlagCreate                = os.O_CREATE
	FlagReadOnly              = os.O_RDONLY
	FlagAppendOrWrite         = FlagAppend | FlagWrite
	FlagWriteOrCreate         = FlagWrite | FlagCreate
	FlagWriteOrCreateOrAppend = FlagWrite | FlagCreate | FlagAppend
)

Variables

This section is empty.

Functions

func AppendFile added in v0.1.7

func AppendFile(
	filePath string,
	content []byte,
) *errorwrapper.Wrapper

func AppendFileUsingLock added in v0.1.7

func AppendFileUsingLock(
	filePath string,
	content []byte,
) *errorwrapper.Wrapper

func AppendStringFile added in v0.1.7

func AppendStringFile(
	filePath string,
	content string,
) *errorwrapper.Wrapper

func AppendStringFileUsingLock added in v0.1.7

func AppendStringFileUsingLock(
	filePath string,
	content string,
) *errorwrapper.Wrapper

func CheckSumFileBytes added in v0.2.2

func CheckSumFileBytes(
	hashType hashas.Variant,
	location string,
) *errbyte.Results

func CheckSumFileBytesUsingLock added in v0.2.2

func CheckSumFileBytesUsingLock(
	hashType hashas.Variant,
	location string,
) *errbyte.Results

func CheckSumFileString added in v0.2.2

func CheckSumFileString(
	hashType hashas.Variant,
	location string,
) *errstr.Result

func CheckSumFileStringUsingLock added in v0.2.2

func CheckSumFileStringUsingLock(
	hashType hashas.Variant,
	location string,
) *errstr.Result

func CopyFile

func CopyFile(srcPath, dstPath string) *errorwrapper.Wrapper

CopyFile Future ref: https://stackoverflow.com/a/21067803

func CopyFileContents added in v0.2.2

func CopyFileContents(srcPath, dstPath string) (errWp *errorwrapper.Wrapper)
func CopySymLink(src, dst string) error

CopySymLink copies a symbolic link from src to dst.

func CreateDirectoryAllDefault

func CreateDirectoryAllDefault(location string) *errorwrapper.Wrapper

func CreateDirectoryAllUptoParent

func CreateDirectoryAllUptoParent(location string) *errorwrapper.Wrapper

func GetFileName

func GetFileName(location string) string

func IsDirectory

func IsDirectory(location string) bool

func IsExistButDirectory added in v0.1.7

func IsExistButDirectory(location string) bool

func IsNotPathExists added in v0.2.2

func IsNotPathExists(location string) bool

func IsNotPathExistsUsing added in v0.2.2

func IsNotPathExistsUsing(fileInfo os.FileInfo, err error) bool

func IsPathExists

func IsPathExists(location string) bool

func IsPathExistsUsing added in v0.2.2

func IsPathExistsUsing(fileInfo os.FileInfo, err error) bool

func IsPathExistsUsingLock added in v0.2.0

func IsPathExistsUsingLock(location string) bool

func JsonReadUnmarshal added in v0.2.2

func JsonReadUnmarshal(
	filePath string,
	unmarshallObjectRef interface{},
) *errorwrapper.Wrapper

func JsonReadUnmarshalLock added in v0.2.2

func JsonReadUnmarshalLock(
	filePath string,
	unmarshallObjectRef interface{},
) *errorwrapper.Wrapper

func JsonWriteMarshal added in v0.2.2

func JsonWriteMarshal(
	isSkipOnNilObject bool,
	filePath string,
	fileMod os.FileMode,
	isKeepExistingFileModeOnExist bool,
	marshallingObjectRef interface{},
) *errorwrapper.Wrapper

func JsonWriteMarshalUsingLock added in v0.2.2

func JsonWriteMarshalUsingLock(
	isSkipOnNilObject bool,
	filePath string,
	fileMod os.FileMode,
	isKeepExistingFileModeOnExist bool,
	marshallingObjectRef interface{},
) *errorwrapper.Wrapper

func LinuxTouchFile added in v0.2.1

func LinuxTouchFile(fullPath string) *errorwrapper.Wrapper

func LinuxTouchFileUsingLock added in v0.2.2

func LinuxTouchFileUsingLock(fullPath string) *errorwrapper.Wrapper

func LinuxTouchLocationFile added in v0.2.1

func LinuxTouchLocationFile(parentPath, fileName string) *errorwrapper.Wrapper

func MoveFile added in v0.2.2

func MoveFile(srcPath, dstPath string) *errorwrapper.Wrapper

MoveFile move file path from source to destination

func ParentDir

func ParentDir(location string) string

func Read

func Read(location string, filename string) *errbyte.Results

func ReadErrorJsonResult added in v0.2.4

func ReadErrorJsonResult(filePath string) *errjson.Result

func ReadErrorJsonResultUnmarshal added in v0.2.4

func ReadErrorJsonResultUnmarshal(
	filePath string,
	unmarshalObject interface{},
) *errorwrapper.Wrapper

func ReadErrorJsonResultUnmarshalUsingLock added in v0.2.4

func ReadErrorJsonResultUnmarshalUsingLock(
	filePath string,
	unmarshalObject interface{},
) *errorwrapper.Wrapper

func ReadErrorJsonResultUsingLock added in v0.2.4

func ReadErrorJsonResultUsingLock(filePath string) *errjson.Result

func ReadFile

func ReadFile(filePath string) *errbyte.Results

func ReadFileLinesUsingLock added in v0.2.0

func ReadFileLinesUsingLock(filePath string) *errstr.Results

func ReadFileNonWhitespaceLinesUsingLock added in v0.2.0

func ReadFileNonWhitespaceLinesUsingLock(filePath string) *errstr.Results

func ReadFileString added in v0.2.0

func ReadFileString(filePath string) *errstr.Result

func ReadFileStringIfExistUsingLock added in v0.2.0

func ReadFileStringIfExistUsingLock(filePath string) *errstr.Result

func ReadFileStringUsingLock added in v0.2.0

func ReadFileStringUsingLock(filePath string) *errstr.Result

func ReadFileUsingLock added in v0.2.0

func ReadFileUsingLock(filePath string) *errbyte.Results

func ReadJsonParseSelfInjector added in v0.2.4

func ReadJsonParseSelfInjector(
	filePath string,
	jsonParseSelfInjector corejson.JsonParseSelfInjector,
) *errorwrapper.Wrapper

func ReadJsonParseSelfInjectorUsingLock added in v0.2.4

func ReadJsonParseSelfInjectorUsingLock(
	filePath string,
	jsonParseSelfInjector corejson.JsonParseSelfInjector,
) *errorwrapper.Wrapper

func ReadUsingLock added in v0.2.0

func ReadUsingLock(location string, filename string) *errbyte.Results

func Remove

func Remove(location string) *errorwrapper.Wrapper

Remove Reference : https://t.ly/xnAe

func Rename

func Rename(srcPath, dstPath string) *errorwrapper.Wrapper

func SafeRemove

func SafeRemove(location string) *errorwrapper.Wrapper

SafeRemove Reference : https://t.ly/xnAe

func Write

func Write(location string, filename string, content []byte) *errorwrapper.Wrapper

func WriteAnyLock added in v0.2.0

func WriteAnyLock(
	filePath string,
	content interface{},
) *errorwrapper.Wrapper

func WriteErrorJsonResult added in v0.2.4

func WriteErrorJsonResult(
	isSkipErrorOnNilOrEmpty bool,
	errJsonResult *errjson.Result,
	location string,
) *errorwrapper.Wrapper

func WriteErrorJsonResultUsingLock added in v0.2.4

func WriteErrorJsonResultUsingLock(
	isSkipErrorOnNilOrEmpty bool,
	errJsonResult *errjson.Result,
	location string,
) *errorwrapper.Wrapper

func WriteFile

func WriteFile(
	filePath string,
	content []byte,
) *errorwrapper.Wrapper

func WriteFileLock added in v0.1.6

func WriteFileLock(
	filePath string,
	content []byte,
) *errorwrapper.Wrapper

func WriteFileUsingFileMode added in v0.2.2

func WriteFileUsingFileMode(
	filePath string,
	content []byte,
	mode os.FileMode,
	isKeepExistingFileModeOnExist bool,
) *errorwrapper.Wrapper

func WriteJsonResult added in v0.2.4

func WriteJsonResult(
	isSkipErrorOnNilOrEmpty bool,
	jsonResult *corejson.Result,
	location string,
) *errorwrapper.Wrapper

func WriteJsonResultUsingLock added in v0.2.4

func WriteJsonResultUsingLock(
	isSkipErrorOnNilOrEmpty bool,
	jsonResult *corejson.Result,
	location string,
) *errorwrapper.Wrapper

func WriteStringLinesToFile

func WriteStringLinesToFile(
	filePath string,
	contentLines []string,
) *errorwrapper.Wrapper

func WriteStringLinesToFileUsingLock added in v0.1.6

func WriteStringLinesToFileUsingLock(
	filePath string,
	contentLines []string,
) *errorwrapper.Wrapper

func WriteStringToFile

func WriteStringToFile(
	filePath string, content string,
) *errorwrapper.Wrapper

func WriteStringToFileUsingLock added in v0.1.6

func WriteStringToFileUsingLock(
	filePath string,
	content string,
) *errorwrapper.Wrapper

func WriteStringToFileUsingLockFileMode added in v0.2.2

func WriteStringToFileUsingLockFileMode(
	filePath string,
	content string,
	fileMode os.FileMode,
	isKeepExistingFileModeOnExist bool,
) *errorwrapper.Wrapper

Types

type OsFile added in v0.2.2

type OsFile struct {
	Location         string
	OsFile           *os.File
	ErrorWrapper     *errorwrapper.Wrapper
	DeferClosingFunc func() *errorwrapper.Wrapper // must be called upon checking IsDeferCloseRequired
	// contains filtered or unexported fields
}

OsFile defer function must be called to close the file.

func DirFileCreate added in v0.2.2

func DirFileCreate(
	existingFileErrorWrapper *errorwrapper.Wrapper,
	directory,
	relativeFilePath string,
	chmod os.FileMode,
) *OsFile

func GetOsFile added in v0.2.2

func GetOsFile(
	existingErrorWrapper *errorwrapper.Wrapper,
	filePath string,
	osFlag int,
	fileMode os.FileMode,
) *OsFile

GetOsFile defer function must be called to close the file.

func GetOsFileAppendOrWrite added in v0.2.2

func GetOsFileAppendOrWrite(
	existingErrorWrapper *errorwrapper.Wrapper,
	filePath string,
	fileMode os.FileMode,
) *OsFile

GetOsFileAppendOrWrite defer function must be called to close the file.

func GetOsFileAppendOrWriteOrCreate added in v0.2.2

func GetOsFileAppendOrWriteOrCreate(
	existingErrorWrapper *errorwrapper.Wrapper,
	filePath string,
	fileMode os.FileMode,
) *OsFile

GetOsFileAppendOrWriteOrCreate defer function must be called to close the file.

func GetOsFileReadOnly added in v0.2.2

func GetOsFileReadOnly(
	existingErrorWrapper *errorwrapper.Wrapper,
	filePath string,
	fileMode os.FileMode,
) *OsFile

GetOsFileReadOnly defer function must be called to close the file.

func GetOsFileWriteOrCreate added in v0.2.2

func GetOsFileWriteOrCreate(
	existingErrorWrapper *errorwrapper.Wrapper,
	filePath string,
	fileMode os.FileMode,
) *OsFile

GetOsFileWriteOrCreate defer function must be called to close the file.

func TempFileCreate added in v0.2.2

func TempFileCreate(
	existingFileErrorWrapper *errorwrapper.Wrapper,
	relativeFilePath string,
	chmod os.FileMode,
) *OsFile

func TempFileCreateDefaultChmod added in v0.2.2

func TempFileCreateDefaultChmod(
	existingFileErrorWrapper *errorwrapper.Wrapper,
	relativeFilePath string,
) *OsFile

func (*OsFile) ApplyChmod added in v0.2.2

func (it *OsFile) ApplyChmod(mode os.FileMode) *errorwrapper.Wrapper

func (*OsFile) AttachDeferCloseOnRequire added in v0.2.2

func (it *OsFile) AttachDeferCloseOnRequire() *errorwrapper.Wrapper

func (*OsFile) BothExtension added in v0.2.2

func (it *OsFile) BothExtension() (dotExt, ext string)

func (*OsFile) ChmodWithError added in v0.2.2

func (it *OsFile) ChmodWithError() *pathchmod.ChmodWithError

func (*OsFile) ClearFileContents added in v0.2.2

func (it *OsFile) ClearFileContents() *errorwrapper.Wrapper

func (*OsFile) Close added in v0.2.2

func (it *OsFile) Close() *errorwrapper.Wrapper

func (*OsFile) FileInfo added in v0.2.2

func (it *OsFile) FileInfo() (os.FileInfo, *errorwrapper.Wrapper)

func (*OsFile) FileName added in v0.2.2

func (it *OsFile) FileName() string

func (*OsFile) HasError added in v0.2.2

func (it *OsFile) HasError() bool

func (*OsFile) HasFile added in v0.2.2

func (it *OsFile) HasFile() bool

func (*OsFile) IsDeferCloseRequired added in v0.2.2

func (it *OsFile) IsDeferCloseRequired() bool

func (*OsFile) IsEmptyError added in v0.2.2

func (it *OsFile) IsEmptyError() bool

func (*OsFile) IsEmptyFile added in v0.2.2

func (it *OsFile) IsEmptyFile() bool

func (*OsFile) IsSafeFile added in v0.2.2

func (it *OsFile) IsSafeFile() bool

func (*OsFile) ParentDir added in v0.2.2

func (it *OsFile) ParentDir() string

func (*OsFile) RwxWrapper added in v0.2.2

func (it *OsFile) RwxWrapper() *pathchmod.RwxWrapperWithError

func (*OsFile) WriteBytes added in v0.2.2

func (it *OsFile) WriteBytes(
	writingBytes []byte,
) (hasWrittenSuccessfully bool, errWp *errorwrapper.Wrapper)

func (*OsFile) WriteString added in v0.2.2

func (it *OsFile) WriteString(
	writingString string,
) (hasWrittenSuccessfully bool, errWp *errorwrapper.Wrapper)

Source Files

Jump to

Keyboard shortcuts

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