constbarChart=require('bar-charts');console.log(barChart([{label: 'smiles per day',count: 143},{label: 'laughs',count: 340},{label: 'high fives',count: 26}]));
output
smiles per day | ███████████████████ | 143
laughs | ██████████████████████████████████████████████ | 340
high fives | ████ | 26
Progress bar
constbarChart=require('bar-charts');constsequentialPromiseAll=require('sequential-promise-all');consttimeout=ms=>newPromise(res=>setTimeout(()=>res(ms),ms));(async()=>{constarr=Array.from(Array(100),(d,i)=>i);// fill array with n values 0..100awaitsequentialPromiseAll(timeout,[10],arr.length,(_args,_previousResponse,i)=>{process.stdout.clearLine();process.stdout.cursorTo(0);constcount=(i+1) / arr.length * 100;constoutput=barChart([{label: `${i+1}/${arr.length}`, count}],{percentages: true});process.stdout.write(output);// end the line});})();