Documentation
¶
Index ¶
- func CheckAndConvertFile(file io.Reader, fileName string) (io.Reader, error)
- func DeleteFile(filename, uploadDirectory string) error
- func DeleteMultipleFiles(filenames []string, uploadDirectory string) error
- func UploadFile(file io.Reader, fileName, uploadDirectory string, convertToWebP bool) (string, error)
- func UploadMultipleFiles(files []io.Reader, fileNames []string, uploadDirectory string, ...) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAndConvertFile ¶ added in v1.0.5
CheckAndConvertFile checks if a file is an image and converts it to WebP. Returns the original file if the format is unsupported, or the WebP-converted file. Returns an error if conversion fails.
func DeleteFile ¶
DeleteFile removes a single file from the specified directory. Returns an error if the file does not exist or deletion fails.
func DeleteMultipleFiles ¶ added in v1.0.3
DeleteMultipleFiles deletes multiple files and returns an error if any deletions fail. Returns nil if all deletions succeed.
func UploadFile ¶
func UploadFile(file io.Reader, fileName, uploadDirectory string, convertToWebP bool) (string, error)
UploadFile uploads a single file to the specified directory. Optionally converts images to WebP format and generates a unique filename. Returns the unique filename or an error if the upload fails.
func UploadMultipleFiles ¶ added in v1.0.3
func UploadMultipleFiles(files []io.Reader, fileNames []string, uploadDirectory string, convertToWebP bool) ([]string, error)
UploadMultipleFiles uploads multiple files and rolls back if any fail. Returns a list of uploaded filenames or an error if any upload fails.
Types ¶
This section is empty.