Documentation
¶
Index ¶
- Variables
- func ConvertFileToMP3(inputFilePath string) (string, error)
- func ConvertReaderToMP3(reader io.Reader, outputDir string) (string, error)
- func CreateUniqueFolder(basePath string) (string, error)
- func DeleteFolder(path string) error
- func DownloadFileURL(url, dest string) (string, error)
- func HandleFileUpload(ctx context.Context, file interface{}, cloudinaryURL string) (string, error)
- func HandleReadiness() http.HandlerFunc
- func LoadEnv(path string) (string, string, string, string, string, string, error)
- func Ptr[T any](v T) *T
- func RespondWithError(w http.ResponseWriter, code int, errmessage string)
- func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
- func SetBoolValue(value string, param **bool)
- func SetFloatValue(value string, param **float64)
- func SetIntValue(value string, param **int)
- func SetStringValue(value string, param **string)
Constants ¶
This section is empty.
Variables ¶
var BasePath string = "./downloads" // Base path for downloads
set the default path to where the video or audio will be downloaded
var ErrUnsupportedFileFormat = errors.New("unsupported file format")
var OutputName string = "youtube" // Default output name
Functions ¶
func ConvertFileToMP3 ¶
ConvertFileToMP3 converts the given input filepath to MP3 format.
func ConvertReaderToMP3 ¶
ConvertReaderToMP3 reads a video from an io.Reader and converts it to MP3.
func CreateUniqueFolder ¶
CreateUniqueFolder creates a new folder with a unique name within the specified base path
func DeleteFolder ¶
DeleteFolder removes the specified folder and all its contents
func DownloadFileURL ¶
DownloadFileURL downloads a file from the given URL and saves it to the specified path.
func HandleFileUpload ¶
HandleFileUpload is a function that handles file uploads to Cloudinary. It uploads the file to Cloudinary and returns the Direct URL of the uploaded file.
If any error occurs during the process, the function returns an empty string and the error.
func HandleReadiness ¶
func HandleReadiness() http.HandlerFunc
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, errmessage string)
func RespondWithJSON ¶
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
func SetBoolValue ¶
SetBoolValue sets the value of the bool pointer if the given string is a valid boolean.
func SetFloatValue ¶
SetFloatValue sets the value of the float64 pointer if the given string is a valid float.
func SetIntValue ¶
SetIntValue sets the value of the int pointer if the given string is a valid integer.
func SetStringValue ¶
SetStringValue sets the value of the string pointer if the given string is not empty.
Types ¶
This section is empty.