Skip to content

A tiny, dependency-free CLI spinner for Node.js — perfect for showing progress during async tasks, installs, or API calls.

Notifications You must be signed in to change notification settings

dev-mas-ud/cli-spinner-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌀 cli-spinner-litex

npm version npm downloads license

A tiny, dependency-free CLI spinner for Node.js — perfect for showing progress during async tasks, installs, or API calls.


🚀 Installation

npm install cli-spinner-litex

🧠 Usage Example

Use cli-spinner-litex to display a simple, animated spinner during any asynchronous process.

import Spinner from "cli-spinner-litex";

const spin = new Spinner("Fetching data...");
spin.start();

setTimeout(() => {
  spin.updateText("Still working...");
}, 2000);

setTimeout(() => {
  spin.stop("Completed successfully!");
}, 4000);

When you run this script in your terminal, the spinner will animate as your code runs:

○ Fetching data...
○ Still working...
✔ Completed successfully!

That’s it — no dependencies, just a clean visual indicator for your CLI tasks.


⚙️ API Reference

new Spinner(text?, frames?)

Creates a new spinner instance.

Parameter Type Description
text string Message text shown beside the spinner
frames string[] Custom animation frames (optional)

.start([text])

Starts the spinner. Optionally updates the message.

.updateText(text)

Updates the displayed message while spinning.

.stop([message])

Stops the spinner and prints a success checkmark ().

.fail([message])

Stops the spinner and prints a failure cross ().

.setStyle(frames.pulse)

Switches the spinner style dynamically.


🎨 Spinner Styles

cli-spinner-litex includes a few built-in animation frame sets you can use:

import Spinner, { spinners } from "cli-spinner-litex";

const spin = new Spinner("Processing...", spinners.line);
spin.start();
setTimeout(() => spin.stop("Done!"), 2000);

Available presets:

export const spinners = {
  dots: ["⠋", "⠙", "⠸", "⠴", "⠦", "⠇"],
  line: ["-", "\\", "|", "/"],
  pulse: ["·", "●", "·", "○"],
};

🪶 Why cli-spinner-litex?

✅ Zero dependencies
✅ Works on macOS, Linux, and Windows
✅ Small (~55 lines of code)
✅ Customizable spinner frames
✅ Perfect for any CLI script or Node.js tool


📦 Example CLI Script

#!/usr/bin/env node
import Spinner from "cli-spinner-litex";

const spinner = new Spinner("Running heavy task...");
spinner.start();

setTimeout(() => {
  spinner.stop("Task completed!");
}, 3000);

Output:

○ Running heavy task...
✔ Task completed!

📄 License

MIT © 2025 Mohammed (DevMasud)


If you like this package

Give it a ⭐ on GitHub!

Connect

Follow me on X (Twitter) for updates and dev tips! 🚀

About

A tiny, dependency-free CLI spinner for Node.js — perfect for showing progress during async tasks, installs, or API calls.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published