Skip to content
プロジェクト

codekirei/node-multispinner

GitHubで見る

概要

Multiple, simultaneous, individually controllable spinners for concurrent tasks in Node.js CLI programs

開発ツール

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
履歴を収集中
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

node-multispinner

Build Status Coverage Status

About | Installation | API | Examples | Attribution | License

About

node-multispinner is a Node.js module for managing multiple progress indicators (spinners) in CLI apps. This module is especially useful for apps that benefit from simultaneous async task execution (e.g. with Promise.all[]), as it enables live updating individual spinners, in any order, while other spinners continue spinning. Node.js 4.0 or newer is required.

demo-gif

Installation

Install and require as a standard Node module.

Install

  $ npm install --save multispinner

Require

  var Multispinner = require('multispinner')

API

Full documentation available here.

Examples

The examples discussed below can be found here. Run them in a terminal with node:

$ node <example>

Example: events.js

Creates four spinners from an array, then completes them in succession with staggered setTimeout functions. Responds to the success and err completion events.

Example: customAnimation.js

Creates a custom spinner animation with the frames option.

Example: randomInfiniteLoop.js

Creates three to seven spinners with random lorem text and completes them randomly in less than five seconds in an infinite loop. Stubs out the logUpdate.done() function to overwrite the previous output with every loop.

It's kind of mesmerising.

Example: cli-with-promises

A CLI application that reads URLs and parses HTML into text to display in a terminal. Uses meow for CLI support, html-to-text for parsing, and axios for Promise-based HTTP requests. Creates spinners for each URL, and uses Promise.all() to execute the GET requests in parallel.

There are certainly edge cases that this example doesn't account for; it is not meant to be a "real" application. Despite that, the code should be illustrative of how node-multispinner could potentially be used in a real application.

This example is unique in that it requires modules not used in node-multispinner. Before running it, cd into its directory and install the additional requirements from its package.json with npm install.

Attribution

Thanks to sindresorhus for his log-update module, which was a major inspiration for and is used extensively in this module. Log-update is MIT licensed.

License

MIT

関連プロジェクトを探す

読み込み中…