Documentation ¶
Index ¶
- func AddDataToFile(srcfile, dstfile string, data []byte) error
- func CopyFile(srcFile, dstFile string) error
- func CreateTemp(baseName string) (string, error)
- func GetFileFromURL(url string, fileName string, skipVerify bool) error
- func GetFilesList(dir string, pattern string) ([]string, error)
- func HTTPShare(directory, listenAddr string)
- func IsIPv4(value string) bool
- func Sed(oldValue, newValue, file string) error
- func SetTimeout(timeout time.Duration) time.Duration
- func TrimStringFromChar(s, c string) string
- func WriteFile(dstfile string, data []byte) error
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDataToFile ¶
*
- Add data to file
- @remarks Added data is optional
- @param srcFile Source file
- @param dstFile Destination file
- @param data Data to add at the end of destination file
- @returns Nothing or an error
func CopyFile ¶
*
- Copy file
- @remarks This function simply copies a file to another
- @param srcFile Source file
- @param dstFile Destination file
- @returns Nothing or an error
NOTE: CopyFile does not have unit test as it uses AddDataToFile which is already tested
func CreateTemp ¶
*
- Create a temporary file
- @remarks Create temporary file with a name based on baseName
- @param baseName String to trim
- @returns Created filename or an error
func GetFileFromURL ¶
*
- Get File through HTTP
- @param url URL where to download the file
- @param fileName of the file to create
- @param skipVerify Skip TLS check if needed
- @returns Nothing or an error
func GetFilesList ¶
*
- Get a list of files
- @param dir Directory where to search
- @param pattern Search pattern
- @returns List of files or an error
func HTTPShare ¶
func HTTPShare(directory, listenAddr string)
*
- Share files through HTTP (simple way, no security at all!)
- @remarks A HTTP server is up and running
- @param directory The directory where is files are
- @param listenAddr Port where to listen to
- @returns Nothing
TODO: Use Server function from http helpers instead
func IsIPv4 ¶
*
- Check if the string is a valid IPv4
- @param value Value to check
- @returns True if value is an IPv4, otherwise False
func Sed ¶
*
- Simple sed command
- @param oldValue Value or simple regex to modify
- @param newValue New value to set
- @param file File to modify
- @returns Nothing or an error
Sed code partially from https://forum.golangbridge.org/t/using-sed-in-golang/23526/16
func SetTimeout ¶
*
- Configure a timeout based on TIMEOUT_SCALE env variable
- @remarks Multiply a duration with TIMEOUT_SCALE value
- @param timeout Initial timeout value
- @returns Modified timeout value
func TrimStringFromChar ¶
*
- Trim a string
- @remarks Remove all from s string after c char
- @param s String to trim
- @param c Character used as a separator
- @returns Trimmed string
Types ¶
type Client ¶
func (*Client) GetFile ¶
*
- Get file through SSH (a SCP in fact!)
- @param localFile Local file to create
- @param remoteFile Remote file to copy from
- @param perm Permissions to set on the local file
- @returns Nothing or an error
Click to show internal directories.
Click to hide internal directories.