0.2.0 • Published 2 years ago

stdout-line v0.2.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

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