rb-libtorrent bindings for node.js
C++ Other
Latest commit 0d32a5c Jul 18, 2014 @fanatid Merge pull request #5 from dsavenko/master
Add settings to build for Mac
Permalink
Failed to load latest commit information.
examples completed simple client May 27, 2013
lib update package.json Jun 4, 2013
spec completed simple client May 27, 2013
src remove extra return statement Jul 27, 2013
.gitignore init May 19, 2013
LICENSE fix license Jun 17, 2013
README.md update README.md Jun 4, 2013
binding.gyp Add settings to build for Mac Mar 10, 2014
package.json fix license Jun 17, 2013

README.md

node-libtorrent

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://github.com/fanatid/node-libtorrent.git
$ cd node-libtorrent
$ npm install -g node-gyp
$ node-gyp configure
$ node-gyp build

Examples

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
main()

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