@tremendous/help
    Preparing search index...

    Function downloadFilePromise

    • Downloads a file from the given URL and saves it with the specified filename, returning a promise.

      Parameters

      • requestUrl: string

        The URL to request the file from.

      • Optionalfilename: string

        The filename to save the file as. If not provided, it tries to use the filename from the content-disposition header or defaults to "missing_filename".

      Returns Promise<void>

      • A promise that resolves when the file is successfully downloaded or rejects if there is an error.
      downloadFilePromise("https://example.com/file.pdf", "downloaded_file.pdf")
      .then(() => {
      console.log("File downloaded successfully");
      })
      .catch((e) => {
      console.error("Failed to download file", e);
      });