add stat for file existant checks

This commit is contained in:
celogeek 2022-05-14 19:38:08 +02:00
parent 5dbd59fe8f
commit 367f0c978e
Signed by: celogeek
GPG Key ID: E6B7BDCFC446233A

View File

@ -2,6 +2,7 @@ package photosapi
import (
"fmt"
"io/fs"
"os"
"path/filepath"
)
@ -24,7 +25,7 @@ func (s *Storage) Create(paths ...string) error {
}
func (s *Storage) Exists(paths ...string) bool {
f, err := os.Stat(s.Join(paths...))
f, err := s.Stat(paths...)
if err != nil {
return false
}
@ -38,3 +39,7 @@ func (s *Storage) Delete(paths ...string) error {
return fmt.Errorf("%s doesn't exists", s.Join(paths...))
}
}
func (s *Storage) Stat(paths ...string) (fs.FileInfo, error) {
return os.Stat(s.Join(paths...))
}