You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

ora

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ora

Elegant terminal spinner

8.2.0
latest
Version published
Weekly downloads
37M
-2.58%
Maintainers
1
Weekly downloads
 
Created

What is ora?

The ora npm package is a terminal spinner for Node.js applications. It provides an easy way to display a spinner in the command line interface (CLI) during the execution of long-running tasks, giving users a visual cue that processing is taking place. It is highly customizable and can be used to enhance the user experience in CLI tools.

What are ora's main functionalities?

Basic spinner

This code sample demonstrates how to create a basic spinner that starts with a message, runs for a specified duration, and then marks the operation as successful.

const ora = require('ora');

const spinner = ora('Loading unicorns').start();

setTimeout(() => {
  spinner.succeed('Unicorns loaded');
}, 1000);

Customize spinner color, text, and spinner

This code sample shows how to customize the spinner's appearance by setting the color, text, and spinner design. It also demonstrates how to update these properties while the spinner is running.

const ora = require('ora');

const spinner = ora({
  text: 'Loading rainbows',
  color: 'magenta',
  spinner: 'moon'
}).start();

setTimeout(() => {
  spinner.color = 'yellow';
  spinner.text = 'Loading sun';
}, 1000);

Control spinner success and failure

This code sample illustrates how to control the spinner to indicate success or failure of an operation. In this case, the spinner is stopped with a failure message.

const ora = require('ora');

const spinner = ora('Loading with great anticipation').start();

setTimeout(() => {
  spinner.fail('Something went wrong');
}, 1000);

Other packages similar to ora

FAQs

Package last updated on 02 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts