file

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndConvertFile added in v1.0.5

func CheckAndConvertFile(file io.Reader, fileName string) (io.Reader, error)

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

func DeleteFile(filename, uploadDirectory string) error

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

func DeleteMultipleFiles(filenames []string, uploadDirectory string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL