Class DownloadExecutor

java.lang.Object
bg.codexio.ai.openai.api.sdk.voice.speech.DownloadExecutor

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

    • 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