Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-libtorrent with all npm packages installed. Try it out:

var nodeLibtorrent = require("node-libtorrent")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-libtorrent v0.0.2

rb-libtorrent bindings for node.js


node-libtorrent provides native bindings to libtorrent rastebar as a Node.js addon.

Getting started

Execute in command line:

$ npm install node-libtorrent

or copy repository and build bindings manually

$ git clone git://
$ cd node-libtorrent
$ npm install -g node-gyp
$ node-gyp configure
$ node-gyp build


Simple client

lt = require "../build/Release/libtorrent"

s = new lt.session()
s.listen_on([6881, 6889])
ti = new lt.torrent_info "./test.torrent"
th = s.add_torrent
  ti: ti
  save_path: "./test_torrent"
main = ->
  st = th.status()
  console.log "#{st.progress*100} complete \
(down: #{st.download_rate / 1000} kb/s | up: #{st.upload_rate / 1000} kB/s | \
peers: #{st.num_peers})"
  setTimeout main, 2500

Create torrent

lt = require "../build/Release/libtorrent"

fs = new lt.file_storage()
lt.add_files fs, "./src"
ct = new lt.create_torrent(fs)
lt.set_piece_hashes ct, "."
t = lt.bencode ct.generate()
console.log t
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free