@zokugun/log-update-plus
v0.1.0
Published
Update the terminal line in place. Ideal for progress bars, animations, and live-updating status
Readme
@zokugun/log-update-plus
Update the terminal line in place. Ideal for progress bars, animations, and live-updating status.
Overview
@zokugun/log-update-plus is a TypeScript-first port and fork of log-update.
The unnecessary goal is to keep the compatibility with Node.js 18.x.
Installation
npm add @zokugun/log-update-plusUsage
import c from 'ansi-colors';
import cliSpinners from 'cli-spinners';
import { stdout } from '@zokugun/log-update-plus';
type IndicatorLoading = ReturnType<typeof setInterval>;
const { dots } = cliSpinners;
let $loading: IndicatorLoading | undefined;
export function log(message: string): void {
stdout.persist(`${c.cyan(c.symbols.bullet)} ${message}`);
}
export function progress(label: string): void {
clearInterval($loading);
let index = 0;
$loading = setInterval(() => {
stdout.render(`${c.cyan(dots.frames[index = ++index % dots.frames.length])} ${label}`);
}, dots.interval);
}Quick Reference
type Options = {
readonly showCursor?: boolean;
readonly defaultWidth?: number;
readonly defaultHeight?: number;
};
class LogUpdate {
constructor(stream: tty.WriteStream, { showCursor, defaultWidth, defaultHeight }?: Options);
clear(): void;
done(): void;
persist(...values: string[]): void;
render(...values: string[]): void;
}
const stdout: LogUpdate;
const stderr: LogUpdate;Donations
Support this project by becoming a financial contributor.
License
Copyright © 2026-present Baptiste Augrain
Licensed under the MIT license.
