API/api.medcify.app/node_modules/charm/example/progress.js
2022-09-26 11:41:44 +05:30

19 lines
339 B
JavaScript

var charm = require('../')();
charm.pipe(process.stdout);
charm.write('Progress: 0 %');
var i = 0;
var iv = setInterval(function () {
charm.left(i.toString().length + 2);
i ++;
charm.write(i + ' %');
if (i === 100) {
charm.end('\nDone!\n');
clearInterval(iv);
}
}, 25);
charm.on('^C',process.exit);