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:
authorSindre Sorhus <sindresorhus@gmail.com>2014-12-05 13:06:06 +0300
committerSindre Sorhus <sindresorhus@gmail.com>2014-12-05 13:06:06 +0300
commit429121d475d186881a78a42c4d41b78420bf0f8a (patch)
tree468d1685ebf2360525782c66724ade7927812c25 /bin
parent956b57e19c9b8e36637a7ee117feeb67af50976d (diff)
use base-10 file sizes
It's more natural for users. It's the unit used in OS X and most torrent apps like Transmission.app. http://pacoup.com/2009/05/26/kb-kb-kib-whats-up-with-that/
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index f4ea29b..5a1c235 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -7,7 +7,7 @@ var minimist = require('minimist')
var moment = require('moment')
var networkAddress = require('network-address')
var path = require('path')
-var prettysize = require('prettysize')
+var prettyBytes = require('pretty-bytes')
var WebTorrent = require('../')
process.title = 'WebTorrent'
@@ -200,7 +200,7 @@ function onReady () {
if (argv.list) {
torrent.files.forEach(function (file, i) {
- clivas.line('{3+bold:'+i+'} : {magenta:'+file.name+'} {blue:('+bytes(file.length)+')}')
+ clivas.line('{3+bold:'+i+'} : {magenta:'+file.name+'} {blue:('+prettyBytes(file.length)+')}')
})
return done()
}
@@ -356,10 +356,10 @@ function onReady () {
clivas.line('')
clivas.line('{green:downloading:} {bold:' + filename + '}')
clivas.line(
- '{green:speed: }{bold:' + bytes(speed) + '/s} ' +
- '{green:downloaded:} {bold:' + bytes(swarm.downloaded) + '}' +
- '/{bold:' + bytes(torrent.length) + '} ' +
- '{green:uploaded:} {bold:' + bytes(swarm.uploaded) + '} ' +
+ '{green:speed: }{bold:' + prettyBytes(speed) + '/s} ' +
+ '{green:downloaded:} {bold:' + prettyBytes(swarm.downloaded) + '}' +
+ '/{bold:' + prettyBytes(torrent.length) + '} ' +
+ '{green:uploaded:} {bold:' + prettyBytes(swarm.uploaded) + '} ' +
'{green:peers:} {bold:' + unchoked.length + '/' + wires.length + '} ' +
'{green:hotswaps:} {bold:' + hotswaps + '}'
)
@@ -407,9 +407,9 @@ function onReady () {
})
clivas.line(
'{3:' + progress + '} ' +
- '{25+magenta:' + wire.remoteAddress + '} {10:'+bytes(wire.downloaded)+'} ' +
- '{10+cyan:' + bytes(wire.downloadSpeed()) + '/s} ' +
- '{10+red:' + bytes(wire.uploadSpeed()) + '/s} ' +
+ '{25+magenta:' + wire.remoteAddress + '} {10:'+prettyBytes(wire.downloaded)+'} ' +
+ '{10+cyan:' + prettyBytes(wire.downloadSpeed()) + '/s} ' +
+ '{10+red:' + prettyBytes(wire.uploadSpeed()) + '/s} ' +
'{15+grey:' + tags.join(', ') + '}' +
'{15+cyan:' + reqStats.join(' ') + '}'
)
@@ -427,7 +427,3 @@ function onReady () {
clivas.flush(true)
}
}
-
-function bytes (num) {
- return prettysize(num)
-}