vlad 6f123ff03e 18.07 6 лет назад
..
node_modules 6f123ff03e 18.07 6 лет назад
index.js 6f123ff03e 18.07 6 лет назад
license 6f123ff03e 18.07 6 лет назад
package.json 6f123ff03e 18.07 6 лет назад
readme.md 6f123ff03e 18.07 6 лет назад

readme.md

log-update Build Status

Log by overwriting the previous output in the terminal.
Useful for rendering progress bars, animations, etc.

Install

$ npm install --save log-update

Usage

var logUpdate = require('log-update');

var i = 0;
var frames = ['-', '\\', '|', '/'];

setInterval(function () {
	var frame = frames[i++ % frames.length];
	logUpdate('\n' + '        ♥♥\n   ' + frame + ' unicorns ' + frame + '\n        ♥♥');
}, 100);

API

logUpdate(text, ...)

Log to stdout.

logUpdate.clear()

Clear the logged output.

logUpdate.done()

Persist the logged output.
Useful if you want to start a new log session below the current one.

logUpdate.stderr(text, ...)

Log to stderr.

logUpdate.stderr.clear()

logUpdate.stderr.done()

logUpdate.create(stream)

Get a logUpdate method that logs to the specified stream.

Examples

  • speed-test - Uses this module to render a spinner

License

MIT © Sindre Sorhus