Risuko
Node.js API

Options

Read and modify engine and per-task options at runtime.

Per-Task Options

getOption

Get the options for a specific download task. Returns only the keys set on the task itself (at add time or via changeOption); global options are not merged in.

function getOption(gid: string): Promise<Record<string, unknown>>;
const gid = await addUri(["https://example.com/file.zip"], { split: "8" });
const options = await getOption(gid);
console.log(options.split);   // "8"
console.log(options.dir);     // undefined unless set per-task

changeOption

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>;
// Stop a seeding torrent immediately
await changeOption(gid, { "seed-time": "0" });

Changeable Options

changeOption merges the provided keys into the task's option map, so any key can be stored. Only seed-time is acted on immediately:

KeyEffect on a running task
seed-timeSetting to "0" while a torrent is seeding (and the effective seed-ratio is 0 or absent) stops seeding immediately and emits risuko.onDownloadComplete
seed-ratioConsulted only as the guard for the seed-time stop above; the seeding goals themselves are read from global options each tick
max-download-limitStored on the task; the per-task speed limiter is built when a worker starts, so the new limit applies the next time the task is restarted (e.g. pause then unpause)

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). To change URIs, the save path, or trackers on an existing task, use updateTask instead.

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 src-tauri/risuko-engine/src/config/defaults.rs and are stored as JSON numbers/strings; changeGlobalOption accepts either form. Speed-limit values also accept K (×1024) and M (×1048576) suffixes, e.g. "512K" or "10M".

KeyDefaultDescription
dirOS Downloads dirDefault download directory
max-concurrent-downloads5Maximum active non-torrent download workers. Queue reconciliation can preempt lower-priority non-torrent workers back to waiting; BitTorrent tasks are managed separately
max-overall-download-limit0Global download speed limit (bytes/s, 0 = unlimited; updates the SpeedLimiter immediately)
split16Default number of HTTP connections for new downloads and M3U8 segment workers
seed-ratio0Stop seeding once the upload/download ratio reaches this value (0 = no ratio goal; checked every second)
seed-time0Stop seeding after this many minutes (0 = no time goal)
keep-seedingfalseSeed until stopped manually, ignoring seed-ratio/seed-time
user-agentChrome UA stringDefault user agent string
all-proxy""Default HTTP-profile proxy URL
p2p-proxy""Default P2P TCP proxy URL (hot-reloaded; restarts affected P2P downloads)
p2p-udp-proxy""Optional P2P UDP proxy; empty reuses p2p-proxy
pbh-enablefalseStart the PeerBanHelper Aria2Next RPC listener (read at startEngine only)
pbh-listen-port16801PeerBanHelper RPC port (read at startEngine only)
doh-enablefalseResolve DNS over HTTPS (only active when doh-url is set). Hot-reloaded when any doh-* key changes
doh-url""DoH endpoint URL; must be https://
doh-bootstrap""Comma/space/newline-separated IPs for reaching the endpoint host without system DNS
doh-fallbacktrueFall back to the system resolver when a DoH query fails
nzb-body-timeout30Maximum idle time in seconds between chunks while fetching an NZB URL body
rpc-listen-port16800RPC server port (read at startEngine only)

rpc-listen-port, rpc-secret, pbh-enable, pbh-listen-port, pbh-rpc-secret, listen-port, dht-listen-port, ed2k-enable-kad, ed2k-kad-port, ed2k-port, and most bt-* keys are read once at startEngine; changing them with changeGlobalOption has no effect until the engine is restarted. p2p-proxy / p2p-udp-proxy are hot-reloaded.

On this page