1
1
const request = require ( 'request-promise-native' )
2
+ const pretty = require ( 'prettier-bytes' )
2
3
const chalk = require ( 'chalk' )
3
4
4
5
const { loadMetadata } = require ( '../lib/metadata' )
@@ -19,13 +20,14 @@ exports.handler = async function (argv) {
19
20
for ( let key of Object . keys ( rsp . body ) ) {
20
21
const { mnt, networking } = rsp . body [ key ]
21
22
console . log ( `${ chalk . green ( key ) } => ${ chalk . green ( mnt ) } ` )
22
- console . log ( ` Network Stats:` )
23
- console . log ( ` Metadata:` )
24
- console . log ( ` Uploaded: ${ networking . metadata . totals . uploadedBytes / 1e6 } MB` )
25
- console . log ( ` Downloaded: ${ networking . metadata . totals . downloadedBytes / 1e6 } MB` )
26
- console . log ( ` Content:` )
27
- console . log ( ` Uploaded: ${ networking . content . totals . uploadedBytes / 1e6 } MB` )
28
- console . log ( ` Downloaded: ${ networking . content . totals . downloadedBytes / 1e6 } MB` )
23
+ console . log ( chalk . yellow ( ` Metadata:` ) )
24
+ console . log ( ` Connected Peers: ${ networking . metadata . peers } ` )
25
+ console . log ( ` Uploaded: ${ pretty ( networking . metadata . totals . uploadedBytes ) } ` )
26
+ console . log ( ` Downloaded: ${ pretty ( networking . metadata . totals . downloadedBytes ) } ` )
27
+ console . log ( chalk . yellow ( ` Content:` ) )
28
+ console . log ( ` Connected Peers: ${ networking . content . peers } ` )
29
+ console . log ( ` Uploaded: ${ pretty ( networking . content . totals . uploadedBytes ) } ` )
30
+ console . log ( ` Downloaded: ${ pretty ( networking . content . totals . downloadedBytes ) } ` )
29
31
}
30
32
} else {
31
33
console . log ( chalk . orange ( 'Cannot get the deamon\'s mount list.' ) )
0 commit comments