From 2eebc531e91513981302aa560a1e1d79d39ca427 Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Thu, 14 Jul 2016 07:35:48 -0700 Subject: [PATCH] Sort the wires by speed so output looks less boring --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f2b646d..4386b2c 100755 --- a/app.js +++ b/app.js @@ -385,7 +385,9 @@ var ontorrent = function (torrent) { clivas.line('') linesremaining -= 9 - wires.every(function (wire) { + wires.sort(function (a,b) { + return b.downloadSpeed() - a.downloadSpeed() + }).every(function (wire) { var tags = [] if (wire.peerChoking) tags.push('choked') clivas.line('{25+magenta:' + wire.peerAddress + '} {10:' + bytes(wire.downloaded) + '} {10 + cyan:' + bytes(wire.downloadSpeed()) + '/s} {15 + grey:' + tags.join(', ') + '} ')