
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
log-update
Advanced tools
Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.
Log by overwriting the previous output in the terminal.
Useful for rendering progress bars, animations, etc.

It performs partial redraws when possible to reduce flicker.
npm install log-update
import logUpdate from 'log-update';
const frames = ['-', '\\', '|', '/'];
let index = 0;
setInterval(() => {
const frame = frames[index = ++index % frames.length];
logUpdate(
`
♥♥
${frame} unicorns ${frame}
♥♥
`
);
}, 80);
You can use yoctocolors or chalk to colorize the output.
Log to stdout.
Clear the logged output.
Persist the logged output.
Useful if you want to start a new log session below the current one.
Write text to the terminal that persists, similar to console.log().
Unlike the main logUpdate() method which updates in place, persist() writes to the terminal in a way that preserves the output in the scrollback history.
import logUpdate from 'log-update';
// Update in place
logUpdate('Processing...');
logUpdate('Still processing...');
// Write permanent output
logUpdate.persist('âś“ Task complete');
// Continue updating
logUpdate('Next task...');
Log to stderr.
Get a logUpdate method that logs to the specified stream.
Type: object
Type: boolean
Default: false
Show the cursor. This can be useful when a CLI accepts input from a user.
import {createLogUpdate} from 'log-update';
// Write output but don't hide the cursor
const log = createLogUpdate(process.stdout, {
showCursor: true
});
Type: number
Default: 80
The width to use when the stream doesn't provide a columns property.
This is useful when the output is piped, redirected, or in environments where the terminal size is not available.
import {createLogUpdate} from 'log-update';
// Use custom width when the stream doesn't provide columns
const log = createLogUpdate(process.stdout, {
defaultWidth: 120
});
Type: number
Default: 24
The height to use when the stream doesn't provide a rows property.
This is useful when the output is piped, redirected, or in environments where the terminal size is not available.
import {createLogUpdate} from 'log-update';
// Use custom height when the stream doesn't provide rows
const log = createLogUpdate(process.stdout, {
defaultHeight: 50
});
Ora is a terminal spinner library that provides a variety of spinner styles and allows for easy integration of spinners into your terminal applications. Unlike log-update, which focuses on updating log output, ora is specifically designed for creating and managing spinners.
cli-progress is a versatile progress bar library for the terminal. It supports multiple progress bars, custom bar styles, and various configuration options. While log-update can be used to create simple progress indicators, cli-progress offers more advanced and customizable progress bar functionalities.
Blessed is a comprehensive library for creating terminal user interfaces. It supports a wide range of widgets, including text boxes, buttons, and progress bars. Compared to log-update, which is focused on updating log output, blessed provides a full-featured framework for building complex terminal applications.
FAQs
Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.
The npm package log-update receives a total of 26,474,288 weekly downloads. As such, log-update popularity was classified as popular.
We found that log-update demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.