-
Notifications
You must be signed in to change notification settings - Fork 1
/
ddrescueview
executable file
·29 lines (22 loc) · 1.01 KB
/
ddrescueview
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/nodejs
var commandWrapper = require('./commandWrapper');
var filesize = require('file-size');
var viewBuilder = require('./viewBuilder');
var rows = process.argv[5] || Math.floor(process.stdout.rows/2);
var granules = rows * process.stdout.columns;
commandWrapper.command(function(log) {
var logEntries = log.entries;
var totalSize = log.totalSize;
var sizeBreakdown = viewBuilder.sizeSummary(log);
var min = process.argv[3] ? process.argv[3] * 1024 * 1024 * 1024 : 0;
var max = process.argv[4] ? process.argv[4] * 1024 * 1024 * 1024 : totalSize;
var logString = viewBuilder.linearVisual(log, granules, min, max);
var step = (max - min)/granules;
console.log("granule size:\t" + filesize(step).human());
console.log("row size:\t" + filesize(step * process.stdout.columns).human());
console.log(viewBuilder.legendLine(step));
for (var flag in sizeBreakdown) {
console.log(flag + ": " + filesize(sizeBreakdown[flag]).human());
}
console.log(logString);
});