Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

terminal-overwrite

mr526.4kMIT2.0.1

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

log, logger, logging, cli, terminal, term, console, shell, update, refresh, overwrite, output, stdout, progress, bar, animation

readme

terminal-overwrite

Build Status

Log by overwriting the previous output in the terminal.
Useful for rendering progress bars, animations, etc.
Forked from log-update

Install

$ npm install --save terminal-overwrite

Usage

const terminalOverwrite = require('terminal-overwrite');
const frames = ['-', '\\', '|', '/'];
let i = 0;

setInterval(() => {
    const frame = frames[i = ++i % frames.length];

    terminalOverwrite(
`
        ♥♥
   ${frame} unicorns ${frame}
        ♥♥
`
    );
}, 80);

API

terminalOverwrite(text, ...)

Log to stdout.

terminalOverwrite.clear()

Clear the logged output.

terminalOverwrite.done()

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

terminalOverwrite.stderr(text, ...)

Log to stderr.

terminalOverwrite.stderr.clear()

terminalOverwrite.stderr.done()

terminalOverwrite.create(stream)

Get a terminalOverwrite method that logs to the specified stream.

License