libtorrent

0.0.3 • Public • Published

node-libtorrent-ng

node-libtorrent-ng is a fork of node-libtorrent and provides native bindings to libtorrent rastebar as a Node.js addon.

Getting started

Execute in command line:

$ npm install git+https://github.com/ngorchilov/node-libtorrent-ng.git

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"
 
= new lt.session()
s.listen_on([68816889])
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 main2500
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"."
= lt.bencode ct.generate()
console.log t

Readme

Keywords

none

Package Sidebar

Install

npm i libtorrent

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • ngorchilov