View Source
const (
	// TempDir - Serves as tmp directory for atomic file operations
	TempDir = "tmp"


This section is empty.


func AcquireFileLock

func AcquireFileLock(filePath string) (*fslock.Lock, error)

    AcquireFileLock -

    func AppendDataInFile

    func AppendDataInFile(filePath string, data []byte, makeDir bool) error

      AppendDataInFile - AppendDataInFile

      func AppendDataToFile

      func AppendDataToFile(filePath string, data []byte, makeDir bool) (startOffset int64, dataSize int, err error)

        AppendDataToFile - AppendDataToFile

        func AppendFile

        func AppendFile(filename string, text string) (int, error)

          AppendFile appends provided data/text to file

          func AtomicReplaceFile

          func AtomicReplaceFile(source, destination string) error

            AtomicReplaceFile atomically replaces the destination file or directory with the source. It is guaranteed to either replace the target file entirely, or not change either file.

            func CleanPath

            func CleanPath(path string) string

              CleanPath clean path

              func CloseFilePointer

              func CloseFilePointer(filePath string) error

                CloseFilePointer - CloseFilePointer

                func CopyDir

                func CopyDir(source string, dest string) (err error)

                  CopyDir makes copy of source directory to the destination directory

                  func CopyFile

                  func CopyFile(source, destination string, makeDir bool) (int64, error)

                    CopyFile CopyFile

                    func CreateDirectory

                    func CreateDirectory(directoryPath string) error

                      CreateDirectory creates directory using provided path

                      func CreateDirectoryRecursive

                      func CreateDirectoryRecursive(directoryPath string) error

                        CreateDirectoryRecursive creates directory recursively using provided path

                        func DeleteDirectory

                        func DeleteDirectory(directoryPath string) error

                          DeleteDirectory creates directory using provided path

                          func DeleteFile

                          func DeleteFile(filePath string) error

                            DeleteFile deletes provided file path

                            func FastReadFile

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

                              FastReadFile - reads contents from provided file path with fast read method

                              func FastWriteFile

                              func FastWriteFile(filePath string, data []byte, makeDir bool, createBackup bool, safeMode bool) error

                                FastWriteFile - writes provided bytes to file with fast write method

                                func FileAvailabilityCheck

                                func FileAvailabilityCheck(filePath string) bool

                                  FileAvailabilityCheck checks whether file is available at given location

                                  func FileInfo

                                  func FileInfo(path string) (os.FileInfo, error)

                                    FileInfo FileInfo

                                    func Init

                                    func Init(taskCount, concurrency int)

                                      Init initializes Filemdl object with parameters

                                      func ListDirectory

                                      func ListDirectory(directoryPath string) ([]os.FileInfo, error)

                                        ListDirectory returns list of all available components of directory

                                        func ListFileRecursively

                                        func ListFileRecursively(path string) ([]string, error)

                                          ListFileRecursively - returns array of filepath recursively from specified path

                                          func MoveDirectory

                                          func MoveDirectory(source, destination string) error

                                            MoveDirectory MoveDirectory

                                            func MoveFile

                                            func MoveFile(source, destination string) error

                                              MoveFile MoveFile

                                              func MoveFileToOtherHost

                                              func MoveFileToOtherHost(source, destination string) error

                                                MoveFileToOtherHost MoveFileToOtherHost

                                                func MoveFolderToOtherHost

                                                func MoveFolderToOtherHost(source, destination string) error

                                                  MoveFolderToOtherHost MoveFolderToOtherHost

                                                  func Open

                                                  func Open(name string) (*os.File, error)

                                                    Open - opens file with read mode

                                                    func OpenFile

                                                    func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

                                                      OpenFile - opens file with specified mode

                                                      func ReadFile

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

                                                        ReadFile reads contents from provided file path and retry when timeout occure

                                                        func ReadFileFromOffset

                                                        func ReadFileFromOffset(f *os.File, startOffset int64, dataSize int64) ([]byte, error)

                                                          ReadFileFromOffset - ReadFileFromOffset

                                                          func ReadFileUsingFp

                                                          func ReadFileUsingFp(fp *os.File) ([]byte, error)

                                                            ReadFileUsingFp reads contents from provided file pointer

                                                            func ReleaseFileLock

                                                            func ReleaseFileLock(lock *fslock.Lock) error


                                                              func RenameFile

                                                              func RenameFile(oldFilePath, newFilePath string) error

                                                                RenameFile renames/moves file from old path to new path

                                                                func ReplaceFile

                                                                func ReplaceFile(data []byte, destination string, createBackup bool) error

                                                                  ReplaceFile ReplaceFile

                                                                  func SetBackPath

                                                                  func SetBackPath(folderPath, dbFolderPath string) error

                                                                    SetBackPath set backup folder path

                                                                    func TruncateFile

                                                                    func TruncateFile(path string, size int64) error

                                                                      TruncateFile TruncateFile

                                                                      func UnZipBytes

                                                                      func UnZipBytes(compressedData []byte) ([]byte, error)

                                                                        UnZipBytes bytes - Decompress

                                                                        func UnZipSingleFile

                                                                        func UnZipSingleFile(sourceFilePath, destFilePath string) error

                                                                          UnZipSingleFile - UnZip Single File

                                                                          func Unzip

                                                                          func Unzip(archive, target string) error

                                                                            Unzip Unzip

                                                                            func Walk

                                                                            func Walk(root string, walkFunc WalkFunc) error

                                                                              Walk - walks folder recursively

                                                                              func WriteFile

                                                                              func WriteFile(filePath string, data []byte, makeDir bool, createBackup bool) error

                                                                                WriteFile writes provided bytes to file

                                                                                func WriteFileAtOffset

                                                                                func WriteFileAtOffset(f *os.File, startOffset int64, bytesToWrite []byte) (int64, error)

                                                                                  WriteFileAtOffset - WriteFileAtOffset

                                                                                  func WriteFileUsingFp

                                                                                  func WriteFileUsingFp(f *os.File, data []byte, makeDir bool, createBackup bool) error

                                                                                    WriteFileUsingFp writes provided bytes to file

                                                                                    func Zip

                                                                                    func Zip(source, target string) error

                                                                                      Zip - Zip

                                                                                      func ZipBytes

                                                                                      func ZipBytes(inputData []byte) ([]byte, error)

                                                                                        ZipBytes - zip byte array

                                                                                        func ZipSingleFile

                                                                                        func ZipSingleFile(sourceFilePath, destFilePath string) error

                                                                                          ZipSingleFile - Zip single file

                                                                                          func ZipWithSkipFileList

                                                                                          func ZipWithSkipFileList(source, target string, skipFileList []string) error

                                                                                            ZipWithSkipFileList This method will skip the file added in skiplist from zip

                                                                                            func ZipWithoutBaseDirectory

                                                                                            func ZipWithoutBaseDirectory(source, target string) error

                                                                                              ZipWithoutBaseDirectory Zip Without Base Directory


                                                                                              type FileHelperServiceObject

                                                                                              type FileHelperServiceObject struct {
                                                                                              	// contains filtered or unexported fields

                                                                                                FileHelperServiceObject FileHelperServiceObject must be created while calling FileSearh function

                                                                                                func (*FileHelperServiceObject) FileSearch

                                                                                                func (fileHelperServiceObject *FileHelperServiceObject) FileSearch(fileName, path string) ([]string, error)

                                                                                                  FileSearch FileSearch

                                                                                                  type Filemdl

                                                                                                  type Filemdl struct {
                                                                                                  	Error error
                                                                                                  	// contains filtered or unexported fields

                                                                                                    Filemdl Object

                                                                                                    func GetInstance

                                                                                                    func GetInstance() *Filemdl

                                                                                                      GetInstance return single instance of filemdl object

                                                                                                      func (*Filemdl) Save

                                                                                                      func (filemdl *Filemdl) Save(filePath string, ba []byte, makeDir, createBackup bool) error

                                                                                                        Save Enque the requested object

                                                                                                        type WalkFunc

                                                                                                        type WalkFunc func(path string, info os.FileInfo, err error) error

                                                                                                          WalkFunc - WalkFunc


                                                                                                          Path Synopsis