Skip to content
This library is in beta and under active development. Please report any issues or suggestions on GitHub.

Install ascii-progress-bar

The easiest way to start using ascii-progress-bar is through your preferred package manager. The library supports Node.js environments and can be integrated into any JavaScript or TypeScript project.

Prerequisites

  • Node.js - v14.0.0 or higher
  • Package Manager - npm, yarn, or pnpm

Quick Install

Choose your preferred package manager to install ascii-progress-bar:

Terminal window
# create a new project with npm
npm install @yacosta738/ascii-progress-bar

Manual Setup

If you’re starting from scratch, follow these steps:

  1. Create a new directory for your project:
    Terminal window
    mkdir my-progress-project
    cd my-progress-project
  2. Initialize your project:
    Terminal window
    npm init -y
  3. Install ascii-progress-bar:
    Terminal window
    npm install @yacosta738/ascii-progress-bar

Basic Usage

After installation, you can import and use the library in your project:

import { AsciiProgressRenderer } from '@yacosta738/ascii-progress-bar';
// Helper function to simulate delay
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
// Static demo
console.log('\nStatic demonstrations:');
console.log('Default: ', AsciiProgressRenderer.render(75, 'default'));
console.log('Dots: ', AsciiProgressRenderer.render(60, 'dots'));
console.log('Stars: ', AsciiProgressRenderer.render(40, 'stars'));
console.log('Braille: ', AsciiProgressRenderer.render(80, 'braille'));
console.log('Minimal: ', AsciiProgressRenderer.render(50, 'minimal'));
console.log('Blocks: ', AsciiProgressRenderer.render(65, 'blocks'));
// Animated demo
async function animateProgress() {
console.log('\nAnimated demo:');
for (let i = 0; i <= 100; i += 5) {
// Clear previous line
process.stdout.clearLine();
process.stdout.cursorTo(0);
// Render the bar
process.stdout.write(AsciiProgressRenderer.render(i, 'blocks'));
await sleep(200);
}
console.log('\n');
}
// Run animated demo
animateProgress();

Next Steps

Now that you have ascii-progress-bar installed, you can:

  1. Try our examples to see different use cases

Troubleshooting

If you encounter any issues during installation, make sure:

  • Your Node.js version is compatible
  • You have proper write permissions in your project directory
  • Your package manager is up to date