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 Supports JPG, JPEG, and PNG formats; returns original file for unsupported types
func DeleteFile ¶
DeleteFile removes a single file from the specified directory Takes the filename and directory path, deletes the file, and handles errors Returns an error if the file does not exist or deletion fails
func DeleteMultipleFiles ¶ added in v1.0.3
DeleteMultipleFiles removes multiple files from the specified directory Takes a slice of filenames and the directory path, attempts to delete each file Continues deletion even if some fail, returns an error with failed filenames
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, updates extension if converted, generates a unique kebab-case filename with a UUID, and copies the file content 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 handles the uploading of multiple files to the specified directory Optionally converts images to WebP, uploads each file, and ensures consistency Returns a slice of unique filenames or an error, rolling back on failure
Types ¶
This section is empty.