Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
progress-string
Advanced tools
Readme
Generate a CLI progress bar as a string that you can then output in any way you like.
npm install progress-string --save
var progress = require('progress-string')
var diff = require('ansi-diff-stream')()
var value = 0
var total = 42
var bar = progress({width: 50, total: total})
setInterval(function () {
diff.write(
'The progress of the program is:\n' +
bar(++value)
)
if (value === total) process.exit()
}, 250)
diff.pipe(process.stdout)
var bar = progress(options)
This module exposes a function that takes a single options
argument
and retuns a bar function.
These are the options:
total
- (integer) The max value of the progress barwidth
- (integer, default: 42) The width of the progress bar in charsincomplete
- (string, default: -
) The char used to indicate the
incomplete part of the progress barcomplete
- (string, default: =
) The char used to indicate the
completed part of the progress barstyle
- (function, optional) See options.style
below for detailsoptions.style
You can provide a custom styling function to style the progress bar
returned by the bar
function.
It will be called with two arguments: complete
and incomplete
. Each
a string representing its part of the progress bar.
Whatever the style function returns will be returned by the bar
function.
var bar = progress({
width: 10,
total: 100,
style: function (complete, incomplete) {
// add an arrow at the head of the completed part
return complete + '>' + incomplete
}
})
console.log(bar(50)) // =====>-----
var str = bar(value)
Call the bar
function with the value
you want to the generated
progress bar to have.
The bar
function will return a string representation of the progress
bar.
MIT
FAQs
Get a progess bar as a string
The npm package progress-string receives a total of 1,342 weekly downloads. As such, progress-string popularity was classified as popular.
We found that progress-string demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.