diff --git a/pkg/fileio/fileio.go b/pkg/fileio/fileio.go index 4a24a47..959394e 100644 --- a/pkg/fileio/fileio.go +++ b/pkg/fileio/fileio.go @@ -2,6 +2,7 @@ package fileio import ( "bufio" + "errors" "fmt" "os" @@ -49,3 +50,19 @@ func ReadFile(fileName string) string { return string(content) } + +func FileExist(fileName string) bool { + var exist bool + + // Check if the file exists + if _, err := os.Stat(fileName); !errors.Is(err, os.ErrNotExist) { + // Set the value to true + exist = true + } else { + // Set the value to false + exist = false + } + + // Return if the file exists + return exist +}