JSPM

logpct

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q50001F
  • License MIT

A percent status logger for Node.js

Package Exports

  • logpct

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logpct) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

logpct

A percent status logger for Node.js.

Installation

npm i logpct -S

Usage

const logpct = require("logpct");

const length = 1e6;
Array.from({ length }).forEach((d, i) => {
  
  const pct = (i + 1) / length * 100;

  logpct(
    pct, // The percentage to log (required; should be a number between 0 and 100)
    20, // The width of the status bar (optional; defaults to 20 characters)
    `\t${pct.toFixed(1)}%` // The message to display next to the status bar (optional; defaults to what you see here)
  );

});