# core.download

Call a job that produces downloadable output and get a URL to retrieve the result.

This method executes jobs that generate files or streaming data for download. The job writes its output to a pipe, and this method returns a time-limited, single-use download URL.

1. Call `core.download` with the target job method, arguments, and desired filename

2. Receive an array containing the job ID and download URL

3. Make an HTTP GET request to the download URL to retrieve the data

4. The download URL expires after a timeout and can only be used once

Jobs that can be downloaded:

- audit.download_report

- config.save

- filesystem.get

- pool.dataset.export_key

- pool.dataset.export_keys

- pool.dataset.export_keys_for_replication

- system.debug

- vm.log_file_download

Type: object

##

Type: array
No Additional Items

#### Tuple Validation

##### Parameter 1: method

#### method

Type: string

Name of the job method to execute.

Example:

    "config.save"

##### Parameter 2: args

#### args

Type: array

Arguments to pass to the job method.

No Additional Items

##### Each item of this array must be:

Type: object

##### Parameter 3: filename

#### filename

Type: string

Suggested filename for the downloaded file. Sets the `Content-Disposition` header.

Example:

    "system-config-backup.db"

##### Parameter 4: buffered

#### buffered

Type: boolean Default: false

Whether to buffer the job's output.

- `false` (default): Job starts writing immediately to the download stream. The job blocks until the client downloads the data or 60 seconds elapses. Use for large files or streaming data.
- `true`: Job output is buffered in RAM until completion, then made available for download. The download URL remains valid for 3600 seconds. Use for small files when you need to ensure the job completes before downloading.

##

#### Result

Type: array

Array containing the job ID and download URL.

- First element: Job ID that can be used with `core.get_jobs` to monitor progress
- Second element: Download URL in the format `/_download/{job_id}?auth_token={token}`

Must contain a minimum of `2` items

Must contain a maximum of `2` items

No Additional Items

#### Tuple Validation

##### Item at 1 must be:

Type: integer

##### Item at 2 must be:

Type: string
Example:

    [
        86,
        "/_download/86?auth_token=9WIqYg4jAYEOGQ4g319Bkr64Oj8CZk1VACfyN68M7hgjGTdeSSgZjSf5lJEshS8M"
    ]

Required roles: