folder-treeTorrent Client

Permission

circle-exclamation
my-plugin.json
{
    //...
    "plugin": {
        "permissions": {
            "scopes": ["torrent-client"],
        }
    }
}

Core Methods

getTorrents

getTorrents()

Retrieves a list of all torrents in the torrent client.

Example:

// Get all torrents from the client
try {
  const torrents = await ctx.torrentClient.getTorrents()
  console.log("Retrieved torrents:", torrents)
} catch (error) {
  console.error("Error getting torrents:", error)
}

getActiveTorrents

Retrieves a list of active torrents (downloading/uploading) from the torrent client.

Example:

addMagnets

Adds magnet links to the torrent client.

Parameters:

  • magnets: string[] - Array of magnet links

  • dest: string - Destination path for downloaded files

Example:

removeTorrents

Removes torrents from the client.

Parameters:

  • hashes: string[] - Array of torrent hashes to remove

Example:

pauseTorrents

Pauses specified torrents.

Parameters:

  • hashes: string[] - Array of torrent hashes to pause

Example:

resumeTorrents

Resumes specified torrents.

Parameters:

  • hashes: string[] - Array of torrent hashes to resume

Example:

deselectFiles

Deselects specific files within a torrent.

Parameters:

  • hash: string - Hash of the torrent

  • indices: number[] - Array of file indices to deselect

Example:

getFiles

Retrieves all files within a specific torrent.

Parameters:

  • hash: string - Hash of the torrent

Example:

Last updated