Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsOrError ¶
func ExistsOrError(fpath string, isFileExists FileExistsFunc) error
ExistsOrError checks if the file specified by fpath exists.
It returns an error if the file does not exist.
func ExtensionOrError ¶
ExtensionOrError checks if the filename has a valid extension.
It expects parts to contain two elements: the filename and its extension. Returns an error if the filename doesn't have a valid extension format.
func SupportedOrError ¶
SupportedOrError checks if the provided extension is among the supported ones.
It compares the extension parameter against a predefined list of valid extensions (jpg, jpeg, png). Returns an error if the extension is not supported.
func ValidateSize ¶
ValidateSize validates the format of the size string.
It checks if the size string matches the `<width>x<height>` format using a regular expression. Returns an error if the size string is empty, doesn't match the expected format, or if there was an error compiling the regular expression.
Types ¶
type FileExistsFunc ¶
FileExistsFunc is an interface that abstracts the IsFileExists function.