Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-08-22 15:46:16 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-08-22 15:46:16 +0300
commit958f30a0341ca323c7cef794b00fe38eed845297 (patch)
treee8a0248aa350c7d3638365b771f0975027c8ae21 /bin
parent89645ebe81cf46d61e4d7be423cb8c7a32283b2b (diff)
BREAKING: Use abstract-chunk-store for storage
Part of an effort to share more code with `torrent-stream` by @mafintosh: https://github.com/mafintosh/torrent-stream/pull/133 https://github.com/mafintosh/torrent-stream/pull/132 Storage is now based on: https://www.npmjs.com/package/fs-chunk-store (in node) https://www.npmjs.com/package/memory-chunk-store (in the browser) and: https://www.npmjs.com/package/immediate-chunk-store https://www.npmjs.com/package/torrent-piece This is a BREAKING change, since users who pass in custom storage engine with `opts.storage` will need to update their storage backend to be `abstract-chunk-store` compliant: https://www.npmjs.com/package/abstract-chunk-store There are also likely other miscellaneous BREAKING API changes, since this was a huge refactor of the codebase.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js34
1 files changed, 14 insertions, 20 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 5cc5b96..2ca529d 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -12,7 +12,6 @@ var networkAddress = require('network-address')
var parseTorrent = require('parse-torrent')
var path = require('path')
var prettyBytes = require('pretty-bytes')
-var Storage = require('../lib/storage')
var WebTorrent = require('../')
var zeroFill = require('zero-fill')
@@ -511,7 +510,7 @@ function drawTorrent (torrent) {
linesRemaining -= 1
}
- var seeding = torrent.storage.done
+ var seeding = torrent.done
if (!seeding) clivas.line('')
clivas.line(
@@ -540,34 +539,29 @@ function drawTorrent (torrent) {
linesRemaining -= 5
if (argv.verbose) {
- var pieces = torrent.storage.pieces
- var memoryUsage = 0
+ var pieces = torrent.pieces
for (var i = 0; i < pieces.length; i++) {
var piece = pieces[i]
- if (piece.buffer) memoryUsage += piece.buffer.length
if (piece.verified || (piece.blocksWritten === 0 && !piece.blocks[0])) continue
var bar = ''
for (var j = 0; j < piece.blocks.length; j++) {
- switch (piece.blocks[j]) {
- case Storage.BLOCK_BLANK:
- bar += '{red:█}'
- break
- case Storage.BLOCK_RESERVED:
- bar += '{blue:█}'
- break
- case Storage.BLOCK_WRITTEN:
- bar += '{green:█}'
- break
- }
+ // switch (piece.blocks[j]) {
+ // case Storage.BLOCK_BLANK:
+ // bar += '{red:█}'
+ // break
+ // case Storage.BLOCK_RESERVED:
+ // bar += '{blue:█}'
+ // break
+ // case Storage.BLOCK_WRITTEN:
+ // bar += '{green:█}'
+ // break
+ // }
}
clivas.line('{4+cyan:' + i + '} ' + bar)
linesRemaining -= 1
}
- clivas.line(
- '{red:memory usage:} {bold:' + prettyBytes(memoryUsage) + '}'
- )
clivas.line('{80:}')
- linesRemaining -= 2
+ linesRemaining -= 1
}
torrent.swarm.wires.every(function (wire) {