stdout-line
v0.2.0
Published
Log by overwriting previous output
Downloads
4
Readme
stdout-line
Yet another function to log by overwriting previous output.
Differences:
- Single line enforced
- Trims or pads the line to fit the stdout width.
- This ensures the next log (by other methods:
console.log
) automatically prints to (apparently) next line since the previous line had been fully padded.
- This ensures the next log (by other methods:
- Small, no dependencies
Install
npm install stdout-line
Usage
import line from 'stdout-line'
line('this will get replaced by')
line('next line')
line.persist('unless persisted')
API
import { create } from 'stdout-line'
create(opts)
opts.stream
[=process.stdout]
Stream to write toopts.width
[number=stream.columns|80]
Widthopts.join
[string= ]
Join [...message] array withopts.throttle
[number]
Throttle logging (ms)opts.format
[function]
Format message before writing tostream