Tiny Spinner

2.0.5 · active · verified Wed Apr 22

Tiny Spinner is a minimalist CLI spinner library designed to provide visual feedback for asynchronous operations in terminal applications. It aims for simplicity and a small footprint, differentiating itself from more feature-rich alternatives like `ora` by offering a streamlined API. The package is currently at version 2.0.5 and ships with TypeScript types, facilitating its use in modern JavaScript and TypeScript projects. While its release cadence appears measured, with the last update around early 2025, it remains an active project. Its core functionality focuses on starting, updating, and gracefully stopping a spinner with various status messages (success, warning, error).

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates starting, updating, and gracefully stopping the spinner with success, warning, or error messages based on simulated asynchronous operations.

import Spinner from 'tiny-spinner';

const spinner = new Spinner ();

async function performTask() {
  spinner.start('Doing something important...');

  try {
    await new Promise(resolve => setTimeout(resolve, 2000)); // Simulate async work
    spinner.update('Still processing data...');

    await new Promise(resolve => setTimeout(resolve, 1500)); // More work

    if (Math.random() > 0.8) {
      spinner.error('Task failed unexpectedly!');
      process.exit(1);
    } else if (Math.random() > 0.5) {
      spinner.warning('Task completed with minor issues.');
    } else {
      spinner.success('Task completed successfully!');
    }
  } catch (error) {
    spinner.error(`An unhandled error occurred: ${error.message}`);
    process.exit(1);
  }
}

performTask();

view raw JSON →