Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pause/resume, refactored code, improved command line interface, etc #514

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

got download /path/to/file cmd.js test to pass

  • Loading branch information
whitef0x0 committed Dec 1, 2015
commit be0b7182da7862cfe06d76a8a0c1d3b8dc970348
@@ -460,7 +460,7 @@ function runDownload (torrentId) {
})
}

process.stdin.setRawMode(true)
//process.stdin.setRawMode(true)
process.stdin.resume()
drawTorrent(torrent)
}

This file was deleted.

@@ -66,7 +66,7 @@ function Torrent (torrentId, opts) {
self.path = opts.path
self._store = opts.store || FSChunkStore

self.disableSeeding = opts.disableSeeding || true
self.disableSeeding = opts.disableSeeding || false

self.strategy = opts.strategy || 'sequential'

@@ -134,20 +134,6 @@ Object.defineProperty(Torrent.prototype, 'uploaded', {
get: function () { return this.swarm ? this.swarm.uploaded : 0 }
})

/**
* The number of missing pieces. Used to implement 'end game' mode.
*/
// Object.defineProperty(Storage.prototype, 'numMissing', {
// get: function () {
// var self = this
// var numMissing = self.pieces.length
// for (var index = 0, len = self.pieces.length; index < len; index++) {
// numMissing -= self.bitfield.get(index)
// }
// return numMissing
// }
// })

// Percentage complete, represented as a number between 0 and 1
Object.defineProperty(Torrent.prototype, 'progress', {
get: function () { return this.length ? this.downloaded / this.length : 0 }
@@ -102,7 +102,8 @@ test('Command line: webtorrent create /path/to/file', function (t) {
test('Command line: webtorrent download /path/to/file --port 80', function (t) {
t.plan(2)

cp.exec(CMD + ' --port 80 --out content download torrents/leaves.torrent', function (err, data) {
var leavesPath = path.resolve(__dirname, 'torrents', 'leaves.torrent')
cp.exec(CMD + ' --port 80 --out content download '+leavesPath, {maxBuffer: 1024 * 500}, function (err, data) {
t.error(err)
t.ok(data.indexOf('successfully') !== -1)
})
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.