Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Formats a number with SI prefix (Metric prefix).
Add this line to your application's Gemfile:
gem 'si'
And then execute:
$ bundle
Or install it yourself as:
$ gem install si
si
Express a numeric value with SI prefix.
require 'si'
0.9.si # '900m'
9.si # '9'
98.si # '98'
987.si # '987'
9876.si # '9.88k'
98765.si # '98.8k'
987654.si # '988k'
9876543.si # '9.88M'
98765432.si # '98.8M'
987654321.si # '988M'
9876543210.si # '9.88G'
98765432100.si # '98.8G'
987654321000.si # '988G'
9876543210000.si # '9.88T'
# ...
Option | Default | Description |
---|---|---|
:length | 3 | Number of digits |
:base | 1000 | For binary prefix, set this to 1024 instead of default 1000 |
:min_exp | -8 | Down to yocto |
:max_exp | 8 | Up to Yotta |
9876543210000.si(:length => 5) # '9.8765T'
# For convenience, a single Fixnum is recognized as :length value
9876543210000.si(5) # '9.8765T'
si_byte
si_byte
is simply a shorcut for number.si(:length => length, :base => 1024, :min_exp => 0) + 'B'
.
13255342817.si_byte(3) # '12.3GB'
SI.convert(9876543210000, :length => 5) # '9.8765T'
SI.revert('100k', :base => 1024) # 102400.0
Require 'si/minimal' instead to avoid monkey-patching numeric classes.
require 'si/minimal'
SI.convert(987654321, 3) # 988M
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that si 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.