Documentation
¶
Index ¶
- func CompareSha(inputFilename string, shaFilename string) (change bool, newSha []byte, err error)
- func ComputeShaFile(filename string) ([]byte, error)
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func DirExists(log *base.LogObject, dirname string) bool
- func DirSync(dirName string) error
- func FileExists(log *base.LogObject, filename string) bool
- func MoveDir(log *base.LogObject, src string, dst string) error
- func ReadSavedCounter(log *base.LogObject, fileName string) (uint32, bool)
- func ReadWithMaxSize(log *base.LogObject, filename string, maxReadSize int) ([]byte, error)
- func SaveShaInFile(filename string, sha []byte) error
- func StatAndRead(log *base.LogObject, filename string, maxReadSize int) (string, time.Time, error)
- func Writable(dir string) bool
- func WriteRename(fileName string, b []byte) error
- func WriteRenameWithBackup(fileName string, b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareSha ¶
CompareSha calculates the sha of a input file and compares with a sha stored in a sha file. If the inputFilename does not exist then it reports no change. If shaFilename output does not exist then it reports change.
func ComputeShaFile ¶
ComputeShaFile computes the sha256 for the content of a file
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func FileExists ¶
FileExists checks file existence.
func MoveDir ¶
MoveDir recursively move a directory tree, attempting to preserve permissions. if file exists in dst (sub)directory it will be replaced
func ReadSavedCounter ¶
ReadSavedCounter returns counter value from provided file If the file doesn't exist or doesn't contain an integer it returns false
func ReadWithMaxSize ¶
ReadWithMaxSize returns the content but limits the size to maxReadSize and truncates if longer
func SaveShaInFile ¶
SaveShaInFile saves the value to use used by future CompareSha calls.
func StatAndRead ¶
StatAndRead returns the content and Modtime We limit the size we read maxReadSize and truncate if longer
func WriteRename ¶
WriteRename write data to a tmpfile and then rename it to a desired name
func WriteRenameWithBackup ¶
WriteRenameWithBackup : just like WriteRename but additionally it creates a backup of the original file at the same path but with the ".bak" extension added.
Types ¶
This section is empty.