npm.io
0.2.0 • Published 4 years ago

stdout-line

Licence
Version
0.2.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
1

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.
  • 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 to
  • opts.width [number=stream.columns|80] Width
  • opts.join [string= ] Join [...message] array with
  • opts.throttle [number] Throttle logging (ms)
  • opts.format [function] Format message before writing to stream

Keywords