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.

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 connections

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>;
// Limit download speed to 1 MB/s
await changeOption(gid, { "max-download-limit": "1048576" });

Changeable Options

These options can be modified on a running task:

KeyDescription
max-download-limitMax download speed in bytes/sec ("0" for unlimited)
max-upload-limitMax upload speed in bytes/sec (BitTorrent)

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

KeyDefaultDescription
dirOS defaultDefault download directory
max-concurrent-downloads"5"Maximum number of parallel downloads
max-overall-download-limit"0"Global download speed limit (bytes/s, "0" = unlimited)
max-overall-upload-limit"0"Global upload speed limit (bytes/s)
split"16"Default number of connections for new downloads
user-agentChrome UA stringDefault user agent string
all-proxyDefault proxy URL
rpc-listen-port"16800"RPC server port

On this page