Skip to content


Subversion checkout URL

You can clone with
Download ZIP
transmission torrent RPC client.
Tree: 3f85c26f55

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


transmission-daemon wrapper script written in node.js


npm install transmission

How to Use

Transmission = require 'transmission'
transmission = new Transmission
  host: 'localhost'  # default 'localhost'
  port: 9091         # default 9091
  username: 'hoge'   # default blank
  password: 'fuga'   # default blank



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


Event: "added"

function (hash, id, name) { }

Emits when a new torrent is added

Event: "removed"

function (id) { }

Emits when a torrent is removed

Event: "stopped"

function (id) { }

Emits when a torrent is stopped

Event: "force"

function (id) { }

Emits when a torrent is forced to start

Event: "active"

function (torrents) { }

Emits when the active method is called.


transmission.add(path, callback)

Add torrents to transmission-daemon.

transmission.add 'path/or/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.add 'path/or/url', options, (err, arg) ->

transmission.remove(ids, del, callback)

Remove torrents.

Remove also local data when del is true.

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

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

transmission.get([ids], callback)

Get torrents info that optional ids.

If omit ids, get all torrents.

# Get torrents with id #1 and #7
transmission.get [1, 7], (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

transmission.stop(ids, callback)

Stop working torrents.

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

transmission.start(ids, callback)

Start working torrents.

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

transmission.startNow(ids, callback)

Bypass the download queue, start working torrents immediately.

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

transmission.verify(ids, callback)

Verify torrent data.

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

transmission.reannounce(ids, callback)

Reannounce to the tracker, ask for more peers.

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


Get cleint session infomation.

transmission.session (err, arg) ->

transmission.session({}, callback)

Set session infomation.

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


Get cleint session stats.

transmission.sessionStats (err, arg) ->

All together.

var transmission = new (require('../lib/transmission.js'))({
    //port : 9091,
    //host : 'localhost',
    //username : 'admin',
    //password : 'password1'

transmission.on('added', function(hash, id, name) {
    console.log('torrent added', hash, id, name)
transmission.on('removed', function(id) {
    console.log('torrent removed id:', id)
transmission.on('stopped', function(id) {
    console.log('torrent stopped id:', id)
transmission.on('force', function(id) {
    console.log('torrent force start id:', id)
transmission.on('active', function(torrents) {
    console.log('active torrent count:', torrents.length)

transmission.add('', function(err, result) {
    if (err) {
        throw err
    var id =
    transmission.stop(id, function(err) {
        if (err) {
            throw err
        transmission.start(id, function(err) {
            if (err) {
                throw err
            transmission.get(id, function(err, result) {
                if (err) {
                    throw err

                transmission.remove(id, true, function(err) {
                    if (err) {
                        throw err
Something went wrong with that request. Please try again.