feat: add file exists check

This commit is contained in:
2026-02-19 16:01:56 +01:00
parent 80e2d868d2
commit ecc4564ff7
2 changed files with 24 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package lib
import (
"errors"
"fmt"
"os"
"path"
"strings"
)
@@ -97,3 +98,16 @@ func GetFormatFromQuality(quality string) (string, error) {
return "", errors.New("Invalid quality.")
}
}
func FileExists(file string) (bool, error) {
_, err := os.Stat(file)
if err == nil {
return true, nil
}
if errors.Is(err, os.ErrNotExist) {
return false, nil
}
return false, err
}