# README
fio (File Input/Output) 
This is a Linux-only package of convenience file operation functions which utilize advisory file locks for interaction with applications which support them; e.g. most FTP servers. These functions do not return error
values; they use panik.
See fio_api.go
for available functions.
Development
The following needs to be run before working on tests locally:
go install github.com/golang/mock/[email protected]
go generate
# Functions
CopyFile creates a file at toFilePath, truncating it if it already exists, writes to it all data read from the file at fromFilePath, logs on success and returns the amount of bytes copied.
MoveFile creates a file at toFilePath, truncating it if it already exists, writes to it all data read from the file at fromFilePath, removes the file at fromFilePath, logs on success and returns the amount of bytes moved.
OpenFile opens the file at filePath in the same manner as os.OpenFile, but also claims an advisory lock matching your access flags (r/w/rw) which will be released when closing the file.
ReadFile opens the file at filePath, claims an advisory read lock, reads all of its contents, closes the file, logs on success and returns the read contents.
RemoveFile removes the file at filePath if it exists, logs this and returns true on success.
RenameFile is a shorthand for panik.OnError(os.Rename(fromFilePath, toFilePath)).
WriteFile creates a file at filePath, truncating it if it already exists, writes data to it and logs on success.
WriteFilePerm creates a file with permissions perm at filePath, truncating it if it already exists, writes data to it and logs on success.
WriteFileWithReader creates a file at filePath, truncating it if it already exists, writes to it all data read from reader, logs on success and returns the amount of bytes written.
WriteFileWithReaderPerm creates a file with permissions perm at filePath, truncating it if it already exists, writes to it all data read from reader, logs on success and returns the amount of bytes written.
# Variables
IsLoggingEnabled allows to disable all logging done by package fio by setting it to false.
Logger is the logger used to write logs by package fio when IsLoggingEnabled is true.