Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bmcmahen/itty-bitty-torrent

Deprecated -- use something else
https://github.com/bmcmahen/itty-bitty-torrent

Last synced: 18 days ago
JSON representation

Deprecated -- use something else

Awesome Lists containing this project

README

        

node-bittorent
==============

A simple bittorrent client extracted from the awesome [peerflix](https://github.com/mafintosh/peerflix), built for Node.

## Install

npm install itty-bitty-torrent

## Example

var Torrent = require('itty-bitty-torrent');
var downloadLocation = __dirname + '/download/';
var torrent = __dirname + '/IAmALegalTorrent.torrent'; // or http URL

var client = new Torrent(torrent, downloadLocation, function(err){
if (!err) client.download();

// Get speed
setInterval(function(){
console.log(Math.round(client.speed()) / 1000);
}, 500);

// Get percentage downloaded
setInterval(function(){
console.log(Math.round(client.percentage()));
}, 10000);
});

client.on('finished', function(){
// The torrent has finished downloading.
});

// stop our torrent downloading & seeding
client.stop();

## License

MIT