Add sync command

This commit is contained in:
Mikołaj Pęczkowski 2021-11-02 19:19:31 +01:00
commit 5e6a5e23fd
18 changed files with 1077 additions and 0 deletions

25
app/utils.go Normal file
View file

@ -0,0 +1,25 @@
package app
import (
"errors"
"fmt"
"io/ioutil"
"strings"
)
func getFileContent(pathToFile string) ([]byte, error) {
return ioutil.ReadFile(pathToFile)
}
func getFileExcension(pathToFile string) (string, error) {
splittedFileName := strings.Split(pathToFile, ".")
if len(splittedFileName) == 1 {
msg := fmt.Sprintf("excension for file \"%v\", not found", splittedFileName)
return "", errors.New(msg)
}
fileExcension := splittedFileName[len(splittedFileName)-1]
return fileExcension, nil
}