Log by overwriting the previous output in the terminal.
Useful for rendering progress bars, animations, etc.
import logUpdate from 'log-update'; const frames = ['-', '\\', '|', '/']; let index = 0; setInterval(() => { const frame = frames[index = ++index % frames.length]; logUpdate( ` ♥♥ ${frame} unicorns ${frame} ♥♥ ` ); }, 80);
You can use yoctocolors or chalk to colorize the output.
Log to stdout.
Clear the logged output.
Persist the logged output.
Useful if you want to start a new log session below the current one.
Log to stderr.
createLogUpdate(stream, options?)Get a logUpdate
method that logs to the specified stream.
Type: object
Type: boolean
Default: false
Show the cursor. This can be useful when a CLI accepts input from a user.
import {createLogUpdate} from 'log-update'; // Write output but don't hide the cursor const log = createLogUpdate(process.stdout, { showCursor: true });
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4