Spinify
Spinify is a simple and customizable terminal spinner library for Node.js.
Structure
└── app.js
└── core.js
└── CustomSpinify.js
└── index.js
└── LICENSE
└── package-lock.json
└── package.json
└── README.md
Installation
You can install Spinify using npm:
bash npm install spinify
Usage
-
Import the CustomSpinner class in your Node.js project:
const { CustomSpinner } = require("spinify");
-
Create a new spinner instance, providing the desired style and text:
const Spinify = new CustomSpinner("dots", "Loading...");
You can choose from various spinner styles such as 'dots', 'arrows', 'lines', etc.
- Start the spinner:
Spinify.start();
- Simulate a time-consuming task. For example, use setTimeout:
setTimeout(() => {
Spinify.stop();
}, 5000);
Adjust the duration as needed.
Spinify Styles
Spinify supports various spinner styles. You can customize the spinner style by providing the desired style when creating the CustomSpinner instance.
const Spinify = new CustomSpinner("arrow", "Processing...");
Available spinner styles include 'dots', 'arrow', 'line', 'step', and more.
Example
Here's a simple example of using Spinify to display a spinner while simulating a time-consuming task:
const { CustomSpinner } = require("spinify");
const Snipify = new CustomSpinner("dots", "Loading...");
Snipify.start();
// Simulate a time-consuming task
setTimeout(() => {
Snipify.stop();
}, 5000);
Feel free to explore different spinner styles and integrate Spinify into your projects for a delightful terminal experience.
Spinify Themes
export const spinify = {
spinify: {
frames: ["-/", "/-", "/", "---", "---", "-/"],
interval: 80,
},
spet: {
frames: ["<", ">", "<", ">", "*", "<", ">"],
interval: 100,
},
dots: {
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
interval: 80,
},
lines: {
frames: ["-", "\\", "|", "/"],
interval: 100,
},
arrows: {
frames: ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"],
interval: 120,
},
custom: {
frames: ["⊙", "⋆", "✸", "❉", "✦", "✿", "❀"],
interval: 100,
},
asterisk: {
frames: ["***", "**", "***", "**", "***", "**"],
interval: 120,
},
};
- Select your spinify theme favorite
License
This project is licensed under the MIT License - see the LICENSE file for details.
Enjoy spinning your tasks with Spinify! If you encounter any issues or have suggestions, feel free to contribute or report a bug.