1.0.6 • Published 10 years ago
console-visualizer v1.0.6
The visualizer for the Node.js console

Installation
NPM
npm install console-visualizer --saveUsage

var Visualizer = require('console-visualizer');
var visual = new Visualizer({
progress: {
scale: {
fill: "|",
half: false
}
}
});
var loadMin = 0;
var loadCur = 0;
var loadMax = 100;
loadInterval = setInterval(function() {
if (loadCur <= loadMax) {
visual.clear(); // Clear console
visual.drawProgress(loadMin, loadCur, loadMax); // Draw progress bar
loadCur++;
} else {
clearInterval(loadInterval);
}
}, 100);
/* Output:
[|||||||||| ] 50%
*/Methods
constructor(opts)
Object constructor
ObjectoptsObjectprogress - Progress barIntegermax_chars - The maximum characters length in the console. default:80Boolean|Chararrow - default:falseObjecttextBooleandraw - default:trueBooleanfloor - default:true
ObjectbracesBoolean|Charopen - default:"["Boolean|Charclose - default:"]"
ObjectscaleCharfill - default:"="Boolean|Charhalf - default:"-"Charempty - default:" "
clear()
Clear console
getProgress(min, cur, max)
Generate progress bar like this
[========== ] 50%Integermin - start of rangeIntegercur - current valueIntegermax - end of rangereturn
String- progress bar
drawProgress(min, cur, max)
Draw progress bar in console. Based on the method Visualizer#getProgress
Integermin - start of rangeIntegercur - current valueIntegermax - end of range
Build form coffee source
Build project
The source code in the folder development. They should be compiled in the bin folder
# With watching
gulpor
gulp buildBuild gulpfile
coffee -c gulpfile.coffeeRoadmap
- Add more visual progress bars. Like this
###
________
`.______,'
(______)
< >
) (
/`----.\
/ \
/ _ _ \
:,' `-.' `.' :
| * O * |
: o o ;
\ . * . /
`.______.'
###Changelog
1.0.0 Stable
Add- first realise