1.0.6 • Published 9 years ago
console-visualizer v1.0.6
The visualizer for the Node.js console
Installation
NPM
npm install console-visualizer --save
Usage
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
Object
optsObject
progress - Progress barInteger
max_chars - The maximum characters length in the console. default:80
Boolean|Char
arrow - default:false
Object
textBoolean
draw - default:true
Boolean
floor - default:true
Object
bracesBoolean|Char
open - default:"["
Boolean|Char
close - default:"]"
Object
scaleChar
fill - default:"="
Boolean|Char
half - default:"-"
Char
empty - default:" "
clear()
Clear console
getProgress(min, cur, max)
Generate progress bar like this
[========== ] 50%
Integer
min - start of rangeInteger
cur - current valueInteger
max - end of rangereturn
String
- progress bar
drawProgress(min, cur, max)
Draw progress bar in console. Based on the method Visualizer#getProgress
Integer
min - start of rangeInteger
cur - current valueInteger
max - 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
gulp
or
gulp build
Build gulpfile
coffee -c gulpfile.coffee
Roadmap
- Add more visual progress bars. Like this
###
________
`.______,'
(______)
< >
) (
/`----.\
/ \
/ _ _ \
:,' `-.' `.' :
| * O * |
: o o ;
\ . * . /
`.______.'
###
Changelog
1.0.0 Stable
Add
- first realise