progress control

node-progress wrapper to control bar from keyboard

7
1
JavaScript

progress-control

Build Status

node-progress wrapper to control bar from keyboard

Install

$ npm install progress-control --save

Usage

var value = 0.5;

var bar = require('progress-control')('Use up/down arrows [:bar]', { total: 10 }, {
  'up': function() {
    value = Math.min(Math.round((value + 0.1) * 10) / 10, 1);
    bar.update(value);
  },
  'down': function() {
    value = Math.max(Math.round((value - 0.1) * 10) / 10, 0);
    bar.update(value);
  },
  'ctrl-v': function() {
    value = 1.0;
    bar.update(value);
  }
});

bar.update(value);

setTimeout(function() {
  bar.close();
}, ms);

License

MIT © ewnd9