Socket
Socket
Sign inDemoInstall

single-line-log

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-line-log

Keep writing to the same line in the terminal. Very useful when you write progress bars, or a status message during longer operations


Version published
Weekly downloads
100K
decreased by-27.11%
Maintainers
1
Weekly downloads
 
Created

What is single-line-log?

The single-line-log npm package allows you to log messages to the console on a single line, overwriting the previous message. This is particularly useful for creating progress bars, status updates, or any other scenario where you want to update the console output without cluttering it with multiple lines.

What are single-line-log's main functionalities?

Basic Single Line Logging

This feature allows you to log messages on a single line, overwriting the previous message. The code sample demonstrates logging 'Loading...', then 'Still loading...' after 1 second, and finally 'Done!' after 2 seconds.

const log = require('single-line-log').stdout;
log('Loading...');
setTimeout(() => log('Still loading...'), 1000);
setTimeout(() => log('Done!'), 2000);

Progress Bar

This feature is useful for creating a progress bar. The code sample shows a progress bar that updates every second, increasing the progress by 10% each time until it reaches 100%.

const log = require('single-line-log').stdout;
let progress = 0;
const interval = setInterval(() => {
  progress += 10;
  log(`Progress: ${progress}%`);
  if (progress >= 100) clearInterval(interval);
}, 1000);

Other packages similar to single-line-log

Keywords

FAQs

Package last updated on 11 Dec 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc