API client for transmissionbt


transmission-daemon wrapper script written in node.js

npm install transmission
Transmission = require 'transmission'
transmission = new Transmission
  host: 'localhost'  # default 'localhost' 
  port: 9091         # default 9091 
  username: 'hoge'   # default blank 
  password: 'fuga'   # default blank 
  url: '/my/other/url'   # default '/transmission/rpc' 

RPC returned torrent status with integer 0-7.

Using transmission.status for inspect status.

transmission.status =
  STOPPED       : 0  # Torrent is stopped
  CHECK_WAIT    : 1  # Queued to check files
  CHECK         : 2  # Checking files
  DOWNLOAD_WAIT : 3  # Queued to download
  DOWNLOAD      : 4  # Downloading
  SEED_WAIT     : 5  # Queued to seed
  SEED          : 6  # Seeding
  ISOLATED      : 7  # Torrent can't find peers

Set torrent's properties.

transmission.set [16]options(err) ->

You must provide one or more ids. According to the rpc-spec, transmission will not respond a success argument. Only error.

Add torrents to transmission-daemon.

transmission.addFile 'path'(err, arg) ->


The options object would be the arguments passed to transmission. If you want to set the download directory of the torrent you would pass in "download-dir":"/my/path"

transmission.addFile 'path'options(err, arg) ->

Add torrents to transmission-daemon.

transmission.addUrl 'url'(err, arg) ->


The options object would be the arguments passed to transmission. If you want to set the download directory of the torrent you would pass in "download-dir":"/my/path"

transmission.addUrl 'url'options(err, arg) ->

Remove torrents.

Remove also local data when del is true.

transmission.remove [17]true(err, arg) ->

List of active torrents. Callback is not needed and will fire the active event. (err, arg) ->

Get torrents info that optional ids.

If omit ids, get all torrents.

# Get torrents with id #1 and #7 
transmission.get [17](err, arg) ->
  if err
    console.error err
    for torrent in arg.torrents
      console.log arg.torrents
# Get all torrents and remove it if status is stopped. 
transmission.get (err, arg) ->
  if err
    console.error err
    for torrent in arg.torrents
      if torrent.status is transmission.status.STOPPED
        transmission.remove [](err) ->
          console.error err if err

Stop working torrents.

transmission.stop [17](err, arg) ->

Start working torrents.

transmission.start [17](err, arg) ->

Bypass the download queue, start working torrents immediately.

transmission.startNow [17](err, arg) ->

Verify torrent data.

transmission.verify [17](err, arg) ->

Reannounce to the tracker, ask for more peers.

transmission.reannounce [17](err, arg) ->

Get client session infomation.

transmission.session (err, arg) ->

Set session infomation.

transmission.session {'download-dir':'/my/path'}(err, arg) ->

Get client session stats.

transmission.sessionStats (err, arg) ->
var Transmission = require('./')
var transmission = new Transmission({
port : 9091,
host : ''
function getTorrent(id) {
transmission.get(id, function(errresult) {
if (err) {
throw err
console.log('bt.get returned ' + result.torrents.length + ' torrents')
result.torrents.forEach(function(torrent) {
console.log('hashString', torrent.hashString)
function removeTorrent(id) {
transmission.remove(id, function(err) {
if (err) {
throw err
console.log('torrent was removed')
transmission.addUrl('', {
"download-dir" : "/home/torrents"
}, function(errresult) {
if (err) {
return console.log(err)
var id =
console.log('Just added a new torrent.')
console.log('Torrent ID: ' + id)