1.0.2 • Published 2 years ago
spins v1.0.2
spins
use spinners on the terminal
features
- succeed spinner
- fail spinner
- apply color to spinner
- stop and persist
- update text
- show warning
- show info
install
npm install spins
# or
yarn add spins
usage
- the spins supports all the spinners on the cli-spinners
- you can also add your own spinner
creating a spinner is as simple
using the default spinners
const spins = require("spins");
const ani = new spins({
color: "blue",
spinner: "point",
stream: process.stdout
});
- using your own spinner
const spins = require("spins");
const ani = new spins({
color: "blue",
spinner: {
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
interval: 80
},
stream: process.stdout
});
- starting the spinner
ani.start();
- stopping the spinner
ani.stop();
- stopping and persisting the spinner
ani.stopAndPersist();
- updating the text
ani.setText("new text");
- updating the spinner
ani.setSpinner("dots");
- updating the color
ani.setColor("red");
- suceed spinner
ani.success("Some", "text");
- fail spinner
ani.fail("Some", "text");
- info spinner
ani.info("Some", "text");
- warn spinner
ani.warn("Some", "text");
- resume the spinner
ani.resume();
- writing logs to the spinner
ani.log("Some", "text");