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

use base-10 file sizes #199

Merged
merged 1 commit into from Dec 5, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

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/
  • Loading branch information
sindresorhus committed Dec 5, 2014
commit 429121d475d186881a78a42c4d41b78420bf0f8a
@@ -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)
}
@@ -51,7 +51,7 @@
"network-address": "0.0.5",
"once": "^1.3.1",
"parse-torrent": "^2.1.0",
"prettysize": "0.0.3",
"pretty-bytes": "^1.0.1",
"pump": "^1.0.0",
"random-access-file": "^0.3.1",
"range-parser": "^1.0.2",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.