API Reference

Ora

Elegant terminal spinners for CLI tools in Node.js with success and failure transitions and non-TTY fallbacks.

Official Documentation ↗
CompatibilityThis documentation covers version v10.0.0. Check the official docs for the latest API surface.

Installation

npmnpm install ora
pnpmpnpm add ora

Methods

Elegant terminal spinners for CLI tools in Node.js with success and failure transitions and non-TTY fallbacks.

Overview

Ora renders terminal spinners with a tiny API: create with text, start, then finish through succeed, fail, warn, or info so each step leaves a readable final line. The live label updates through text for progress narration.

It handles the annoying details: frame rate and Unicode fallbacks, color restoration, hiding the cursor, and behaving sanely in pipes and CI where animation is impossible. Multiple spinners can be kept and sequenced for multi-stage CLI flows.

Core Methods

The most frequently used entry points, with signatures and runnable examples:

  • ora — Creates a spinner instance; the name selects the frame set, for example dots, dots2, or arc.
  • start / stop — Begins animation, optionally updating the label, and stop clears the spinner line without a status icon.
  • succeed / fail / warn / info — Ends the spinner with a colored symbol, checkmark, cross, warning, or info, keeping the final line visible.
  • text / prefixText — Mutating these properties updates the live spinner line mid-run for progress reporting.

Usage Notes

  • Check process.stdout.isTTY in long pipelines and set isEnabled accordingly when you need silent mode explicitly.
  • Prefer stopAndPersist for intermediate steps you want visible in logs after the run.
  • Keep spinner text short and put detail in follow-up lines after the final status.

Common Pitfalls

  • Leaving a spinner running on an exception path leaves the terminal in a broken state; wrap work in try/finally with stop or fail.
  • console.log during an active spinner scrambles output; persist or stop first.
  • Frames come from Unicode; terminals with narrow fonts may misalign, so test your chosen spinner on your lowest-common terminal.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/ora@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:23.777Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/ora@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:23.777Z.

FAQ

What happens in CI or non-interactive terminals?
When stdout is not a TTY, isEnabled is false and ora degrades: start and stop become quiet, while succeed and fail still print their final lines so logs keep a readable outcome.
How do I log without breaking the spinner line?
Use spinner.stopAndPersist({ text, prefixText }) or console.log when paused; raw console.log while animating interleaves with frames. Alternatively run quiet logging into a file and surface a summary at the end.
Can I show a stream of progress instead of frames?
Pair ora with a progress bar library or update spinner.text with computed percentages on each chunk; ora renders whatever string you provide, including template-built progress descriptions.