Skip to content

zokugun/node-log-update-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

MIT licensed NPM Version Donation Donation Donation

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-plus

Usage

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.

Ko-fi ko-fi.com/daiyam
Liberapay liberapay.com/daiyam/donate
PayPal paypal.me/daiyam99

License

Copyright © 2026-present Baptiste Augrain

Licensed under the MIT license.

About

Update the terminal line in place. Ideal for progress bars, animations, and live-updating status

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors