Intel471Ex.Downloader (intel471_ex v0.2.0)

Copy Markdown

File downloader for Intel 471 Verity API using Req.

Summary

Functions

Downloads a file from Intel 471 Verity API.

Downloads a file from Intel 471 Verity API and automatically extracts the filename from the URL.

Functions

download_file(url, destination, config \\ nil)

@spec download_file(String.t(), String.t(), map() | nil) ::
  {:ok, String.t()} | {:error, any()}

Downloads a file from Intel 471 Verity API.

Parameters

  • url: Full URL to the file
  • destination: Local path where the file should be saved
  • config: Optional configuration override

Returns

  • {:ok, path} — Successful download with path to saved file
  • {:error, reason} — Error with reason

Examples

{:ok, path} = Intel471Ex.Downloader.download_file(
  "https://api.intel471.cloud/integrations/intel-report/v1/reports/report-id/download-as-pdf",
  "/tmp/report.pdf"
)

download_file_auto(url, destination_dir \\ "downloads", config \\ nil)

@spec download_file_auto(String.t(), String.t(), map() | nil) ::
  {:ok, String.t()} | {:error, any()}

Downloads a file from Intel 471 Verity API and automatically extracts the filename from the URL.

Parameters

  • url: Full URL to the file
  • destination_dir: Directory where the file should be saved (default: "downloads")
  • config: Optional configuration override

Returns

  • {:ok, path} — Successful download with path to saved file
  • {:error, reason} — Error with reason

Examples

{:ok, path} = Intel471Ex.Downloader.download_file_auto(
  "https://api.intel471.cloud/integrations/intel-report/v1/reports/report-id/download-as-pdf"
)
{:ok, path} = Intel471Ex.Downloader.download_file_auto(
  "https://api.intel471.cloud/integrations/intel-report/v1/reports/report-id/download-as-pdf",
  "output/pdfs"
)