nodejs 显示进度条插件

progress

var ProgressBar = require("progress");

var bar = new ProgressBar("[ :bar ]", { total: 10 });
var timer = setInterval(function() {
  bar.tick();
  if (bar.complete) {
    console.log("\ncomplete\n");
    clearInterval(timer);
  }
}, 100);
λ node test.js
[ ========== ]

complete

ora

const ora = require("ora");

const spinners = [ora("Loading..."), ora("Loading...")];
spinners[0].start();

setTimeout(() => {
  spinners[0].succeed("Sucess ");
  spinners[1].start();
}, 5000);

setTimeout(() => {
  spinners[1].fail("Fail ");
}, 5000);
λ node test.js
√ Sucess
× Fail
posted @ 2020-02-08 21:12  Ajanuw  阅读(3523)  评论(0编辑  收藏  举报