Class DownloadExecutor


  • public final class DownloadExecutor
    extends Object
    Utility to download files with random names to a given folder
    • Method Detail

      • downloadTo

        public static File downloadTo​(File targetFolder,
                                      bg.codexio.ai.openai.api.payload.voice.response.AudioBinaryResponse result,
                                      String mediaType)
                               throws IOException
        Parameters:
        targetFolder - where to download the file
        result - a result given by the OpenAI API
        mediaType - the extension of the file to be saved
        Returns:
        the downloaded File with random UUID name.
        Throws:
        IOException - if the target folder does not exist, or it's not writable