1.0.1-0 • Published 7 years ago

carriage-return v1.0.1-0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

carriage-return

npm npm GitHub issues

Small utility to make use of the carriage-return character, e.g. as a progress indicator.

Usage

Install and save the package to your project npm i --save carriage-return

const cr = require('carriage-return');

const delay = ms => new Promise(res => setTimeout(res, ms));
async function test () {

  // Prints out "I'm not gonna be visible"
  cr.print('I\'m not gonna be visible');

  await delay(1000);

  // Overrides "I'm not gonna be visible" and prints "You just got overridden" without a newline
  cr.print('You just got overridden');

  await delay(1000);

  // Just clears the line (without \n)
  cr.clear();

  await delay(1000);

  // Prints "That's it." with a newline
  cr.end('That\'s it.');
}
test();