Options
Read and modify engine and per-task options at runtime.
Per-Task Options
getOption
Get the options for a specific download task.
function getOption(gid: string): Promise<Record<string, unknown>>;const options = await getOption(gid);
console.log(options.dir); // Download directory
console.log(options.split); // Number of connectionschangeOption
Change options for a running task. Only some options can be changed after a download starts.
function changeOption(
gid: string,
options: Record<string, unknown>
): Promise<void>;// Limit download speed to 1 MB/s
await changeOption(gid, { "max-download-limit": "1048576" });Changeable Options
changeOption merges the provided keys into the task's option map, so any key can be stored. Only a subset is consumed live by the engine:
| Key | Effect on a running task |
|---|---|
max-download-limit | Updates the per-task download speed limit on the next tick (bytes/sec, "0" for unlimited) |
max-upload-limit | Updates the per-torrent upload speed limit (BitTorrent) |
seed-time | Setting to "0" while a torrent is seeding (and seed-ratio is also 0 or absent) stops seeding immediately and emits risuko.onDownloadComplete |
seed-ratio | Same stop-on-zero behaviour as seed-time; otherwise re-evaluated by the seeding loop |
Other options are stored on the task and used the next time a relevant action runs (for example, dir/out when the task is restarted).
Global Options
getGlobalOption
Get the current global engine options.
function getGlobalOption(): Promise<Record<string, unknown>>;const global = await getGlobalOption();
console.log(global["max-concurrent-downloads"]);
console.log(global["max-overall-download-limit"]);changeGlobalOption
Change global engine options. These affect new downloads and some aspects of running downloads.
function changeGlobalOption(
options: Record<string, unknown>
): Promise<void>;// Limit to 3 concurrent downloads
await changeGlobalOption({ "max-concurrent-downloads": "3" });
// Set global speed limit to 10 MB/s
await changeGlobalOption({ "max-overall-download-limit": "10485760" });Global Option Reference
Defaults come from system_defaults() in src-tauri/risuko-engine/src/config/defaults.rs and are stored as JSON numbers/strings; changeGlobalOption accepts either form.
| Key | Default | Description |
|---|---|---|
dir | OS Downloads dir | Default download directory |
max-concurrent-downloads | 5 | Maximum number of parallel downloads |
max-overall-download-limit | 0 | Global download speed limit (bytes/s, 0 = unlimited; updates the SpeedLimiter immediately) |
max-overall-upload-limit | 0 | Global upload speed limit (bytes/s) |
split | 16 | Default number of HTTP connections for new downloads |
user-agent | Chrome UA string | Default user agent string |
all-proxy | "" | Default proxy URL |
rpc-listen-port | 16800 | RPC server port (read at startEngine only) |