Skip to content
Deprecated -- use something else
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.md
index.js
package.json
piece.js
storage.js

README.md

node-bittorent

A simple bittorrent client extracted from the awesome 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

Something went wrong with that request. Please try again.