@open-tech-world/node-cli-progress

CLI spinner with task progress result.

Usage no npm install needed!

<script type="module">
  import openTechWorldNodeCliProgress from 'https://cdn.skypack.dev/@open-tech-world/node-cli-progress';
</script>

README

@open-tech-world/node-cli-progress

Build CodeFactor npm (scoped)

CLI spinner with task progress result.

Installation

Using npm

npm install @open-tech-world/node-cli-progress

Using Yarn

yarn add @open-tech-world/node-cli-progress

Usage

import { cliProgress } from '@open-tech-world/node-cli-progress';

const progress = new cliProgress();
progress.start();
setTimeout(() => {
  progress.update('Downloading');
}, 1000);
progress.done('Download completed!');

API

new cliProgress(options?: Partial<IOptions>)

It creates a new instance of the cliProgress.

options:

Name Type Default Description
stream NodeJS.WriteStream process.stderr The stream to use.

Instance methods:

start(text?: string)

This method starts the spinner with optional text.

The default text is Loading.

update(text: string)

This method updates the current text with the given text.

done(text?: string)

This method stops the spinner and mark the task as success with optional text.

fail(text?: string)

This method stops the spinner and mark the task as failed with optional text.

warn(text?: string)

This method stops the spinner and mark the task as warning with optional text.

info(text?: string)

This method stops the spinner and mark the task as info with optional text.

License

Copyright (c) 2021, Thanga Ganapathy (MIT License).