Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
ts-progress
Advanced tools
Flexible node progress bar
npm install ts-progress
var Progress = require('ts-progress');
var total = 50, count = 0;
var progress = Progress.create({total: total});
var iv = setInterval(function () {
count++;
progress.update();
if (count == total) {
clearInterval(iv);
}
}, 150);
Progress bar accepts the following options on initialisation:
total: number
- Total number of items to process.pattern: string
- Optional layout pattern, defaults to 'Progress: {bar} | Elapsed: {elapsed} | {percent}'. See PatternstextColor: string
- Optional text color. See Colorstitle: string
- Optional title to display above progress bar.updateFrequency: number
- Optional update frequency limit in milliseconds. See Update frequency.
// with default options
var progress = Progress.create({total: 50});
// with pattern
var progress = Progress.create({total: 50, pattern: 'Progress: {bar} | Remaining: {remaining} | {percent} '});
//with pattern and text color
var progress = Progress.create({total: 50, pattern: 'Progress: {current}/{total} | Remaining: {remaining} | Elapsed: {elapsed} ', textColor: 'blue'});
//with default options and title
var progress = Progress.create({total: 50, title: 'Waiting for results'});
When set limits progress bar update rate. Used to limit refresh rate for quickly running tasks progress.
In the example below progress bar will only update every 150 milliseconds instead of updating 1000 times every millisecond. This will reduce resource allocation to progress bar.
var Progress = require('ts-progress');
var total = 1000, count = 0;
var progress = Progress.create({total: total, updateFrequency: 150});
var iv = setInterval(function () {
count++;
progress.update();
if (count == total) {
clearInterval(iv);
}
}, 1);
The following tokens are supported:
{bar}
- progress bar.{elapsed}
- elapsed time in seconds.{remaining}
- estimated remaining time in seconds.{percent}
- completion percentage{memory}
- process memory usage in megabytes.{current}
- current item.{total}
- total items.Tokens can be customised to define color for each token. Progress bar token accepts two colors for remaining/done items as well as length.
Usage for all tokens except progress bar:
{token.color}
Usage for progress bar:
{bar.color.color.length}
- default is {bar.white.green.20}var progress = Progress.create({total:50, pattern: 'Progress: {bar.white.red.10} | Remaining: {remaining.red} | {percent.blue}'});
Progress bar uses charm to render elements and supports charm string colors:
red
yellow
green
blue
cyan
magenta
black
white
FAQs
Flexible node progress bar for Windows/macOS/Linux.
The npm package ts-progress receives a total of 709 weekly downloads. As such, ts-progress popularity was classified as not popular.
We found that ts-progress 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.